History

avcodec/mpegvideo: Move ratecontrol-adjacent fields to MPVMainEncContext

Andreas Rheinhardt committed 1 year ago

Commit d1fd8661 parent b7106985 files · +44 −39Browse files

Showing the changes to libavcodec (5 of 5 files). Show all

Unified · Split

5 files
  1. libavcodec/mpegvideo.h +0 −6
  2. libavcodec/mpegvideo_enc.c +21 −19
  3. libavcodec/mpegvideoenc.h +11 −4
  4. libavcodec/ratecontrol.c +10 −8
  5. libavcodec/snowenc.c +2 −2
libavcodec/mpegvideo.h+0−6
@@ -101,7 +101,6 @@ typedef struct MpegEncContext { · 100 unmodified lines
101 int h263_flv; ///< use flv H.263 header101 int h263_flv; ///< use flv H.263 header
102 102
103 enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */103 enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
104 int fixed_qscale; ///< fixed qscale if non zero
105 int encoding; ///< true if we are encoding (vs decoding)104 int encoding; ///< true if we are encoding (vs decoding)
106 int max_b_frames; ///< max number of B-frames for encoding105 int max_b_frames; ///< max number of B-frames for encoding
107 int luma_elim_threshold;106 int luma_elim_threshold;
@@ -478,10 +477,6 @@ typedef struct MpegEncContext { · 370 unmodified lines
478 me_cmp_func sse_cmp[2];477 me_cmp_func sse_cmp[2];
479 int (*sum_abs_dctelem)(const int16_t *block);478 int (*sum_abs_dctelem)(const int16_t *block);
480 479
481 float border_masking;
482 int lmin, lmax;
483 int vbv_ignore_qmax;
484
485 /// Bitfield containing information which frames to reconstruct.480 /// Bitfield containing information which frames to reconstruct.
486 int frame_reconstruction_bitfield;481 int frame_reconstruction_bitfield;
487 482
@@ -493,7 +488,6 @@ typedef struct MpegEncContext { · 5 unmodified lines
493 488
494 int error_rate;489 int error_rate;
495 490
496 int scenechange_threshold;
497 int noise_reduction;491 int noise_reduction;
498 492
499 int intra_penalty;493 int intra_penalty;
libavcodec/mpegvideo_enc.c+21−19
@@ -195,8 +195,10 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], · 194 unmodified lines
195 }195 }
196}196}
197 197
198static inline void update_qscale(MpegEncContext *s)198static inline void update_qscale(MPVMainEncContext *const m)
199{199{
200 MpegEncContext *const s = &m->s;
201
200 if (s->q_scale_type == 1 && 0) {202 if (s->q_scale_type == 1 && 0) {
201 int i;203 int i;
202 int bestdiff=INT_MAX;204 int bestdiff=INT_MAX;
@@ -205,7 +207,7 @@ static inline void update_qscale(MpegEncContext *s) · 2 unmodified lines
205 for (i = 0 ; i<FF_ARRAY_ELEMS(ff_mpeg2_non_linear_qscale); i++) {207 for (i = 0 ; i<FF_ARRAY_ELEMS(ff_mpeg2_non_linear_qscale); i++) {
206 int diff = FFABS((ff_mpeg2_non_linear_qscale[i]<<(FF_LAMBDA_SHIFT + 6)) - (int)s->lambda * 139);208 int diff = FFABS((ff_mpeg2_non_linear_qscale[i]<<(FF_LAMBDA_SHIFT + 6)) - (int)s->lambda * 139);
207 if (ff_mpeg2_non_linear_qscale[i] < s->avctx->qmin ||209 if (ff_mpeg2_non_linear_qscale[i] < s->avctx->qmin ||
208 (ff_mpeg2_non_linear_qscale[i] > s->avctx->qmax && !s->vbv_ignore_qmax))210 (ff_mpeg2_non_linear_qscale[i] > s->avctx->qmax && !m->vbv_ignore_qmax))
209 continue;211 continue;
210 if (diff < bestdiff) {212 if (diff < bestdiff) {
211 bestdiff = diff;213 bestdiff = diff;
@@ -216,7 +218,7 @@ static inline void update_qscale(MpegEncContext *s) · 4 unmodified lines
216 } else {218 } else {
217 s->qscale = (s->lambda * 139 + FF_LAMBDA_SCALE * 64) >>219 s->qscale = (s->lambda * 139 + FF_LAMBDA_SCALE * 64) >>
218 (FF_LAMBDA_SHIFT + 7);220 (FF_LAMBDA_SHIFT + 7);
219 s->qscale = av_clip(s->qscale, s->avctx->qmin, s->vbv_ignore_qmax ? 31 : s->avctx->qmax);221 s->qscale = av_clip(s->qscale, s->avctx->qmin, m->vbv_ignore_qmax ? 31 : s->avctx->qmax);
220 }222 }
221 223
222 s->lambda2 = (s->lambda * s->lambda + FF_LAMBDA_SCALE / 2) >>224 s->lambda2 = (s->lambda * s->lambda + FF_LAMBDA_SCALE / 2) >>
@@ -507,16 +509,16 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 284 unmodified lines
507 }509 }
508 510
509 /* Fixed QSCALE */511 /* Fixed QSCALE */
510 s->fixed_qscale = !!(avctx->flags & AV_CODEC_FLAG_QSCALE);512 m->fixed_qscale = !!(avctx->flags & AV_CODEC_FLAG_QSCALE);
511 513
512 s->adaptive_quant = (avctx->lumi_masking ||514 s->adaptive_quant = (avctx->lumi_masking ||
513 avctx->dark_masking ||515 avctx->dark_masking ||
514 avctx->temporal_cplx_masking ||516 avctx->temporal_cplx_masking ||
515 avctx->spatial_cplx_masking ||517 avctx->spatial_cplx_masking ||
516 avctx->p_masking ||518 avctx->p_masking ||
517 s->border_masking ||519 m->border_masking ||
518 (s->mpv_flags & FF_MPV_FLAG_QP_RD)) &&520 (s->mpv_flags & FF_MPV_FLAG_QP_RD)) &&
519 !s->fixed_qscale;521 !m->fixed_qscale;
520 522
521 s->loop_filter = !!(avctx->flags & AV_CODEC_FLAG_LOOP_FILTER);523 s->loop_filter = !!(avctx->flags & AV_CODEC_FLAG_LOOP_FILTER);
522 524
@@ -580,7 +582,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 57 unmodified lines
580 return AVERROR(EINVAL);582 return AVERROR(EINVAL);
581 }583 }
582 584
583 if (!s->fixed_qscale &&585 if (!m->fixed_qscale &&
584 avctx->bit_rate * av_q2d(avctx->time_base) >586 avctx->bit_rate * av_q2d(avctx->time_base) >
585 avctx->bit_rate_tolerance) {587 avctx->bit_rate_tolerance) {
586 double nbt = avctx->bit_rate * av_q2d(avctx->time_base) * 5;588 double nbt = avctx->bit_rate * av_q2d(avctx->time_base) * 5;
@@ -675,7 +677,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 88 unmodified lines
675 return AVERROR(EINVAL);677 return AVERROR(EINVAL);
676 }678 }
677 679
678 if (s->scenechange_threshold < 1000000000 &&680 if (m->scenechange_threshold < 1000000000 &&
679 (avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)) {681 (avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)) {
680 av_log(avctx, AV_LOG_ERROR,682 av_log(avctx, AV_LOG_ERROR,
681 "closed gop with scene change detection are not supported yet, "683 "closed gop with scene change detection are not supported yet, "
@@ -890,9 +892,9 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) · 208 unmodified lines
890 s->frame_reconstruction_bitfield = 0;892 s->frame_reconstruction_bitfield = 0;
891 }893 }
892 894
893 if (s->lmin > s->lmax) {895 if (m->lmin > m->lmax) {
894 av_log(avctx, AV_LOG_WARNING, "Clipping lmin value to %d\n", s->lmax);896 av_log(avctx, AV_LOG_WARNING, "Clipping lmin value to %d\n", m->lmax);
895 s->lmin = s->lmax;897 m->lmin = m->lmax;
896 }898 }
897 899
898 /* init */900 /* init */
@@ -1876,7 +1878,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, · 977 unmodified lines
1876 1878
1877 ff_mpv_unref_picture(&s->cur_pic);1879 ff_mpv_unref_picture(&s->cur_pic);
1878 1880
1879 s->vbv_ignore_qmax = 0;1881 m->vbv_ignore_qmax = 0;
1880 1882
1881 m->picture_in_gop_number++;1883 m->picture_in_gop_number++;
1882 1884
@@ -1935,7 +1937,7 @@ vbv_retry: · 52 unmodified lines
1935 int min_step = hq ? 1 : (1<<(FF_LAMBDA_SHIFT + 7))/139;1937 int min_step = hq ? 1 : (1<<(FF_LAMBDA_SHIFT + 7))/139;
1936 1938
1937 if (put_bits_count(&s->pb) > max_size &&1939 if (put_bits_count(&s->pb) > max_size &&
1938 s->lambda < s->lmax) {1940 s->lambda < m->lmax) {
1939 m->next_lambda = FFMAX(s->lambda + min_step, s->lambda *1941 m->next_lambda = FFMAX(s->lambda + min_step, s->lambda *
1940 (s->qscale + 1) / s->qscale);1942 (s->qscale + 1) / s->qscale);
1941 if (s->adaptive_quant) {1943 if (s->adaptive_quant) {
@@ -1955,7 +1957,7 @@ vbv_retry: · 13 unmodified lines
1955 s->time_base = s->last_time_base;1957 s->time_base = s->last_time_base;
1956 s->last_non_b_time = s->time - s->pp_time;1958 s->last_non_b_time = s->time - s->pp_time;
1957 }1959 }
1958 s->vbv_ignore_qmax = 1;1960 m->vbv_ignore_qmax = 1;
1959 av_log(avctx, AV_LOG_VERBOSE, "reencoding frame due to VBV\n");1961 av_log(avctx, AV_LOG_VERBOSE, "reencoding frame due to VBV\n");
1960 goto vbv_retry;1962 goto vbv_retry;
1961 }1963 }
@@ -3616,7 +3618,7 @@ static int estimate_qp(MPVMainEncContext *const m, int dry_run) · 1654 unmodified lines
3616 if (m->next_lambda){3618 if (m->next_lambda){
3617 s->cur_pic.ptr->f->quality = m->next_lambda;3619 s->cur_pic.ptr->f->quality = m->next_lambda;
3618 if(!dry_run) m->next_lambda= 0;3620 if(!dry_run) m->next_lambda= 0;
3619 } else if (!s->fixed_qscale) {3621 } else if (!m->fixed_qscale) {
3620 int quality = ff_rate_estimate_qscale(m, dry_run);3622 int quality = ff_rate_estimate_qscale(m, dry_run);
3621 s->cur_pic.ptr->f->quality = quality;3623 s->cur_pic.ptr->f->quality = quality;
3622 if (s->cur_pic.ptr->f->quality < 0)3624 if (s->cur_pic.ptr->f->quality < 0)
@@ -3643,7 +3645,7 @@ static int estimate_qp(MPVMainEncContext *const m, int dry_run) · 20 unmodified lines
3643 //FIXME broken3645 //FIXME broken
3644 }else3646 }else
3645 s->lambda = s->cur_pic.ptr->f->quality;3647 s->lambda = s->cur_pic.ptr->f->quality;
3646 update_qscale(s);3648 update_qscale(m);
3647 return 0;3649 return 0;
3648}3650}
3649 3651
@@ -3700,7 +3702,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt) · 50 unmodified lines
3700 s->lambda= s->last_lambda_for[s->pict_type];3702 s->lambda= s->last_lambda_for[s->pict_type];
3701 else3703 else
3702 s->lambda= s->last_lambda_for[s->last_non_b_pict_type];3704 s->lambda= s->last_lambda_for[s->last_non_b_pict_type];
3703 update_qscale(s);3705 update_qscale(m);
3704 }3706 }
3705 3707
3706 ff_me_init_pic(s);3708 ff_me_init_pic(s);
@@ -3742,7 +3744,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt) · 35 unmodified lines
3742 for(i=0; i<s->mb_stride*s->mb_height; i++)3744 for(i=0; i<s->mb_stride*s->mb_height; i++)
3743 s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;3745 s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
3744 3746
3745 if(!s->fixed_qscale){3747 if (!m->fixed_qscale) {
3746 /* finding spatial complexity for I-frame rate control */3748 /* finding spatial complexity for I-frame rate control */
3747 s->avctx->execute(s->avctx, mb_var_thread, &s->thread_context[0], NULL, context_count, sizeof(void*));3749 s->avctx->execute(s->avctx, mb_var_thread, &s->thread_context[0], NULL, context_count, sizeof(void*));
3748 }3750 }
@@ -3754,7 +3756,7 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt) · 5 unmodified lines
3754 s->mb_var_sum = s->me. mb_var_sum_temp;3756 s->mb_var_sum = s->me. mb_var_sum_temp;
3755 emms_c();3757 emms_c();
3756 3758
3757 if (s->me.scene_change_score > s->scenechange_threshold &&3759 if (s->me.scene_change_score > m->scenechange_threshold &&
3758 s->pict_type == AV_PICTURE_TYPE_P) {3760 s->pict_type == AV_PICTURE_TYPE_P) {
3759 s->pict_type= AV_PICTURE_TYPE_I;3761 s->pict_type= AV_PICTURE_TYPE_I;
3760 for(i=0; i<s->mb_stride*s->mb_height; i++)3762 for(i=0; i<s->mb_stride*s->mb_height; i++)
libavcodec/mpegvideoenc.h+11−4
@@ -61,6 +61,12 @@ typedef struct MPVMainEncContext { · 60 unmodified lines
61 int b_sensitivity;61 int b_sensitivity;
62 int brd_scale;62 int brd_scale;
63 63
64 int scenechange_threshold;
65
66 float border_masking;
67 int lmin, lmax;
68 int vbv_ignore_qmax;
69
64 /* frame skip options */70 /* frame skip options */
65 int frame_skip_threshold;71 int frame_skip_threshold;
66 int frame_skip_factor;72 int frame_skip_factor;
@@ -73,6 +79,7 @@ typedef struct MPVMainEncContext { · 6 unmodified lines
73 int frame_bits; ///< bits used for the current frame79 int frame_bits; ///< bits used for the current frame
74 int stuffing_bits; ///< bits used for stuffing80 int stuffing_bits; ///< bits used for stuffing
75 int next_lambda; ///< next lambda used for retrying to encode a frame81 int next_lambda; ///< next lambda used for retrying to encode a frame
82 int fixed_qscale; ///< fixed qscale if non zero
76 RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c83 RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c
77} MPVMainEncContext;84} MPVMainEncContext;
78 85
@@ -154,14 +161,14 @@ FF_MPV_OPT_CMP_FUNC, \ · 75 unmodified lines
154 FF_RC_OFFSET(rc_eq), AV_OPT_TYPE_STRING, .flags = FF_MPV_OPT_FLAGS }, \161 FF_RC_OFFSET(rc_eq), AV_OPT_TYPE_STRING, .flags = FF_MPV_OPT_FLAGS }, \
155{"rc_init_cplx", "initial complexity for 1-pass encoding", FF_RC_OFFSET(initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \162{"rc_init_cplx", "initial complexity for 1-pass encoding", FF_RC_OFFSET(initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \
156{"rc_buf_aggressivity", "currently useless", FF_RC_OFFSET(buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \163{"rc_buf_aggressivity", "currently useless", FF_RC_OFFSET(buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \
157{"border_mask", "increase the quantizer for macroblocks close to borders", FF_MPV_OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \164{"border_mask", "increase the quantizer for macroblocks close to borders", FF_MPV_MAIN_OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \
158{"lmin", "minimum Lagrange factor (VBR)", FF_MPV_OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 = 2*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, \165{"lmin", "minimum Lagrange factor (VBR)", FF_MPV_MAIN_OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 = 2*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, \
159{"lmax", "maximum Lagrange factor (VBR)", FF_MPV_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, \166{"lmax", "maximum Lagrange factor (VBR)", FF_MPV_MAIN_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, \
160{"skip_threshold", "Frame skip threshold", FF_MPV_MAIN_OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \167{"skip_threshold", "Frame skip threshold", FF_MPV_MAIN_OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
161{"skip_factor", "Frame skip factor", FF_MPV_MAIN_OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \168{"skip_factor", "Frame skip factor", FF_MPV_MAIN_OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
162{"skip_exp", "Frame skip exponent", FF_MPV_MAIN_OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \169{"skip_exp", "Frame skip exponent", FF_MPV_MAIN_OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
163{"skip_cmp", "Frame skip compare function", FF_MPV_MAIN_OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \170{"skip_cmp", "Frame skip compare function", FF_MPV_MAIN_OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
164{"sc_threshold", "Scene change threshold", FF_MPV_OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \171{"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 }, \
165{"noise_reduction", "Noise reduction", FF_MPV_OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \172{"noise_reduction", "Noise reduction", FF_MPV_OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
166{"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 }, \173{"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 }, \
167 174
libavcodec/ratecontrol.c+10−8
@@ -142,10 +142,11 @@ static double get_diff_limited_q(MPVMainEncContext *m, const RateControlEntry *r · 141 unmodified lines
142/**142/**
143 * Get the qmin & qmax for pict_type.143 * Get the qmin & qmax for pict_type.
144 */144 */
145static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type)145static void get_qminmax(int *qmin_ret, int *qmax_ret, MPVMainEncContext *const m, int pict_type)
146{146{
147 int qmin = s->lmin;147 MpegEncContext *const s = &m->s;
148 int qmax = s->lmax;148 int qmin = m->lmin;
149 int qmax = m->lmax;
149 150
150 av_assert0(qmin <= qmax);151 av_assert0(qmin <= qmax);
151 152
@@ -182,7 +183,7 @@ static double modify_qscale(MPVMainEncContext *const m, const RateControlEntry * · 30 unmodified lines
182 const int pict_type = rce->new_pict_type;183 const int pict_type = rce->new_pict_type;
183 int qmin, qmax;184 int qmin, qmax;
184 185
185 get_qminmax(&qmin, &qmax, s, pict_type);186 get_qminmax(&qmin, &qmax, m, pict_type);
186 187
187 /* modulation */188 /* modulation */
188 if (rcc->qmod_freq &&189 if (rcc->qmod_freq &&
@@ -784,15 +785,16 @@ static void update_predictor(Predictor *p, double q, double var, double size) · 595 unmodified lines
784}785}
785 786
786static void adaptive_quantization(RateControlContext *const rcc,787static void adaptive_quantization(RateControlContext *const rcc,
787 MpegEncContext *const s, double q)788 MPVMainEncContext *const m, double q)
788{789{
790 MpegEncContext *const s = &m->s;
789 int i;791 int i;
790 const float lumi_masking = s->avctx->lumi_masking / (128.0 * 128.0);792 const float lumi_masking = s->avctx->lumi_masking / (128.0 * 128.0);
791 const float dark_masking = s->avctx->dark_masking / (128.0 * 128.0);793 const float dark_masking = s->avctx->dark_masking / (128.0 * 128.0);
792 const float temp_cplx_masking = s->avctx->temporal_cplx_masking;794 const float temp_cplx_masking = s->avctx->temporal_cplx_masking;
793 const float spatial_cplx_masking = s->avctx->spatial_cplx_masking;795 const float spatial_cplx_masking = s->avctx->spatial_cplx_masking;
794 const float p_masking = s->avctx->p_masking;796 const float p_masking = s->avctx->p_masking;
795 const float border_masking = s->border_masking;797 const float border_masking = m->border_masking;
796 float bits_sum = 0.0;798 float bits_sum = 0.0;
797 float cplx_sum = 0.0;799 float cplx_sum = 0.0;
798 float *cplx_tab = rcc->cplx_tab;800 float *cplx_tab = rcc->cplx_tab;
@@ -932,7 +934,7 @@ float ff_rate_estimate_qscale(MPVMainEncContext *const m, int dry_run) · 133 unmodified lines
932 const int pict_type = s->pict_type;934 const int pict_type = s->pict_type;
933 emms_c();935 emms_c();
934 936
935 get_qminmax(&qmin, &qmax, s, pict_type);937 get_qminmax(&qmin, &qmax, m, pict_type);
936 938
937 fps = get_fps(s->avctx);939 fps = get_fps(s->avctx);
938 /* update predictors */940 /* update predictors */
@@ -1068,7 +1070,7 @@ float ff_rate_estimate_qscale(MPVMainEncContext *const m, int dry_run) · 129 unmodified lines
1068 q = qmax;1070 q = qmax;
1069 1071
1070 if (s->adaptive_quant)1072 if (s->adaptive_quant)
1071 adaptive_quantization(rcc, s, q);1073 adaptive_quantization(rcc, m, q);
1072 else1074 else
1073 q = (int)(q + 0.5);1075 q = (int)(q + 0.5);
1074 1076
libavcodec/snowenc.c+2−2
@@ -228,8 +228,8 @@ static av_cold int encode_init(AVCodecContext *avctx) · 227 unmodified lines
228 228
229 mpv->avctx = avctx;229 mpv->avctx = avctx;
230 mpv->bit_rate= avctx->bit_rate;230 mpv->bit_rate= avctx->bit_rate;
231 mpv->lmin = avctx->mb_lmin;231 enc->m.lmin = avctx->mb_lmin;
232 mpv->lmax = avctx->mb_lmax;232 enc->m.lmax = avctx->mb_lmax;
233 mpv->mb_num = (avctx->width * avctx->height + 255) / 256; // For ratecontrol233 mpv->mb_num = (avctx->width * avctx->height + 255) / 256; // For ratecontrol
234 234
235 mpv->me.temp =235 mpv->me.temp =

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t