[MPlayer-cvslog] r30454 - in trunk/libmpcodecs: vf.h vf_fspp.c vf_pp7.c vf_spp.c vf_uspp.c
reimar
subversion at mplayerhq.hu
Fri Jan 29 20:13:07 CET 2010
Author: reimar
Date: Fri Jan 29 20:13:07 2010
New Revision: 30454
Log:
Support more qscale types in most post-processing filters.
Modified:
trunk/libmpcodecs/vf.h
trunk/libmpcodecs/vf_fspp.c
trunk/libmpcodecs/vf_pp7.c
trunk/libmpcodecs/vf_spp.c
trunk/libmpcodecs/vf_uspp.c
Modified: trunk/libmpcodecs/vf.h
==============================================================================
--- trunk/libmpcodecs/vf.h Fri Jan 29 14:54:20 2010 (r30453)
+++ trunk/libmpcodecs/vf.h Fri Jan 29 20:13:07 2010 (r30454)
@@ -129,4 +129,19 @@ int vf_config_wrapper(struct vf_instance
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
+static inline int norm_qscale(int qscale, int type)
+{
+ switch (type) {
+ case 0: // MPEG-1
+ return qscale;
+ case 1: // MPEG-2
+ return qscale >> 1;
+ case 2: // H264
+ return qscale >> 2;
+ case 3: // VP56
+ return (63 - qscale + 2) >> 2;
+ }
+ return qscale;
+}
+
#endif /* MPLAYER_VF_H */
Modified: trunk/libmpcodecs/vf_fspp.c
==============================================================================
--- trunk/libmpcodecs/vf_fspp.c Fri Jan 29 14:54:20 2010 (r30453)
+++ trunk/libmpcodecs/vf_fspp.c Fri Jan 29 20:13:07 2010 (r30454)
@@ -454,7 +454,7 @@ static void filter(struct vf_priv_s *p,
t=x+x0-2; //correct t=x+x0-2-(y&1), but its the same
if (t<0) t=0;//t always < width-2
t=qp_store[qy+(t>>qps)];
- if(p->mpeg2) t>>=1; //copy p->mpeg2,prev_q to locals?
+ t=norm_qscale(t, p->mpeg2);
if (t!=p->prev_q) p->prev_q=t, mul_thrmat_s(p, t);
column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+x*8, block3+x*8, 8); //yes, this is a HOTSPOT
}
Modified: trunk/libmpcodecs/vf_pp7.c
==============================================================================
--- trunk/libmpcodecs/vf_pp7.c Fri Jan 29 14:54:20 2010 (r30453)
+++ trunk/libmpcodecs/vf_pp7.c Fri Jan 29 20:13:07 2010 (r30454)
@@ -321,7 +321,7 @@ static void filter(struct vf_priv_s *p,
qp= p->qp;
else{
qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride];
- if(p->mpeg2) qp>>=1;
+ qp=norm_qscale(qp, p->mpeg2);
}
for(; x<end; x++){
const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset
Modified: trunk/libmpcodecs/vf_spp.c
==============================================================================
--- trunk/libmpcodecs/vf_spp.c Fri Jan 29 14:54:20 2010 (r30453)
+++ trunk/libmpcodecs/vf_spp.c Fri Jan 29 20:13:07 2010 (r30454)
@@ -406,7 +406,7 @@ static void filter(struct vf_priv_s *p,
qp= p->qp;
else{
qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride];
- if(p->mpeg2) qp = FFMAX(1, qp>>1);
+ qp = FFMAX(1, norm_qscale(qp, p->mpeg2));
}
for(i=0; i<count; i++){
const int x1= x + offset[i+count-1][0];
Modified: trunk/libmpcodecs/vf_uspp.c
==============================================================================
--- trunk/libmpcodecs/vf_uspp.c Fri Jan 29 14:54:20 2010 (r30453)
+++ trunk/libmpcodecs/vf_uspp.c Fri Jan 29 20:13:07 2010 (r30454)
@@ -168,7 +168,7 @@ static void filter(struct vf_priv_s *p,
if(p->qp)
p->frame->quality= p->qp * FF_QP2LAMBDA;
else
- p->frame->quality= (qp_store[0] * FF_QP2LAMBDA)>>p->mpeg2;
+ p->frame->quality= norm_qscale(qp_store[0], p->mpeg2) * FF_QP2LAMBDA;
// init per MB qscale stuff FIXME
for(i=0; i<count; i++){
More information about the MPlayer-cvslog
mailing list