summaryrefslogtreecommitdiff
path: root/libavfilter/vf_uspp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-12 01:47:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-12 02:00:31 +0100
commite1540cdf0703970279dc989fa0bf65c04a94564e (patch)
tree48349a7b6ee312c1b61ca99b5d37f8c622501384 /libavfilter/vf_uspp.c
parent5172782352118c72060187296d411e38e3df9d34 (diff)
downloadffmpeg-e1540cdf0703970279dc989fa0bf65c04a94564e.tar.gz
avfilter/vf_uspp: use the average QP instead of QP[0]
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_uspp.c')
-rw-r--r--libavfilter/vf_uspp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
index 8352a12d16..218ee7727b 100644
--- a/libavfilter/vf_uspp.c
+++ b/libavfilter/vf_uspp.c
@@ -227,8 +227,16 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
if (p->qp)
p->frame->quality = p->qp * FF_QP2LAMBDA;
- else
- p->frame->quality = norm_qscale(qp_store[0], p->qscale_type) * FF_QP2LAMBDA;
+ else {
+ int qpsum=0;
+ int qpcount = (height>>4) * (height>>4);
+
+ for (y = 0; y < (height>>4); y++) {
+ for (x = 0; x < (width>>4); x++)
+ qpsum += qp_store[x + y * qp_stride];
+ }
+ p->frame->quality = norm_qscale((qpsum + qpcount/2) / qpcount, p->qscale_type) * FF_QP2LAMBDA;
+ }
// init per MB qscale stuff FIXME
p->frame->height = height;
p->frame->width = width;