aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorKieran Kunhya <kierank@obe.tv>2017-07-24 19:25:41 +0100
committerKieran Kunhya <kierank@obe.tv>2017-11-04 18:18:25 +0000
commit626d200e76e15487cff20992256a55919432b0b3 (patch)
tree0e1f52744f53223b062f6194e0cd1cbb437be44f /libavcodec
parent77748d12a01de6f290a9d3663a0b777d752ac5b7 (diff)
downloadffmpeg-626d200e76e15487cff20992256a55919432b0b3.tar.gz
vc2enc: Calculate average slice quantiser correctly
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vc2enc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index 96e27d93ed..f7fb17b076 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -167,7 +167,7 @@ typedef struct VC2EncContext {
int slice_max_bytes;
int slice_min_bytes;
int q_ceil;
- int q_avg;
+ int64_t q_avg;
/* Options */
double tolerance;
@@ -755,7 +755,7 @@ static int calc_slice_sizes(VC2EncContext *s)
for (i = 0; i < s->num_x*s->num_y; i++) {
SliceArgs *args = &enc_args[i];
total_bytes_needed += args->bytes;
- s->q_avg = (s->q_avg + args->quant_idx)/2;
+ s->q_avg += args->quant_idx;
}
return total_bytes_needed;
@@ -1045,7 +1045,7 @@ static av_cold int vc2_encode_end(AVCodecContext *avctx)
int i;
VC2EncContext *s = avctx->priv_data;
- av_log(avctx, AV_LOG_INFO, "Qavg: %i\n", s->q_avg);
+ av_log(avctx, AV_LOG_INFO, "Qavg: %f\n", (float)s->q_avg / (s->num_x*s->num_y));
for (i = 0; i < 3; i++) {
ff_vc2enc_free_transforms(&s->transform_args[i].t);