[FFmpeg-devel] [PATCH] lavfi/vf_fieldmatch: keep fields as-is if not matched properly
Makes it possible to use deinterlacers which output one frame for each field as fallback if field matching fails (combmatch=full). Currently, the documented example with fallback on a post-deinterlacer will only work in case the deinterlacer outputs one frame per first field (as yadif=mode=0). The reason for that is that fieldmatch will attempt to match the second field regardless of whether it recognizes the end result is still interlaced. This produces garbled output with for example mixed telecined 24fps and 60i content combined with a field-based deinterlaced such as yadif=mode=1. This patch orders fieldmatch to revert to using the second field of the current frame in case the end result is still interlaced and a post-deinterlacer is assumed to be used. Signed-off-by: lovesyk --- libavfilter/vf_fieldmatch.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c index 40e559df9e..bf946beec9 100644 --- a/libavfilter/vf_fieldmatch.c +++ b/libavfilter/vf_fieldmatch.c @@ -680,7 +680,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; FieldMatchContext *fm = ctx->priv; int combs[] = { -1, -1, -1, -1, -1 }; -int order, field, i, match, sc = 0, ret = 0; +int order, field, i, match, interlaced_frame, sc = 0, ret = 0; const int *fxo; AVFrame *gen_frames[] = { NULL, NULL, NULL, NULL, NULL }; AVFrame *dst = NULL; @@ -793,6 +793,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } } +/* keep fields as-is if not matched properly */ +interlaced_frame = combs[match] >= fm->combpel; +if (interlaced_frame && fm->combmatch == COMBMATCH_FULL) { +match = mC; +} + /* get output frame and drop the others */ if (fm->ppsrc) { /* field matching was based on a filtered/post-processed input, we now @@ -813,7 +819,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) /* mark the frame we are unable to match properly as interlaced so a proper * de-interlacer can take the relay */ -dst->interlaced_frame = combs[match] >= fm->combpel; +dst->interlaced_frame = interlaced_frame; if (dst->interlaced_frame) { av_log(ctx, AV_LOG_WARNING, "Frame #%"PRId64" at %s is still interlaced\n", outlink->frame_count_in, av_ts2timestr(in->pts, &inlink->time_base)); -- 2.34.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavfi/vf_fieldmatch: keep fields as-is if not matched properly
This is reproducible using for example https://samples.ffmpeg.org/MPEG2/interlaced/burosch1.mpg ffmpeg -i burosch1.mpg -map 0:v -c:v libx264 -vf fieldmatch=combmatch=full,yadif=mode=1:deint=interlaced -preset veryfast -crf 10 burosch1.mp4 The end result will be in 50p and without the patch randomly have the frames in the wrong order. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavfi/vf_decimate: add mixed option to process input only partially to be decimated
Enabling the option will only decimate frames below dupthresh and output at variable frame rate. Signed-off-by: lovesyk --- libavfilter/vf_decimate.c | 42 +-- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index f61e501c96..dbeca427f1 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -44,6 +44,7 @@ typedef struct DecimateContext { AVFrame **clean_src;///< frame queue for the clean source int got_frame[2]; ///< frame request flag for each input stream int64_t last_pts; ///< last output timestamp +int64_t last_duration; ///< last output duration int64_t start_pts; ///< base for output timestamps uint32_t eof; ///< bitmask for end of stream int hsub, vsub; ///< chroma subsampling values @@ -51,6 +52,9 @@ typedef struct DecimateContext { int nxblocks, nyblocks; int bdiffsize; int64_t *bdiffs; +AVRational in_tb; // input time-base +AVRational nondec_tb; // non-decimated time-base +AVRational dec_tb; // decimated time-base /* options */ int cycle; @@ -61,6 +65,7 @@ typedef struct DecimateContext { int blockx, blocky; int ppsrc; int chroma; +int mixed; } DecimateContext; #define OFFSET(x) offsetof(DecimateContext, x) @@ -74,6 +79,7 @@ static const AVOption decimate_options[] = { { "blocky","set the size of the y-axis blocks used during metric calculations", OFFSET(blocky), AV_OPT_TYPE_INT, {.i64 = 32}, 4, 1<<9, FLAGS }, { "ppsrc", "mark main input as a pre-processed input and activate clean source input stream", OFFSET(ppsrc), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, { "chroma","set whether or not chroma is considered in the metric calculations", OFFSET(chroma), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS }, +{ "mixed", "set whether or not the input only partially contains content to be decimated", OFFSET(mixed), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, { NULL } }; @@ -193,7 +199,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } if (dm->queue[lowest].maxbdiff < dm->dupthresh) duppos = lowest; -drop = scpos >= 0 && duppos < 0 ? scpos : lowest; + +if (dm->mixed && duppos < 0) { +drop = -1; // no drop if mixed content + no frame in cycle below threshold +} else { +drop = scpos >= 0 && duppos < 0 ? scpos : lowest; +} } /* metrics debug */ @@ -212,7 +223,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) /* push all frames except the drop */ ret = 0; for (i = 0; i < dm->cycle && dm->queue[i].frame; i++) { -AVRational in_tb = ctx->inputs[INPUT_MAIN]->time_base; if (i == drop) { if (dm->ppsrc) av_frame_free(&dm->clean_src[i]); @@ -221,7 +231,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFrame *frame = dm->queue[i].frame; dm->queue[i].frame = NULL; if (frame->pts != AV_NOPTS_VALUE && dm->start_pts == AV_NOPTS_VALUE) -dm->start_pts = av_rescale_q(frame->pts, in_tb, outlink->time_base); +dm->start_pts = av_rescale_q(frame->pts, dm->in_tb, outlink->time_base); if (dm->ppsrc) { av_frame_free(&frame); @@ -230,9 +240,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) continue; dm->clean_src[i] = NULL; } -frame->pts = outlink->frame_count_in + + +frame->pts = dm->last_duration ? dm->last_pts + dm->last_duration : (dm->start_pts == AV_NOPTS_VALUE ? 0 : dm->start_pts); -frame->duration = 1; +frame->duration = dm->mixed ? av_div_q(drop < 0 ? dm->nondec_tb : dm->dec_tb, outlink->time_base).num : 1; +dm->last_duration = frame->duration; dm->last_pts = frame->pts; ret = ff_filter_frame(outlink, frame); if (ret < 0) @@ -329,6 +341,7 @@ static av_cold int decimate_init(AVFilterContext *ctx) } dm->start_pts = AV_NOPTS_VALUE; +dm->last_duration = 0; return 0; } @@ -388,6 +401,9 @@ static int config_output(AVFilterLink *outlink) dm->bdiffsize = dm->nxblocks * dm->nyblocks; dm->bdiffs= av_malloc_array(dm->bdiffsize, sizeof(*dm->bdiffs)); dm->queue = av_calloc(dm->cycle, sizeof(*dm->queue)); +dm->in_tb = inlink->time_base; +dm->nondec_tb = av_inv_q(fps); +dm->dec_tb= av_mul_q(dm->nondec_tb, (AVRational){dm->cycle, dm->cycle - 1}); if (!dm->bdiffs || !dm->queue) return AVERROR(ENOMEM); @@ -403,11 +419,17 @@ static int config_output(AVFilterLink *outlink) "current rate of %d/%d is invalid\n", fps.num, fps.den); return AVE
Re: [FFmpeg-devel] [PATCH] lavfi/vf_decimate: add mixed option to process input only partially to be decimated
The purpose of this new option is to enable processing of mixed content such as TV recordings or even movies which have some cuts in telecined 24fps and others in 30p. Enabling it (mixed=1) will calculate a common timebase between decimated and non-decimated content and set frame duration according to whether the current cycle contains a frame deemed to be a duplicate or not. The default is disabled (mixed=0) and keeping it disabled will keep the PTS as before (verified using ffprobe). Regarding setting frame->pts, I had to adjust this part a bit as it is no longer possible to assume all frames counted by frame_count_in have the same duration. As for outlink->frame_rate, I have removed the assignment in the case of mixed content as the output will be of variable frame rate. Please tell me in case this is not sufficient to signalize VFR content. An example for verifying the result is http://samples.ffmpeg.org/HDTV/Hellboy.ts ffmpeg -i Hellboy.ts -map 0:v -c:v libx264 -vf fps=fps=3/1001,fieldmatch,decimate=mixed=1,fps=fps=12/1001 -preset veryfast -crf 10 Hellboy.mp4 The source has a frame rate of 3/1001 -> timebase 1001/3 which with a decimation cycle of 5 results in a decimated timebase of 24000/1001 and a common timebase of 1001/12. The source contains 24fps interlaced content which will result in a duration of 5 frames at the output frame rate of 12/1001. The source also contains 30p content which in the output will have a duration of 4 frames. This particular source requires the frame rate to be set to constant 3/1001. I haven't looked into why but I have verified this to also be required if not applying this patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: Use preprocessors conditions
From: Pawday --- libavcodec/avcodec.c | 13 + libavcodec/decode.c | 5 +++-- libavcodec/encode.c | 8 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index a85d3c2309..1e24bdf333 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -403,10 +403,12 @@ void avcodec_flush_buffers(AVCodecContext *avctx) av_frame_unref(avci->buffer_frame); av_packet_unref(avci->buffer_pkt); -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) +#if HAVE_THREADS +if (avctx->active_thread_type & FF_THREAD_FRAME) ff_thread_flush(avctx); else if (ffcodec(avctx->codec)->flush) ffcodec(avctx->codec)->flush(avctx); +#endif } void avsubtitle_free(AVSubtitle *sub) @@ -441,12 +443,15 @@ av_cold int avcodec_close(AVCodecContext *avctx) if (avcodec_is_open(avctx)) { AVCodecInternal *avci = avctx->internal; -if (CONFIG_FRAME_THREAD_ENCODER && -avci->frame_thread_encoder && avctx->thread_count > 1) { +#if CONFIG_FRAME_THREAD_ENCODER +if (avci->frame_thread_encoder && avctx->thread_count > 1) { ff_frame_thread_encoder_free(avctx); } -if (HAVE_THREADS && avci->thread_ctx) +#endif +#if HAVE_THREADS +if (avci->thread_ctx) ff_thread_free(avctx); +#endif if (avci->needs_close && ffcodec(avctx->codec)->close) ffcodec(avctx->codec)->close(avctx); avci->byte_buffer_size = 0; diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6be2d3d6ed..7979b9277a 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -300,8 +300,8 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, return AVERROR_EOF; got_frame = 0; - -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) { +#if HAVE_THREADS +if (avctx->active_thread_type & FF_THREAD_FRAME) { ret = ff_thread_decode_frame(avctx, frame, &got_frame, pkt); } else { ret = codec->cb.decode(avctx, frame, &got_frame, pkt); @@ -321,6 +321,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, } } } +#endif emms_c(); actual_got_frame = got_frame; diff --git a/libavcodec/encode.c b/libavcodec/encode.c index fbe2c97cd6..6f39bfeb50 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -269,7 +269,7 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt) got_packet = 0; av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE); - +#if CONFIG_FRAME_THREAD_ENCODER if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder) /* This will unref frame. */ ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet); @@ -280,7 +280,7 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt) av_frame_unref(frame); #endif } - +#endif if (avci->draining && !got_packet) avci->draining_done = 1; @@ -670,11 +670,11 @@ int ff_encode_preinit(AVCodecContext *avctx) return AVERROR(ENOMEM); } -if (CONFIG_FRAME_THREAD_ENCODER) { +#if CONFIG_FRAME_THREAD_ENCODER ret = ff_frame_thread_encoder_init(avctx); if (ret < 0) return ret; -} +#endif return 0; } -- 2.33.0.windows.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec: Use preprocessors conditions
From: Pawday Thank you Andreas Rheinhardt for review Here the fixes for runtime "else" conditions --- libavcodec/avcodec.c | 16 +++- libavcodec/decode.c | 11 --- libavcodec/encode.c | 13 - libavcodec/h264dec.c | 14 +++--- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index a85d3c2309..0e792aead9 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -403,10 +403,13 @@ void avcodec_flush_buffers(AVCodecContext *avctx) av_frame_unref(avci->buffer_frame); av_packet_unref(avci->buffer_pkt); -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) +#if HAVE_THREADS +if (avctx->active_thread_type & FF_THREAD_FRAME) ff_thread_flush(avctx); -else if (ffcodec(avctx->codec)->flush) +#else +if (ffcodec(avctx->codec)->flush) ffcodec(avctx->codec)->flush(avctx); +#endif } void avsubtitle_free(AVSubtitle *sub) @@ -441,12 +444,15 @@ av_cold int avcodec_close(AVCodecContext *avctx) if (avcodec_is_open(avctx)) { AVCodecInternal *avci = avctx->internal; -if (CONFIG_FRAME_THREAD_ENCODER && -avci->frame_thread_encoder && avctx->thread_count > 1) { +#if CONFIG_FRAME_THREAD_ENCODER +if (avci->frame_thread_encoder && avctx->thread_count > 1) { ff_frame_thread_encoder_free(avctx); } -if (HAVE_THREADS && avci->thread_ctx) +#endif +#if HAVE_THREADS +if (avci->thread_ctx) ff_thread_free(avctx); +#endif if (avci->needs_close && ffcodec(avctx->codec)->close) ffcodec(avctx->codec)->close(avctx); avci->byte_buffer_size = 0; diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6be2d3d6ed..54ffd0f203 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -300,10 +300,14 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, return AVERROR_EOF; got_frame = 0; - -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) { +#if HAVE_THREADS +if (avctx->active_thread_type & FF_THREAD_FRAME) { ret = ff_thread_decode_frame(avctx, frame, &got_frame, pkt); -} else { +} +#endif + +#if !HAVE_THREADS +if (!(avctx->active_thread_type & FF_THREAD_FRAME)) { ret = codec->cb.decode(avctx, frame, &got_frame, pkt); if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)) @@ -321,6 +325,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, } } } +#endif emms_c(); actual_got_frame = got_frame; diff --git a/libavcodec/encode.c b/libavcodec/encode.c index fbe2c97cd6..b19599e67e 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -269,17 +269,20 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt) got_packet = 0; av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE); - -if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder) +#if CONFIG_FRAME_THREAD_ENCODER +if (avci->frame_thread_encoder) /* This will unref frame. */ ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet); -else { +#endif +#if !CONFIG_FRAME_THREAD_ENCODER +if (!avci->frame_thread_encoder) { ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet); #if FF_API_THREAD_SAFE_CALLBACKS if (frame) av_frame_unref(frame); #endif } +#endif // !CONFIG_FRAME_THREAD_ENCODER if (avci->draining && !got_packet) avci->draining_done = 1; @@ -670,11 +673,11 @@ int ff_encode_preinit(AVCodecContext *avctx) return AVERROR(ENOMEM); } -if (CONFIG_FRAME_THREAD_ENCODER) { +#if CONFIG_FRAME_THREAD_ENCODER ret = ff_frame_thread_encoder_init(avctx); if (ret < 0) return ret; -} +#endif return 0; } diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 6ede4e8c9f..4538974dab 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -933,13 +933,13 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g *got_frame = 1; -if (CONFIG_MPEGVIDEODEC) { -ff_print_debug_info2(h->avctx, dst, NULL, - out->mb_type, - out->qscale_table, - out->motion_val, - out->mb_width, out->mb_height, out->mb_stride, 1); -} +#if CONFIG_MPEGVIDEODEC +ff_print_debug_info2(h->avctx, dst, NULL, + out->mb_type, + out->qscale_table, + out->motion_val, + out->mb_width, out->mb_height, out->mb_stride, 1); +#endif } return 0; -- ___ ffmpeg-devel mailing list ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec: Use preprocessors conditions
From: Pawday Thank you for showing me logic substitution issues. So, if you curious i am trying to substitute calling thread depending functions for unuptimized compiler where dead code illumination is not working and it couse linking error on my microcontroller toolchain without any thread model support. --- libavcodec/avcodec.c | 23 --- libavcodec/decode.c | 7 +-- libavcodec/encode.c | 9 ++--- libavcodec/h264dec.c | 14 +++--- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index a85d3c2309..9a11ab043f 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @ -403,10 +403,16 @@ void avcodec_flush_buffers(AVCodecContext *avctx) av_frame_unref(avci->buffer_frame); av_packet_unref(avci->buffer_pkt); -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) +#if HAVE_THREADS +if (avctx->active_thread_type & FF_THREAD_FRAME) ff_thread_flush(avctx); -else if (ffcodec(avctx->codec)->flush) -ffcodec(avctx->codec)->flush(avctx); +else { +#endif +if (ffcodec(avctx->codec)->flush) +ffcodec(avctx->codec)->flush(avctx); +#if HAVE_THREADS +} +#endif } void avsubtitle_free(AVSubtitle *sub) @@ -441,12 +447,15 @@ av_cold int avcodec_close(AVCodecContext *avctx) if (avcodec_is_open(avctx)) { AVCodecInternal *avci = avctx->internal; -if (CONFIG_FRAME_THREAD_ENCODER && -avci->frame_thread_encoder && avctx->thread_count > 1) { +#if CONFIG_FRAME_THREAD_ENCODER +if (avci->frame_thread_encoder && avctx->thread_count > 1) { ff_frame_thread_encoder_free(avctx); } -if (HAVE_THREADS && avci->thread_ctx) +#endif +#if HAVE_THREADS +if (avci->thread_ctx) ff_thread_free(avctx); +#endif if (avci->needs_close && ffcodec(avctx->codec)->close) ffcodec(avctx->codec)->close(avctx); avci->byte_buffer_size = 0; diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 6be2d3d6ed..5076b8a420 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -300,10 +300,11 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, return AVERROR_EOF; got_frame = 0; - -if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) { +#if HAVE_THREADS +if (avctx->active_thread_type & FF_THREAD_FRAME) { ret = ff_thread_decode_frame(avctx, frame, &got_frame, pkt); } else { +#endif ret = codec->cb.decode(avctx, frame, &got_frame, pkt); if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)) @@ -320,7 +321,9 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, if (frame->format == AV_PIX_FMT_NONE) frame->format = avctx->pix_fmt; } } +#if HAVE_THREADS } +#endif emms_c(); actual_got_frame = got_frame; diff --git a/libavcodec/encode.c b/libavcodec/encode.c index fbe2c97cd6..efd1cbe6c7 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -269,17 +269,20 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt) got_packet = 0; av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE); - +#if CONFIG_FRAME_THREAD_ENCODER if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder) /* This will unref frame. */ ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet); else { +#endif ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet); #if FF_API_THREAD_SAFE_CALLBACKS if (frame) av_frame_unref(frame); #endif +#if CONFIG_FRAME_THREAD_ENCODER } +#endif if (avci->draining && !got_packet) avci->draining_done = 1; @@ -670,11 +673,11 @@ int ff_encode_preinit(AVCodecContext *avctx) return AVERROR(ENOMEM); } -if (CONFIG_FRAME_THREAD_ENCODER) { +#if CONFIG_FRAME_THREAD_ENCODER ret = ff_frame_thread_encoder_init(avctx); if (ret < 0) return ret; -} +#endif return 0; } diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 6ede4e8c9f..4538974dab 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -933,13 +933,13 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g *got_frame = 1; -if (CONFIG_MPEGVIDEODEC) { -ff_print_debug_info2(h->avctx, dst, NULL, - out->mb_type, - out->qscale_table, - out->motion_val, - out->mb_width, out->mb_height, out->mb_stride, 1); -} +#if CONFIG_MPEGVIDEODEC +ff_print_debug_info2(h->avctx, dst, NULL, + out->mb_type, + out->qscale_table, +