We discussed this once without ever reaching a consensus. I'm going to bring
it up again.

    if(vec[k] == 64.0f){//FIXME: slow
This line is verifies an escape
        if(t >= 165140.0f*IQ){ // clipped value
This line is a shortcut to determine if we have a clipped value
        di = t - 165140.0f;
This line attempts to inverse quantize the coefficient and subtract it from
the actual coefficient. Using the equation t - value^(4/3) where value =8191
        curbits += 21;
    }else{
        int c = av_clip(quant(t, Q), 0, 8191);
This line quantizes the coefficient
        di = t - c*cbrt(c)*IQ;
This line inverse quantizes the coefficient and subtracts it from the actual
coefficient. Using the equation t - value^(4/3) * IQ
        curbits += av_log2(c)*2 - 4 + 1;
    }

The two di lines do not use the same equation.
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 31e0005..e5a49c5 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -148,7 +148,7 @@ static float quantize_band_cost(const float *in, int size, int scale_idx, int cb
                     }
                     if(vec[k] == 64.0f){//FIXME: slow
                         if(t >= 165140.0f*IQ){ // clipped value
-                            di = t - 165140.0f;
+                            di = t - 165140.0f*IQ;
                             curbits += 21;
                         }else{
                             int c = av_clip(quant(t, Q), 0, 8191);
@@ -251,7 +251,7 @@ static void quantize_and_encode_band(PutBitContext *pb, const float *in, int siz
                     }
                     if(vec[k] == 64.0f){//FIXME: slow
                         if(t >= 165140.0f*IQ){ // clipped value
-                            di = t - 165140.0f;
+                            di = t - 165140.0f*IQ;
                             curbits += 21;
                         }else{
                             int c = av_clip(quant(t, Q), 0, 8191);
@@ -338,7 +338,7 @@ static float quantize_band_cost(const float *in, int size, int scale_idx, int cb
                     }
                     if(vec[k] == 64.0f){//FIXME: slow
                         if(t >= 165140.0f*Q){ // clipped value
-                            di = t - 165140.0f;
+                            di = t - 165140.0f*Q;
                             curbits += 21;
                         }else{
                             int c = av_clip(quant(t, IQ), 0, 8191);
@@ -411,7 +411,7 @@ static void quantize_and_encode_band(PutBitContext *pb, const float *in, int siz
                     }
                     if(vec[k] == 64.0f){//FIXME: slow
                         if(t >= 165140.0f*Q){ // clipped value
-                            di = t - 165140.0f;
+                            di = t - 165140.0f*Q;
                             curbits += 21;
                         }else{
                             int c = av_clip(quant(t, IQ), 0, 8191);
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to