mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 19:37:30 +01:00
Support more qscale types in most post-processing filters.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30454 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d1e9785b70
commit
1cf12c2492
@ -129,4 +129,19 @@ int vf_config_wrapper(struct vf_instance_s* vf,
|
||||
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 */
|
||||
|
@ -454,7 +454,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src,
|
||||
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
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
|
||||
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
|
||||
|
@ -406,7 +406,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
|
||||
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];
|
||||
|
@ -168,7 +168,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds
|
||||
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++){
|
||||
|
Loading…
Reference in New Issue
Block a user