diff options
author | Guo, Yejun <yejun.guo@intel.com> | 2019-09-23 10:02:34 +0800 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2019-09-24 17:22:15 +0100 |
commit | 104d44138be1f668973ed9ed5693a40d2514600c (patch) | |
tree | d0658c4af87ad198d833e9fdbeb0860b84cd015b /libavcodec/libx264.c | |
parent | 95e5396919b13a00264466b5d766f80f1a4f7fdc (diff) |
libavcodec/libx264: add a flag to output ROI warnings only once.
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r-- | libavcodec/libx264.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 86e3530e79..8788286fae 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -99,6 +99,12 @@ typedef struct X264Context { int nb_reordered_opaque, next_reordered_opaque; int64_t *reordered_opaque; + + /** + * If the encoder does not support ROI then warn the first time we + * encounter a frame with ROI side data. + */ + int roi_warned; } X264Context; static void X264_log(void *p, int level, const char *fmt, va_list args) @@ -356,7 +362,10 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, sd = av_frame_get_side_data(frame, AV_FRAME_DATA_REGIONS_OF_INTEREST); if (sd) { if (x4->params.rc.i_aq_mode == X264_AQ_NONE) { - av_log(ctx, AV_LOG_WARNING, "Adaptive quantization must be enabled to use ROI encoding, skipping ROI.\n"); + if (!x4->roi_warned) { + x4->roi_warned = 1; + av_log(ctx, AV_LOG_WARNING, "Adaptive quantization must be enabled to use ROI encoding, skipping ROI.\n"); + } } else { if (frame->interlaced_frame == 0) { int mbx = (frame->width + MB_SIZE - 1) / MB_SIZE; @@ -410,7 +419,10 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, x4->pic.prop.quant_offsets = qoffsets; x4->pic.prop.quant_offsets_free = av_free; } else { - av_log(ctx, AV_LOG_WARNING, "interlaced_frame not supported for ROI encoding yet, skipping ROI.\n"); + if (!x4->roi_warned) { + x4->roi_warned = 1; + av_log(ctx, AV_LOG_WARNING, "interlaced_frame not supported for ROI encoding yet, skipping ROI.\n"); + } } } } |