[FFmpeg-devel] [PATCH v4 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper

Huiwen Ren hwrenx at 126.com
Wed Sep 5 10:19:25 EEST 2018










At 2018-09-05 08:46:18, "Mark Thompson" <sw at jkqxz.net> wrote:
>On 03/09/18 03:42, hwren wrote:
>> Signed-off-by: hwren <hwrenx at 126.com>
>> ---
[...]
>> +
>> +    int i_lcurow_threads;
>> +    int i_initial_qp;
>> +    int preset_level;
>> +    int intra_period;
>
>There is a common option AVCodecContext.gop_size (-g) which should probably be used rather than inventing a new private option with the same meaning.

intra_period in xavs2 seems not equals to gop_size in ffmpeg, intra period here is calculated by (actul_intra_period/gop_size).

[...]

>> +    if (avctx->bit_rate > 0) {
>> +        cae->api->opt_set2(cae->param, "RateControl",  "1");
>> +        av_strlcatf(str_TBR, sizeof(str_TBR), "%d", avctx->bit_rate);
>> +        cae->api->opt_set2(cae->param, "TargetBitRate", str_TBR);
>> +    }
>
>What happens if there is no bitrate target?  Some sort of constant-quality mode?  Are there any parameters for that?

Rate control in xavs2 will only work if given bit_rate and the speed(preset) level is used to control quality.

[...]
>> +    } else {
>> +        cae->api->encoder_encode(cae->encoder, NULL, &cae->packet);
>> +    }
>> +
>> +    if ((cae->packet.len) && (cae->packet.state != XAVS2_STATE_FLUSH_END)){
>
>Is there any particular reason why the packet is in the context structure but the picture is on the stack?  They look like they should have effectively equivalent lifetime and therefore be treated in the same way.
>

The xavs2 picture is under control of xavs2 encoder while the packet should be handle in the wrapper.

>> +
>> +        if (av_new_packet(pkt, cae->packet.len) < 0){
>> +            av_log(avctx, AV_LOG_ERROR, "packet alloc failed\n");
>> +            return AVERROR(EINVAL);
>
>ENOMEM.  You probably need to unref the xavs2 packet as well if this happens?
>

Will unref  by the encoder.

[...]
>> +} ;
>
>Thanks,
>
>- Mark

Thanks for  patience and advice,

Huiwen Ren

>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list