[FFmpeg-devel] [PATCH 39/41] avcodec/mpegvideo: Move scenechange_threshold to MPVMainEncContext
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sun Jan 30 08:27:47 EET 2022
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/mpegvideo.h | 1 -
libavcodec/mpegvideo_enc.c | 4 ++--
libavcodec/mpegvideoenc.h | 4 +++-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 201ca81621..5c7654230a 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -482,7 +482,6 @@ typedef struct MPVContext {
int frame_skip_exp;
int frame_skip_cmp;
- int scenechange_threshold;
int noise_reduction;
int intra_penalty;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 01ed41a2e7..1a88e4fb93 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -572,7 +572,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- if (s->scenechange_threshold < 1000000000 &&
+ if (m->scenechange_threshold < 1000000000 &&
(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)) {
av_log(avctx, AV_LOG_ERROR,
"closed gop with scene change detection are not supported yet, "
@@ -3632,7 +3632,7 @@ static int encode_picture(MPVMainEncContext *m, int picture_number)
s->current_picture. mb_var_sum= s->current_picture_ptr-> mb_var_sum= s->me. mb_var_sum_temp;
emms_c();
- if (s->me.scene_change_score > s->scenechange_threshold &&
+ if (s->me.scene_change_score > m->scenechange_threshold &&
s->pict_type == AV_PICTURE_TYPE_P) {
s->pict_type= AV_PICTURE_TYPE_I;
for(i=0; i<s->mb_stride*s->mb_height; i++)
diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h
index bc69c6ea53..662236c102 100644
--- a/libavcodec/mpegvideoenc.h
+++ b/libavcodec/mpegvideoenc.h
@@ -42,6 +42,8 @@ typedef struct MPVMainEncContext {
int me_penalty_compensation;
int me_pre; ///< prepass for motion estimation
+ int scenechange_threshold;
+
int gop_size;
int picture_in_gop_number; ///< 0-> first pic in gop, ...
@@ -177,7 +179,7 @@ FF_MPV_OPT_CMP_FUNC, \
{"skip_factor", "Frame skip factor", FF_MPV_OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"skip_exp", "Frame skip exponent", FF_MPV_OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"skip_cmp", "Frame skip compare function", FF_MPV_OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "cmp_func" }, \
-{"sc_threshold", "Scene change threshold", FF_MPV_OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
+{"sc_threshold", "Scene change threshold", FF_MPV_MAIN_OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"noise_reduction", "Noise reduction", FF_MPV_OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"ps", "RTP payload size in bytes", FF_MPV_OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"mepc", "Motion estimation bitrate penalty compensation (1.0 = 256)", FF_MPV_MAIN_OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
--
2.32.0
More information about the ffmpeg-devel
mailing list