summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-10-27 21:12:29 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-10-27 21:12:29 +0000
commiteb14533f92b0af945e830e098aefa1fd6a5ab3ba (patch)
treed3d4f04089040dc7809e3bb8c288421cd6789a87 /libmpcodecs
parent0259d347c81461edeb5d028ba4628404d36a47b9 (diff)
downloadmpv-eb14533f92b0af945e830e098aefa1fd6a5ab3ba.tar.bz2
mpv-eb14533f92b0af945e830e098aefa1fd6a5ab3ba.tar.xz
different / faster / simpler "quantization"
filtered images look like with the old quantization (to me at least) if anyone notices a difference then tell me ASAP git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11297 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vf_spp.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index c62cb2bb20..40a9f9e23c 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -86,28 +86,20 @@ struct vf_priv_s {
static inline void requantize(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
int i;
const int qmul= qp<<1;
- const int qadd= (qp-1)|1;
- const int qinv= ((1<<(SHIFT-3)) + qmul/2)/ qmul;
int bias= 0; //FIXME
unsigned int threshold1, threshold2;
-
- threshold1= (1<<SHIFT) - bias - 1;
+
+ threshold1= qmul*((1<<3) - bias) - 1;
threshold2= (threshold1<<1);
memset(dst, 0, 64*sizeof(DCTELEM));
- dst[0]= (src[0] + 4)>>3;;
+ dst[0]= (src[0] + 4)>>3;
- for(i=1; i<64; i++){
- int level= qinv*src[i];
+ for(i=1; i<64; i++){
+ int level= src[i];
if(((unsigned)(level+threshold1))>threshold2){
const int j= permutation[i];
- if(level>0){
- level= (bias + level)>>SHIFT;
- dst[j]= level*qmul + qadd;
- }else{
- level= (bias - level)>>SHIFT;
- dst[j]= -level*qmul - qadd;
- }
+ dst[j]= (level + 4)>>3;
}
}
}