[xiph-commits] r7686 - experimental/derf/theora-exp/lib

tterribe at motherfish-iii.xiph.org tterribe at motherfish-iii.xiph.org
Thu Sep 2 10:26:40 PDT 2004


Author: tterribe
Date: 2004-09-02 10:26:40 -0700 (Thu, 02 Sep 2004)
New Revision: 7686

Modified:
   experimental/derf/theora-exp/lib/encode.c
   experimental/derf/theora-exp/lib/state.c
Log:
Fix two more encoder bugs.
- The encoder could record the wrong quantized value internally after writing
 the correct value when quantizing to a 2 or 3 after a short zero run.
- The per-block qi values were not being updated on coded chroma blocks in a
 macro block with no coded luma blocks.

Also a minor documentation revision.


Modified: experimental/derf/theora-exp/lib/encode.c
===================================================================
--- experimental/derf/theora-exp/lib/encode.c	2004-09-02 15:13:12 UTC (rev 7685)
+++ experimental/derf/theora-exp/lib/encode.c	2004-09-02 17:26:40 UTC (rev 7686)
@@ -1237,19 +1237,19 @@
             if(zrun==1){
               _enc->dct_tokens[tli][_enc->ndct_tokens[tli]++]=
                OC_DCT_RUN_CAT2A;
-              qc=OC_MINI(1,qc_max-2);
+              qc=OC_MINI(3,qc_max);
               _enc->extra_bits[tli][_enc->nextra_bits[tli]++]=
-               (ogg_uint16_t)((c_sign<<1)+qc);
+               (ogg_uint16_t)((c_sign<<1)+qc-2);
             }
             else{
               _enc->dct_tokens[tli][_enc->ndct_tokens[tli]++]=
                OC_DCT_RUN_CAT2B;
-              qc=OC_MINI(1,qc_max-2);
+              qc=OC_MINI(3,qc_max);
               _enc->extra_bits[tli][_enc->nextra_bits[tli]++]=
-               (ogg_uint16_t)((c_sign<<2)+(qc<<1)+zrun-2);
+               (ogg_uint16_t)((c_sign<<2)+(qc-2<<1)+zrun-2);
             }
-            qc_signed[0]=qc_min;
-            qc_signed[1]=-qc_min;
+            qc_signed[0]=qc;
+            qc_signed[1]=-qc;
             _efrag->dct_coeffs[ci]=(ogg_int16_t)qc_signed[c_sign];
             zrun=0;
             /*Skip coding the DCT value below.*/
@@ -2023,6 +2023,13 @@
           qi=_enc->qis[OC_INTER_FRAME][frag_qii[codedi][OC_INTER_FRAME][1]];
           bits[OC_MODE_INTER_NOMV]+=OC_RES_BITRATES[qi][pli][
            OC_MODE_INTER_NOMV][OC_MINI(err[OC_MODE_INTER_NOMV][mapi]>>6,15)];
+          /*Also mark this fragment with the selected INTER qi.
+            It will be reset if we eventually code this as an INTRA frame.*/
+#if defined(OC_BITRATE_STATS)
+          efrag->eerror=err[OC_MODE_INTER_NOMV][mapi];
+#endif
+          efrag->qii=frag_qii[codedi][OC_INTER_FRAME][1];
+          frag->qi=qi;
         }
         intra_bits+=mbintrabits+128>>8;
         inter_bits+=bits[OC_MODE_INTER_NOMV]+128>>8;

Modified: experimental/derf/theora-exp/lib/state.c
===================================================================
--- experimental/derf/theora-exp/lib/state.c	2004-09-02 15:13:12 UTC (rev 7685)
+++ experimental/derf/theora-exp/lib/state.c	2004-09-02 17:26:40 UTC (rev 7686)
@@ -754,8 +754,8 @@
      be is 46, and so that doesn't affect any of the cases in this routine.
     However, if the last token WAS a pure zero run of length 63, then _last_zzi
      will be 1 while the number of coefficients decoded is 64.
-    Thus, we will trigger the following special case, where a pure coefficient
-     count would not.
+    Thus, we will trigger the following special case, where the real
+     coefficient count would not.
     Note also that a zero run of length 64 will give _last_zzi a value of 0,
      but we still process the DC coefficient, which might have a non-zero value
      due to DC prediction.



More information about the commits mailing list