[xiph-commits] r16320 - in branches/theora-gumboot: . examples include/theora lib/dec lib/enc

gumboot at svn.xiph.org gumboot at svn.xiph.org
Wed Jul 22 17:51:05 PDT 2009


Author: gumboot
Date: 2009-07-22 17:51:02 -0700 (Wed, 22 Jul 2009)
New Revision: 16320

Modified:
   branches/theora-gumboot/
   branches/theora-gumboot/configure.ac
   branches/theora-gumboot/examples/Makefile.am
   branches/theora-gumboot/examples/player_example.c
   branches/theora-gumboot/include/theora/theoradec.h
   branches/theora-gumboot/lib/dec/decode.c
   branches/theora-gumboot/lib/enc/analyze.c
   branches/theora-gumboot/lib/enc/encapiwrapper.c
   branches/theora-gumboot/lib/enc/encfrag.c
   branches/theora-gumboot/lib/enc/encint.h
   branches/theora-gumboot/lib/enc/encode.c
   branches/theora-gumboot/lib/enc/enquant.c
   branches/theora-gumboot/lib/enc/huffenc.c
   branches/theora-gumboot/lib/enc/mcenc.c
   branches/theora-gumboot/lib/enc/modedec.h
   branches/theora-gumboot/lib/enc/rate.c
   branches/theora-gumboot/lib/enc/tokenize.c
Log:
Update theora-gumboot with latest theora-thusnelda changes again.



Property changes on: branches/theora-gumboot
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/theora-thusnelda:16256-16300
/trunk/theora:14138-15320,15741
   + /branches/theora-thusnelda:16256-16300,16302-16319
/trunk/theora:14138-15320,15741

Modified: branches/theora-gumboot/configure.ac
===================================================================
--- branches/theora-gumboot/configure.ac	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/configure.ac	2009-07-23 00:51:02 UTC (rev 16320)
@@ -341,7 +341,7 @@
 dnl check for libcairo
 HAVE_CAIRO=no
 AC_ARG_ENABLE(telemetry,
-    [  --disable-telemetry     disable debugging output controls ],
+    [  --enable-telemetry      enable debugging output controls ],
     [ ac_enable_telemetry=$enableval ], [ ac_enable_telemetry=no] )
 
 if test "x${ac_enable_telemetry}" = xyes; then

Modified: branches/theora-gumboot/examples/Makefile.am
===================================================================
--- branches/theora-gumboot/examples/Makefile.am	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/examples/Makefile.am	2009-07-23 00:51:02 UTC (rev 16320)
@@ -15,12 +15,10 @@
 dump_video_SOURCES = dump_video.c
 EXTRA_dump_video_SOURCES = getopt.c getopt1.c getopt.h
 dump_video_LDADD = $(GETOPT_OBJS) $(LDADDDEC)
-dump_video_DEPENDENCIES = $(GETOPT_OBJS)
 
 dump_psnr_SOURCES = dump_psnr.c
 EXTRA_dump_psnr_SOURCES = getopt.c getopt1.c getopt.h
 dump_psnr_LDADD = $(GETOPT_OBJS) $(LDADDDEC) -lm
-dump_psnr_DEPENDENCIES = $(GETOPT_OBJS)
 
 player_example_SOURCES = player_example.c
 player_example_CFLAGS = $(SDL_CFLAGS) $(OGG_CFLAGS) $(VORBIS_CFLAGS)
@@ -30,12 +28,10 @@
 EXTRA_encoder_example_SOURCES = getopt.c getopt1.c getopt.h
 encoder_example_CFLAGS = $(OGG_CFLAGS) $(VORBIS_CFLAGS)
 encoder_example_LDADD = $(GETOPT_OBJS) $(LDADDENC) $(VORBIS_LIBS) $(VORBISENC_LIBS)
-encoder_example_DEPENDENCIES = $(GETOPT_OBJS)
 
 png2theora_SOURCES = png2theora.c
 png2theora_CFLAGS = $(OGG_CFLAGS) $(PNG_CFLAGS)
 png2theora_LDADD = $(GETOPT_OBJS) $(LDADD) $(PNG_LIBS)
-png2theora_DEPENDENCIES = $(GETOPT_OBJS)
 
 debug:
 	$(MAKE) all CFLAGS="@DEBUG@"

Modified: branches/theora-gumboot/examples/player_example.c
===================================================================
--- branches/theora-gumboot/examples/player_example.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/examples/player_example.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -627,6 +627,9 @@
       int arg = 0xffff;
       theora_control(&td,TH_DECCTL_SET_TELEMETRY_MBMODE,&arg,sizeof(arg));
       theora_control(&td,TH_DECCTL_SET_TELEMETRY_MV,&arg,sizeof(arg));
+      theora_control(&td,TH_DECCTL_SET_TELEMETRY_QI,&arg,sizeof(arg));
+      arg=10;
+      theora_control(&td,TH_DECCTL_SET_TELEMETRY_BITS,&arg,sizeof(arg));
     }*/
   }else{
     /* tear down the partial theora setup */

Modified: branches/theora-gumboot/include/theora/theoradec.h
===================================================================
--- branches/theora-gumboot/include/theora/theoradec.h	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/include/theora/theoradec.h	2009-07-23 00:51:02 UTC (rev 16320)
@@ -294,6 +294,7 @@
  *               It may be freed or overwritten without notification when
  *                subsequent frames are decoded.
  * \retval 0 Success
+ * \retval TH_EFAULT     \a _dec or \a _ycbcr was <tt>NULL</tt>.
  */
 extern int th_decode_ycbcr_out(th_dec_ctx *_dec,
  th_ycbcr_buffer _ycbcr);

Modified: branches/theora-gumboot/lib/dec/decode.c
===================================================================
--- branches/theora-gumboot/lib/dec/decode.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/dec/decode.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -1076,9 +1076,8 @@
   _dec->eob_runs[0][0]=0;
   eobs=oc_dec_dc_coeff_unpack(_dec,huff_idxs,ntoks_left);
 #if defined(HAVE_CAIRO)
-  _dec->telemetry_dc_bytes = oc_pack_bytes_left(&_dec->opb);
+  _dec->telemetry_dc_bytes=oc_pack_bytes_left(&_dec->opb);
 #endif
-
   val=oc_pack_read(&_dec->opb,4);
   huff_idxs[0]=(int)val;
   val=oc_pack_read(&_dec->opb,4);
@@ -1936,11 +1935,9 @@
     int                   notdone;
     oc_pack_readinit(&_dec->opb,_op->packet,_op->bytes);
 #if defined(HAVE_CAIRO)
-    _dec->telemetry_frame_bytes = _op->bytes;
+    _dec->telemetry_frame_bytes=_op->bytes;
 #endif
-
     ret=oc_dec_frame_header_unpack(_dec);
-
     if(ret<0)return ret;
     /*Select a free buffer to use for the reconstructed version of this
        frame.*/
@@ -1978,27 +1975,28 @@
       oc_dec_mark_all_intra(_dec);
       _dec->state.keyframe_num=_dec->state.curframe_num;
 #if defined(HAVE_CAIRO)
-      _dec->telemetry_coding_bytes =
-        _dec->telemetry_mode_bytes =
-        _dec->telemetry_mv_bytes = oc_pack_bytes_left(&_dec->opb);
+      _dec->telemetry_coding_bytes=
+       _dec->telemetry_mode_bytes=
+       _dec->telemetry_mv_bytes=oc_pack_bytes_left(&_dec->opb);
 #endif
-    }else{
+    }
+    else{
       oc_dec_coded_flags_unpack(_dec);
 #if defined(HAVE_CAIRO)
-      _dec->telemetry_coding_bytes = oc_pack_bytes_left(&_dec->opb);
+      _dec->telemetry_coding_bytes=oc_pack_bytes_left(&_dec->opb);
 #endif
       oc_dec_mb_modes_unpack(_dec);
 #if defined(HAVE_CAIRO)
-      _dec->telemetry_mode_bytes = oc_pack_bytes_left(&_dec->opb);
+      _dec->telemetry_mode_bytes=oc_pack_bytes_left(&_dec->opb);
 #endif
       oc_dec_mv_unpack_and_frag_modes_fill(_dec);
 #if defined(HAVE_CAIRO)
-      _dec->telemetry_mv_bytes = oc_pack_bytes_left(&_dec->opb);
+      _dec->telemetry_mv_bytes=oc_pack_bytes_left(&_dec->opb);
 #endif
     }
     oc_dec_block_qis_unpack(_dec);
 #if defined(HAVE_CAIRO)
-    _dec->telemetry_qi_bytes = oc_pack_bytes_left(&_dec->opb);
+    _dec->telemetry_qi_bytes=oc_pack_bytes_left(&_dec->opb);
 #endif
     oc_dec_residual_tokens_unpack(_dec);
     /*Update granule position.
@@ -2208,7 +2206,6 @@
       v_row+=_ycbcr[2].stride&-((y&1)|!vdec);
       rgb_row+=cstride;
     }
-
     /*Draw coded identifier for each macroblock (stored in Hilbert order).*/
     {
       cairo_t           *c;
@@ -2221,47 +2218,46 @@
       int                row2;
       int                col2;
       int                qim[3]={0,0,0};
-
       if(_dec->state.nqis==2){
-        int bqi = _dec->state.qis[0];
-        if(_dec->state.qis[1]>bqi)
-          qim[1]=1;
-        if(_dec->state.qis[1]<bqi)
-          qim[1]=-1;
+        int bqi;
+        bqi=_dec->state.qis[0];
+        if(_dec->state.qis[1]>bqi)qim[1]=1;
+        if(_dec->state.qis[1]<bqi)qim[1]=-1;
       }
       if(_dec->state.nqis==3){
-        int bqi = _dec->state.qis[0];
-        int cqi = _dec->state.qis[1];
-        int dqi = _dec->state.qis[2];
-        if(cqi>bqi && dqi>bqi){
+        int bqi;
+        int cqi;
+        int dqi;
+        bqi=_dec->state.qis[0];
+        cqi=_dec->state.qis[1];
+        dqi=_dec->state.qis[2];
+        if(cqi>bqi&&dqi>bqi){
           if(dqi>cqi){
             qim[1]=1;
             qim[2]=2;
-          }else{
+          }
+          else{
             qim[1]=2;
             qim[2]=1;
           }
-        }else if (cqi<bqi && dqi<bqi){
+        }
+        else if(cqi<bqi&&dqi<bqi){
           if(dqi<cqi){
             qim[1]=-1;
             qim[2]=-2;
-          }else{
+          }
+          else{
             qim[1]=-2;
             qim[2]=-1;
           }
-        }else{
-          if(cqi<bqi)
-            qim[1]=-1;
-          else
-            qim[1]=1;
-
-          if(dqi<bqi)
-            qim[2]=-1;
-          else
-            qim[2]=1;
         }
+        else{
+          if(cqi<bqi)qim[1]=-1;
+          else qim[1]=1;
+          if(dqi<bqi)qim[2]=-1;
+          else qim[2]=1;
+        }
       }
-
       c=cairo_create(cs);
       frags=_dec->state.frags;
       frag_mvs=_dec->state.frag_mvs;
@@ -2277,8 +2273,7 @@
         y=h-(row2+((col2+1>>1)&1))*16-16;
         x=(col2>>1)*16;
         cairo_set_line_width(c,1.);
-
-        /* keyframe (all intra) red box */
+        /*Keyframe (all intra) red box.*/
         if(_dec->state.frame_type==OC_INTRA_FRAME){
           if(_dec->telemetry_mbmode&0x02){
             cairo_set_source_rgba(c,1.,0,0,.5);
@@ -2490,99 +2485,133 @@
             }
           }
         }
-
-        /* qii illustration */
+        /*qii illustration.*/
         if(_dec->telemetry_qi&0x2){
+          cairo_set_line_cap(c,CAIRO_LINE_CAP_SQUARE);
           for(bi=0;bi<4;bi++){
-            int qiv,xp=x+(bi&1)*8,yp=y+8-(bi&2)*4;
-            int fragi=mb_maps[mbi][0][bi];
+            ptrdiff_t fragi;
+            int       qiv;
+            int       xp;
+            int       yp;
+            xp=x+(bi&1)*8;
+            yp=y+8-(bi&2)*4;
+            fragi=mb_maps[mbi][0][bi];
             if(fragi>=0&&frags[fragi].coded){
               qiv=qim[frags[fragi].qii];
-
+              cairo_set_line_width(c,3.);
+              cairo_set_source_rgba(c,0.,0.,0.,.5);
               switch(qiv){
-              case 2:
-              /* double plus */
-                if((bi&1)^((bi&2)>>1)){
-                  cairo_move_to(c,xp+2.5,yp+1.5);
-                  cairo_line_to(c,xp+2.5,yp+3.5);
-                  cairo_move_to(c,xp+1.5,yp+2.5);
-                  cairo_line_to(c,xp+3.5,yp+2.5);
-                  cairo_move_to(c,xp+5.5,yp+4.5);
-                  cairo_line_to(c,xp+5.5,yp+6.5);
-                  cairo_move_to(c,xp+4.5,yp+5.5);
-                  cairo_line_to(c,xp+6.5,yp+5.5);
-                }else{
-                  cairo_move_to(c,xp+5.5,yp+1.5);
-                  cairo_line_to(c,xp+5.5,yp+3.5);
+                /*Double plus:*/
+                case 2:{
+                  if((bi&1)^((bi&2)>>1)){
+                    cairo_move_to(c,xp+2.5,yp+1.5);
+                    cairo_line_to(c,xp+2.5,yp+3.5);
+                    cairo_move_to(c,xp+1.5,yp+2.5);
+                    cairo_line_to(c,xp+3.5,yp+2.5);
+                    cairo_move_to(c,xp+5.5,yp+4.5);
+                    cairo_line_to(c,xp+5.5,yp+6.5);
+                    cairo_move_to(c,xp+4.5,yp+5.5);
+                    cairo_line_to(c,xp+6.5,yp+5.5);
+                    cairo_stroke_preserve(c);
+                    cairo_set_source_rgba(c,0.,1.,1.,1.);
+                  }
+                  else{
+                    cairo_move_to(c,xp+5.5,yp+1.5);
+                    cairo_line_to(c,xp+5.5,yp+3.5);
+                    cairo_move_to(c,xp+4.5,yp+2.5);
+                    cairo_line_to(c,xp+6.5,yp+2.5);
+                    cairo_move_to(c,xp+2.5,yp+4.5);
+                    cairo_line_to(c,xp+2.5,yp+6.5);
+                    cairo_move_to(c,xp+1.5,yp+5.5);
+                    cairo_line_to(c,xp+3.5,yp+5.5);
+                    cairo_stroke_preserve(c);
+                    cairo_set_source_rgba(c,0.,1.,1.,1.);
+                  }
+                }break;
+                /*Double minus:*/
+                case -2:{
+                  cairo_move_to(c,xp+2.5,yp+2.5);
+                  cairo_line_to(c,xp+5.5,yp+2.5);
+                  cairo_move_to(c,xp+2.5,yp+5.5);
+                  cairo_line_to(c,xp+5.5,yp+5.5);
+                  cairo_stroke_preserve(c);
+                  cairo_set_source_rgba(c,1.,1.,1.,1.);
+                }break;
+                /*Plus:*/
+                case 1:{
+                  if(bi&2==0)yp-=2;
+                  if(bi&1==0)xp-=2;
                   cairo_move_to(c,xp+4.5,yp+2.5);
-                  cairo_line_to(c,xp+6.5,yp+2.5);
+                  cairo_line_to(c,xp+4.5,yp+6.5);
                   cairo_move_to(c,xp+2.5,yp+4.5);
-                  cairo_line_to(c,xp+2.5,yp+6.5);
-                  cairo_move_to(c,xp+1.5,yp+5.5);
-                  cairo_line_to(c,xp+3.5,yp+5.5);
+                  cairo_line_to(c,xp+6.5,yp+4.5);
+                  cairo_stroke_preserve(c);
+                  cairo_set_source_rgba(c,.1,1.,.3,1.);
+                  break;
                 }
-                break;
-
-              case -2:
-                /* double minus */
-                cairo_move_to(c,xp+2.5,yp+2.5);
-                cairo_line_to(c,xp+5.5,yp+2.5);
-                cairo_move_to(c,xp+2.5,yp+5.5);
-                cairo_line_to(c,xp+5.5,yp+5.5);
-                break;
-
-              case 1:
-                /* plus */
-                if(bi&2==0)yp-=2;
-                if(bi&1==0)xp-=2;
-                cairo_move_to(c,xp+4.5,yp+2.5);
-                cairo_line_to(c,xp+4.5,yp+6.5);
-              case -1:
-                cairo_move_to(c,xp+2.5,yp+4.5);
-                cairo_line_to(c,xp+6.5,yp+4.5);
-                break;
-              default:
-                continue;
+                /*Fall through.*/
+                /*Minus:*/
+                case -1:{
+                  cairo_move_to(c,xp+2.5,yp+4.5);
+                  cairo_line_to(c,xp+6.5,yp+4.5);
+                  cairo_stroke_preserve(c);
+                  cairo_set_source_rgba(c,1.,.3,.1,1.);
+                }break;
+                default:continue;
               }
-
-              cairo_stroke_preserve(c);
-              cairo_set_source_rgba(c,1.,1.,1.,1.);
               cairo_set_line_width(c,1.);
               cairo_stroke(c);
-              cairo_set_line_width(c,3.);
-              cairo_set_source_rgba(c,0.,0.,0.,.5);
             }
           }
         }
-
         col2++;
         if((col2>>1)>=_dec->state.nhmbs){
           col2=0;
           row2+=2;
         }
       }
-
-      /* bit usage indicator[s] */
+      /*Bit usage indicator[s]:*/
       if(_dec->telemetry_bits){
-        int fpsn = _dec->state.info.fps_numerator;
-        int fpsd = _dec->state.info.fps_denominator;
-        int mult = (_dec->telemetry_bits>=0xff?1:_dec->telemetry_bits);
-        int fullw = 250*h*fpsd*mult/fpsn;
         int widths[6];
+        int fpsn;
+        int fpsd;
+        int mult;
+        int fullw;
+        int padw;
         int i;
-        int padw=w-24;
-
+        fpsn=_dec->state.info.fps_numerator;
+        fpsd=_dec->state.info.fps_denominator;
+        mult=(_dec->telemetry_bits>=0xFF?1:_dec->telemetry_bits);
+        fullw=250*h*fpsd*mult/fpsn;
+        padw=w-24;
         /* header and coded block bits */
-        widths[0] = padw * (_dec->telemetry_frame_bytes-_dec->telemetry_coding_bytes) / fullw;
-        widths[1] = padw * (_dec->telemetry_coding_bytes-_dec->telemetry_mode_bytes) / fullw;
-        widths[2] = padw * (_dec->telemetry_mode_bytes-_dec->telemetry_mv_bytes) / fullw;
-        widths[3] = padw * (_dec->telemetry_mv_bytes-_dec->telemetry_qi_bytes) / fullw;
-        widths[4] = padw * (_dec->telemetry_qi_bytes-_dec->telemetry_dc_bytes) / fullw;
-        widths[5] = padw * (_dec->telemetry_dc_bytes) / fullw;
+        if(_dec->telemetry_frame_bytes<0 ||
+           _dec->telemetry_frame_bytes==OC_LOTS_OF_BITS)
+          _dec->telemetry_frame_bytes=0;
+        if(_dec->telemetry_coding_bytes<0 ||
+           _dec->telemetry_coding_bytes>_dec->telemetry_frame_bytes)
+          _dec->telemetry_coding_bytes=0;
+        if(_dec->telemetry_mode_bytes<0 ||
+           _dec->telemetry_mode_bytes>_dec->telemetry_frame_bytes)
+          _dec->telemetry_mode_bytes=0;
+        if(_dec->telemetry_mv_bytes<0 ||
+           _dec->telemetry_mv_bytes>_dec->telemetry_frame_bytes)
+          _dec->telemetry_mv_bytes=0;
+        if(_dec->telemetry_qi_bytes<0 ||
+           _dec->telemetry_qi_bytes>_dec->telemetry_frame_bytes)
+          _dec->telemetry_qi_bytes=0;
+        if(_dec->telemetry_dc_bytes<0 ||
+           _dec->telemetry_dc_bytes>_dec->telemetry_frame_bytes)
+          _dec->telemetry_dc_bytes=0;
 
-        for(i=0;i<6;i++) if(widths[i]>w) widths[i]=w;
-
-        cairo_set_source_rgba (c, .0,.0,.0,.6);
+        widths[0]=padw*(_dec->telemetry_frame_bytes-_dec->telemetry_coding_bytes)/fullw;
+        widths[1]=padw*(_dec->telemetry_coding_bytes-_dec->telemetry_mode_bytes)/fullw;
+        widths[2]=padw*(_dec->telemetry_mode_bytes-_dec->telemetry_mv_bytes)/fullw;
+        widths[3]=padw*(_dec->telemetry_mv_bytes-_dec->telemetry_qi_bytes)/fullw;
+        widths[4]=padw*(_dec->telemetry_qi_bytes-_dec->telemetry_dc_bytes)/fullw;
+        widths[5]=padw*(_dec->telemetry_dc_bytes)/fullw;
+        for(i=0;i<6;i++)if(widths[i]>w)widths[i]=w;
+        cairo_set_source_rgba(c,.0,.0,.0,.6);
         cairo_rectangle(c,10,h-33,widths[0]+1,5);
         cairo_rectangle(c,10,h-29,widths[1]+1,5);
         cairo_rectangle(c,10,h-25,widths[2]+1,5);
@@ -2590,73 +2619,60 @@
         cairo_rectangle(c,10,h-17,widths[4]+1,5);
         cairo_rectangle(c,10,h-13,widths[5]+1,5);
         cairo_fill(c);
-
-        cairo_set_source_rgb (c, 1,0,0);
+        cairo_set_source_rgb(c,1,0,0);
         cairo_rectangle(c,10.5,h-32.5,widths[0],4);
         cairo_fill(c);
-
-        cairo_set_source_rgb (c, 0,1,0);
+        cairo_set_source_rgb(c,0,1,0);
         cairo_rectangle(c,10.5,h-28.5,widths[1],4);
         cairo_fill(c);
-
-        cairo_set_source_rgb (c, 0,0,1);
+        cairo_set_source_rgb(c,0,0,1);
         cairo_rectangle(c,10.5,h-24.5,widths[2],4);
         cairo_fill(c);
-
-        cairo_set_source_rgb (c, .6,.4,.0);
+        cairo_set_source_rgb(c,.6,.4,.0);
         cairo_rectangle(c,10.5,h-20.5,widths[3],4);
         cairo_fill(c);
-
-        cairo_set_source_rgb (c, .3,.3,.3);
+        cairo_set_source_rgb(c,.3,.3,.3);
         cairo_rectangle(c,10.5,h-16.5,widths[4],4);
         cairo_fill(c);
-
-        cairo_set_source_rgb (c, .5,.5,.8);
+        cairo_set_source_rgb(c,.5,.5,.8);
         cairo_rectangle(c,10.5,h-12.5,widths[5],4);
         cairo_fill(c);
-
       }
-
-      /* master qi indicator[s] */
+      /*Master qi indicator[s]:*/
       if(_dec->telemetry_qi&0x1){
         cairo_text_extents_t extents;
-        char buffer[10];
-        int p=0;
-        int y = h-7.5;
-
-        if(_dec->state.qis[0]>10)
-          buffer[p++]=48+_dec->state.qis[0]/10;
+        char                 buffer[10];
+        int                  p;
+        int                  y;
+        p=0;
+        y=h-7.5;
+        if(_dec->state.qis[0]>=10)buffer[p++]=48+_dec->state.qis[0]/10;
         buffer[p++]=48+_dec->state.qis[0]%10;
         if(_dec->state.nqis>=2){
           buffer[p++]=' ';
-          if(_dec->state.qis[1]>10)
-            buffer[p++]=48+_dec->state.qis[1]/10;
+          if(_dec->state.qis[1]>=10)buffer[p++]=48+_dec->state.qis[1]/10;
           buffer[p++]=48+_dec->state.qis[1]%10;
         }
         if(_dec->state.nqis==3){
           buffer[p++]=' ';
-          if(_dec->state.qis[2]>10)
-            buffer[p++]=48+_dec->state.qis[2]/10;
+          if(_dec->state.qis[2]>=10)buffer[p++]=48+_dec->state.qis[2]/10;
           buffer[p++]=48+_dec->state.qis[2]%10;
         }
         buffer[p++]='\0';
-
-        cairo_select_font_face (c, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-        cairo_set_font_size(c, 18);
-        cairo_text_extents(c, buffer, &extents);
-
-        cairo_set_source_rgb (c, 1,1,1);
-        cairo_move_to(c, w-extents.x_advance-10, y);
-        cairo_show_text(c, buffer);
-
-        cairo_set_source_rgb (c, 0,0,0);
-        cairo_move_to(c, w-extents.x_advance-10, y);
-        cairo_text_path (c, buffer);
+        cairo_select_font_face(c,"sans",
+         CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD);
+        cairo_set_font_size(c,18);
+        cairo_text_extents(c,buffer,&extents);
+        cairo_set_source_rgb(c,1,1,1);
+        cairo_move_to(c,w-extents.x_advance-10,y);
+        cairo_show_text(c,buffer);
+        cairo_set_source_rgb(c,0,0,0);
+        cairo_move_to(c,w-extents.x_advance-10,y);
+        cairo_text_path(c,buffer);
         cairo_set_line_width(c,.8);
         cairo_set_line_join(c,CAIRO_LINE_JOIN_ROUND);
         cairo_stroke(c);
       }
-
       cairo_destroy(c);
     }
     /*Out of the Cairo plane into the telemetry YUV buffer.*/

Modified: branches/theora-gumboot/lib/enc/analyze.c
===================================================================
--- branches/theora-gumboot/lib/enc/analyze.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/analyze.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -22,6 +22,7 @@
 
 
 typedef struct oc_fr_state           oc_fr_state;
+typedef struct oc_qii_state          oc_qii_state;
 typedef struct oc_enc_pipeline_state oc_enc_pipeline_state;
 typedef struct oc_rd_metric          oc_rd_metric;
 typedef struct oc_mode_choice        oc_mode_choice;
@@ -212,168 +213,174 @@
 
 /*State to track coded block flags and their bit cost.*/
 struct oc_fr_state{
+  ptrdiff_t  bits;
   unsigned   sb_partial_count:16;
   unsigned   sb_full_count:16;
+  unsigned   b_coded_count_prev:8;
+  unsigned   b_coded_count:8;
   unsigned   b_count:8;
-  unsigned   b_pend:8;
-  signed int sb_partial_last:2;
-  signed int sb_full_last:2;
-  signed int b_last:2;
-  unsigned   sb_partial:1;
-  unsigned   sb_coded:1;
-  unsigned   sb_partial_break:1;
-  unsigned   sb_full_break:1;
-  ptrdiff_t  bits;
+  signed int sb_partial:2;
+  signed int sb_full:2;
+  signed int b_coded_prev:2;
+  signed int b_coded:2;
 };
 
 
 
 static void oc_fr_state_init(oc_fr_state *_fr){
-  _fr->sb_partial_last=-1;
+  _fr->bits=0;
   _fr->sb_partial_count=0;
-  _fr->sb_partial_break=0;
-  _fr->sb_full_last=-1;
   _fr->sb_full_count=0;
-  _fr->sb_full_break=0;
-  _fr->b_last=-1;
+  _fr->b_coded_count_prev=0;
+  _fr->b_coded_count=0;
   _fr->b_count=0;
-  _fr->b_pend=0;
-  _fr->sb_partial=0;
-  _fr->sb_coded=0;
-  _fr->bits=0;
+  _fr->sb_partial=-1;
+  _fr->sb_full=-1;
+  _fr->b_coded_prev=-1;
+  _fr->b_coded=-1;
 }
 
 
-static void oc_fr_skip_block(oc_fr_state *_fr){
-  if(_fr->sb_coded){
-    if(!_fr->sb_partial){
-      /*The super block was previously fully coded.*/
-      if(_fr->b_last==-1){
-        /*First run of the frame...*/
-        _fr->bits++;
-        _fr->b_last=1;
+static void oc_fr_state_advance_sb(oc_fr_state *_fr,
+ int _sb_partial,int _sb_full){
+  ptrdiff_t bits;
+  int       sb_partial_count;
+  int       sb_full_count;
+  bits=_fr->bits;
+  /*Extend the sb_partial run, or start a new one.*/
+  sb_partial_count=_fr->sb_partial;
+  if(_fr->sb_partial==_sb_partial){
+    if(sb_partial_count>=4129){
+      bits++;
+      sb_partial_count=0;
+    }
+    else bits-=oc_sb_run_bits(sb_partial_count);
+  }
+  else sb_partial_count=0;
+  sb_partial_count++;
+  bits+=oc_sb_run_bits(sb_partial_count);
+  if(!_sb_partial){
+    /*Extend the sb_full run, or start a new one.*/
+    sb_full_count=_fr->sb_full_count;
+    if(_fr->sb_full==_sb_full){
+      if(sb_full_count>=4129){
+        bits++;
+        sb_full_count=0;
       }
-      if(_fr->b_last==1){
-        /*The in-progress run is also a coded run.*/
-        _fr->b_count+=_fr->b_pend;
-      }
-      else{
-        /*The in-progress run is an uncoded run; flush.*/
-        _fr->bits+=oc_block_run_bits(_fr->b_count);
-        _fr->b_count=_fr->b_pend;
-        _fr->b_last=1;
-      }
+      else bits-=oc_sb_run_bits(sb_full_count);
     }
-    /*Add a skip block.*/
-    if(_fr->b_last==0)_fr->b_count++;
-    else{
-      if(_fr->b_count)_fr->bits+=oc_block_run_bits(_fr->b_count);
-      _fr->b_count=1;
-      _fr->b_last=0;
-    }
+    else sb_full_count=0;
+    sb_full_count++;
+    bits+=oc_sb_run_bits(sb_full_count);
+    _fr->sb_full=_sb_full;
+    _fr->sb_full_count=sb_full_count;
   }
-  _fr->b_pend++;
-  _fr->sb_partial=1;
+  _fr->bits=bits;
+  _fr->sb_partial=_sb_partial;
+  _fr->sb_partial_count=sb_partial_count;
 }
 
-static void oc_fr_code_block(oc_fr_state *_fr){
-  if(_fr->sb_partial){
-    if(!_fr->sb_coded){
-      /*The super block was previously completely uncoded...*/
-      if(_fr->b_last==-1){
-        /*First run of the frame...*/
-        _fr->bits++;
-        _fr->b_last=0;
-      }
-      if(_fr->b_last==0){
-        /*The in-progress run is also an uncoded run.*/
-        _fr->b_count += _fr->b_pend;
-      }
-      else{
-        /*The in-progress run is a coded run; flush.*/
-        _fr->bits+=oc_block_run_bits(_fr->b_count);
-        _fr->b_count=_fr->b_pend;
-        _fr->b_last=0;
-      }
+/*Flush any outstanding block flags for a SB (e.g., one with fewer than 16
+   blocks).*/
+static void oc_fr_state_flush_sb(oc_fr_state *_fr){
+  ptrdiff_t bits;
+  int       sb_partial;
+  int       sb_full=sb_full;
+  int       b_coded_count;
+  int       b_coded;
+  int       b_count;
+  b_count=_fr->b_count;
+  if(b_count>0){
+    bits=_fr->bits;
+    b_coded=_fr->b_coded;
+    b_coded_count=_fr->b_coded_count;
+    if(b_coded_count>=b_count){
+      /*This SB was fully coded/uncoded; roll back the partial block flags.*/
+      bits-=oc_block_run_bits(b_coded_count);
+      if(b_coded_count>b_count)bits+=oc_block_run_bits(b_coded_count-b_count);
+      sb_partial=0;
+      sb_full=b_coded;
+      b_coded=_fr->b_coded_prev;
+      b_coded_count=_fr->b_coded_count_prev;
     }
-    /*Add a coded block.*/
-    if(_fr->b_last==1)_fr->b_count++;
     else{
-      _fr->bits+=oc_block_run_bits(_fr->b_count);
-      _fr->b_count=1;
-      _fr->b_last=1;
+      /*It was partially coded.*/
+      sb_partial=1;
+      /*sb_full is unused.*/
     }
+    _fr->bits=bits;
+    _fr->b_coded_count=b_coded_count;
+    _fr->b_coded_count_prev=b_coded_count;
+    _fr->b_count=0;
+    _fr->b_coded=b_coded;
+    _fr->b_coded_prev=b_coded;
+    oc_fr_state_advance_sb(_fr,sb_partial,sb_full);
   }
-  _fr->b_pend++;
-  _fr->sb_coded=1;
 }
 
-static void oc_fr_finish_sb(oc_fr_state *_fr){
-  /*Update the partial flag.*/
-  int partial;
-  partial=_fr->sb_partial&_fr->sb_coded;
-  if(_fr->sb_partial_last==-1){
-    _fr->bits++;
-    _fr->sb_partial_last=partial;
-  }
-  if(_fr->sb_partial_break){
-    _fr->bits++;
-    _fr->sb_partial_break=0;
-  }
-  if(_fr->sb_partial_last==partial&&_fr->sb_partial_count<4129){
-    _fr->sb_partial_count++;
-  }
-  else{
-    _fr->bits+=oc_sb_run_bits(_fr->sb_partial_count);
-    if(_fr->sb_partial_count>=4129)_fr->sb_partial_break=1;
-    _fr->sb_partial_count=1;
-  }
-  _fr->sb_partial_last=partial;
-  /*Fully coded/uncoded state.*/
-  if(!_fr->sb_partial||!_fr->sb_coded){
-    if(_fr->sb_full_last==-1){
-      _fr->bits++;
-      _fr->sb_full_last=_fr->sb_coded;
+static void oc_fr_state_advance_block(oc_fr_state *_fr,int _b_coded){
+  ptrdiff_t bits;
+  int       b_coded_count;
+  int       b_count;
+  int       sb_partial;
+  int       sb_full=sb_full;
+  bits=_fr->bits;
+  /*Extend the b_coded run, or start a new one.*/
+  b_coded_count=_fr->b_coded_count;
+  if(_fr->b_coded==_b_coded)bits-=oc_block_run_bits(b_coded_count);
+  else b_coded_count=0;
+  b_coded_count++;
+  b_count=_fr->b_count+1;
+  if(b_count>=16){
+    /*We finished a superblock.*/
+    if(b_coded_count>=16){
+      /*It was fully coded/uncoded; roll back the partial block flags.*/
+      if(b_coded_count>16)bits+=oc_block_run_bits(b_coded_count-16);
+      sb_partial=0;
+      sb_full=_b_coded;
+      _b_coded=_fr->b_coded_prev;
+      b_coded_count=_fr->b_coded_count_prev;
     }
-    if(_fr->sb_full_break){
-      _fr->bits++;
-      _fr->sb_full_break=0;
-    }
-    if(_fr->sb_full_last==_fr->sb_coded&&_fr->sb_full_count<4129){
-      _fr->sb_full_count++;
-    }
     else{
-      _fr->bits+=oc_sb_run_bits( _fr->sb_full_count);
-      if(_fr->sb_full_count>=4129)_fr->sb_full_break=1;
-      _fr->sb_full_count=1;
+      bits+=oc_block_run_bits(b_coded_count);
+      /*It was partially coded.*/
+      sb_partial=1;
+      /*sb_full is unused.*/
     }
-    _fr->sb_full_last=_fr->sb_coded;
+    _fr->bits=bits;
+    _fr->b_coded_count=b_coded_count;
+    _fr->b_coded_count_prev=b_coded_count;
+    _fr->b_count=0;
+    _fr->b_coded=_b_coded;
+    _fr->b_coded_prev=_b_coded;
+    oc_fr_state_advance_sb(_fr,sb_partial,sb_full);
   }
-  _fr->b_pend=0;
-  _fr->sb_partial=0;
-  _fr->sb_coded=0;
+  else{
+    bits+=oc_block_run_bits(b_coded_count);
+    _fr->bits=bits;
+    _fr->b_coded_count=b_coded_count;
+    _fr->b_count=b_count;
+    _fr->b_coded=_b_coded;
+  }
 }
 
-static void oc_fr_flush(oc_fr_state *_fr){
-  /*Flush any pending partial run.*/
-  if(_fr->sb_partial_break)_fr->bits++;
-  if(_fr->sb_partial_count)_fr->bits+=oc_sb_run_bits(_fr->sb_partial_count);
-  /*Flush any pending full run.*/
-  if(_fr->sb_full_break)_fr->bits++;
-  if(_fr->sb_full_count)_fr->bits+=oc_sb_run_bits(_fr->sb_full_count);
-  /*Flush any pending block run.*/
-  if(_fr->b_count)_fr->bits+=oc_block_run_bits(_fr->b_count);
+static void oc_fr_skip_block(oc_fr_state *_fr){
+  oc_fr_state_advance_block(_fr,0);
 }
 
+static void oc_fr_code_block(oc_fr_state *_fr){
+  oc_fr_state_advance_block(_fr,1);
+}
+
 static int oc_fr_cost1(const oc_fr_state *_fr){
   oc_fr_state tmp;
-  int         bits;
+  ptrdiff_t   bits;
   *&tmp=*_fr;
   oc_fr_skip_block(&tmp);
   bits=tmp.bits;
   *&tmp=*_fr;
   oc_fr_code_block(&tmp);
-  return tmp.bits-bits;
+  return (int)(tmp.bits-bits);
 }
 
 static int oc_fr_cost4(const oc_fr_state *_pre,const oc_fr_state *_post){
@@ -383,34 +390,104 @@
   oc_fr_skip_block(&tmp);
   oc_fr_skip_block(&tmp);
   oc_fr_skip_block(&tmp);
-  return _post->bits-tmp.bits;
+  return (int)(_post->bits-tmp.bits);
 }
 
 
 
+struct oc_qii_state{
+  ptrdiff_t  bits;
+  unsigned   qi01_count:14;
+  signed int qi01:2;
+  unsigned   qi12_count:14;
+  signed int qi12:2;
+};
+
+
+
+static void oc_qii_state_init(oc_qii_state *_qs){
+  _qs->bits=0;
+  _qs->qi01_count=0;
+  _qs->qi01=-1;
+  _qs->qi12_count=0;
+  _qs->qi12=-1;
+}
+
+
+static void oc_qii_state_advance(oc_qii_state *_qd,
+ const oc_qii_state *_qs,int _qii){
+  ptrdiff_t bits;
+  int       qi01;
+  int       qi01_count;
+  int       qi12;
+  int       qi12_count;
+  bits=_qs->bits;
+  qi01=_qii+1>>1;
+  qi01_count=_qs->qi01_count;
+  if(qi01==_qs->qi01){
+    if(qi01_count>=4129){
+      bits++;
+      qi01_count=0;
+    }
+    else bits-=oc_sb_run_bits(qi01_count);
+  }
+  else qi01_count=0;
+  qi01_count++;
+  bits+=oc_sb_run_bits(qi01_count);
+  qi12_count=_qs->qi12_count;
+  if(_qii){
+    qi12=_qii>>1;
+    if(qi12==_qs->qi12){
+      if(qi12_count>=4129){
+        bits++;
+        qi12_count=0;
+      }
+      else bits-=oc_sb_run_bits(qi12_count);
+    }
+    else qi12_count=0;
+    qi12_count++;
+    bits+=oc_sb_run_bits(qi12_count);
+  }
+  else qi12=_qs->qi12;
+  _qd->bits=bits;
+  _qd->qi01=qi01;
+  _qd->qi01_count=qi01_count;
+  _qd->qi12=qi12;
+  _qd->qi12_count=qi12_count;
+}
+
+
+
 /*Temporary encoder state for the analysis pipeline.*/
 struct oc_enc_pipeline_state{
   int                 bounding_values[256];
   oc_fr_state         fr[3];
+  oc_qii_state        qs[3];
   /*Condensed dequantization tables.*/
   const ogg_uint16_t *dequant[3][3][2];
   /*Condensed quantization tables.*/
   const oc_iquant    *enquant[3][3][2];
+  /*Skip SSD storage for the current MCU in each plane.*/
+  unsigned           *skip_ssd[3];
   /*Coded/uncoded fragment lists for each plane for the current MCU.*/
   ptrdiff_t          *coded_fragis[3];
   ptrdiff_t          *uncoded_fragis[3];
   ptrdiff_t           ncoded_fragis[3];
   ptrdiff_t           nuncoded_fragis[3];
+  /*The starting fragment for the current MCU in each plane.*/
+  ptrdiff_t           froffset[3];
   /*The starting row for the current MCU in each plane.*/
   int                 fragy0[3];
   /*The ending row for the current MCU in each plane.*/
   int                 fragy_end[3];
+  /*The starting superblock for the current MCU in each plane.*/
+  unsigned            sbi0[3];
+  /*The ending superblock for the current MCU in each plane.*/
+  unsigned            sbi_end[3];
   /*The number of tokens for zzi=1 for each color plane.*/
   int                 ndct_tokens1[3];
   /*The outstanding eob_run count for zzi=1 for each color plane.*/
   int                 eob_run1[3];
-  /*The number of vertical super blocks in an MCU.*/
-  int                 mcu_nvsbs;
   /*Whether or not the loop filter is enabled.*/
   int                 loop_filter;
 };
@@ -418,6 +495,10 @@
 
 static void oc_enc_pipeline_init(oc_enc_ctx *_enc,oc_enc_pipeline_state *_pipe){
   ptrdiff_t *coded_fragis;
+  unsigned   mcu_nvsbs;
+  ptrdiff_t  mcu_nfrags;
+  int        hdec;
+  int        vdec;
   int        pli;
   int        qii;
   int        qti;
@@ -425,6 +506,15 @@
     These are used for bit-estimation purposes only; the real flag bits span
      all three planes, so we can't compute them in parallel.*/
   for(pli=0;pli<3;pli++)oc_fr_state_init(_pipe->fr+pli);
+  for(pli=0;pli<3;pli++)oc_qii_state_init(_pipe->qs+pli);
+  /*Set up the per-plane skip SSD storage pointers.*/
+  mcu_nvsbs=_enc->mcu_nvsbs;
+  mcu_nfrags=mcu_nvsbs*_enc->state.fplanes[0].nhsbs*16;
+  hdec=!(_enc->state.info.pixel_fmt&1);
+  vdec=!(_enc->state.info.pixel_fmt&2);
+  _pipe->skip_ssd[0]=_enc->mcu_skip_ssd;
+  _pipe->skip_ssd[1]=_pipe->skip_ssd[0]+mcu_nfrags;
+  _pipe->skip_ssd[2]=_pipe->skip_ssd[1]+(mcu_nfrags>>hdec+vdec);
   /*Set up per-plane pointers to the coded and uncoded fragments lists.
     Unlike the decoder, each planes' coded and uncoded fragment list is kept
      separate during the analysis stage; we only make the coded list for all
@@ -454,14 +544,45 @@
     _pipe->ndct_tokens1[pli]=0;
     _pipe->eob_run1[pli]=0;
   }
-  /*If chroma is sub-sampled in the vertical direction, we have to encode two
-     super block rows of Y' for each super block row of Cb and Cr.*/
-  _pipe->mcu_nvsbs=1<<!(_enc->state.info.pixel_fmt&2);
   /*Initialize the bounding value array for the loop filter.*/
   _pipe->loop_filter=!oc_state_loop_filter_init(&_enc->state,
    _pipe->bounding_values);
 }
 
+/*Sets the current MCU stripe to super block row _sby.
+  Return: A non-zero value if this was the last MCU.*/
+static int oc_enc_pipeline_set_stripe(oc_enc_ctx *_enc,
+ oc_enc_pipeline_state *_pipe,int _sby){
+  const oc_fragment_plane *fplane;
+  unsigned                 mcu_nvsbs;
+  int                      sby_end;
+  int                      notdone;
+  int                      vdec;
+  int                      pli;
+  mcu_nvsbs=_enc->mcu_nvsbs;
+  sby_end=_enc->state.fplanes[0].nvsbs;
+  notdone=_sby+mcu_nvsbs<sby_end;
+  if(notdone)sby_end=_sby+mcu_nvsbs;
+  vdec=0;
+  for(pli=0;pli<3;pli++){
+    fplane=_enc->state.fplanes+pli;
+    _pipe->sbi0[pli]=fplane->sboffset+(_sby>>vdec)*fplane->nhsbs;
+    _pipe->fragy0[pli]=_sby<<2-vdec;
+    _pipe->froffset[pli]=fplane->froffset
+     +_pipe->fragy0[pli]*(ptrdiff_t)fplane->nhfrags;
+    if(notdone){
+      _pipe->sbi_end[pli]=fplane->sboffset+(sby_end>>vdec)*fplane->nhsbs;
+      _pipe->fragy_end[pli]=sby_end<<2-vdec;
+    }
+    else{
+      _pipe->sbi_end[pli]=fplane->sboffset+fplane->nsbs;
+      _pipe->fragy_end[pli]=fplane->nvfrags;
+    }
+    vdec=!(_enc->state.info.pixel_fmt&2);
+  }
+  return notdone;
+}
+
 static void oc_enc_pipeline_finish_mcu_plane(oc_enc_ctx *_enc,
  oc_enc_pipeline_state *_pipe,int _pli,int _sdelay,int _edelay){
   int refi;
@@ -515,49 +636,60 @@
 static int oc_enc_block_transform_quantize(oc_enc_ctx *_enc,
  oc_enc_pipeline_state *_pipe,int _pli,ptrdiff_t _fragi,int _overhead_bits,
  oc_rd_metric *_mo,oc_token_checkpoint **_stack){
-  OC_ALIGN16(ogg_int16_t buffer[64]);
+  OC_ALIGN16(ogg_int16_t  buffer[64]);
   OC_ALIGN16(ogg_int16_t zzbuffer[64]);
-  OC_ALIGN16(ogg_int16_t data[64]);
-  const ogg_uint16_t  *dequant;
-  const oc_iquant     *enquant;
-  ptrdiff_t            frag_offs;
-  int                  ystride;
-  const unsigned char *src;
-  const unsigned char *ref;
-  unsigned char       *dst;
-  int                  frame_type;
-  int                  nonzero;
-  int                  uncoded_ssd;
-  int                  coded_ssd;
-  int                  uncoded_dc;
-  int                  coded_dc;
-  int                  dc_flag;
-  oc_token_checkpoint *checkpoint;
-  oc_fragment         *frags;
-  int                  mb_mode;
-  int                  mv_offs[2];
-  int                  nmv_offs;
-  int                  ac_bits;
-  int                  borderi;
-  int                  pi;
-  int                  zzi;
-  int                  dc;
+  OC_ALIGN16(ogg_int16_t  data[64]);
+  ogg_uint16_t            dc_dequant;
+  const ogg_uint16_t     *dequant;
+  const oc_iquant        *enquant;
+  ptrdiff_t               frag_offs;
+  int                     ystride;
+  const unsigned char    *src;
+  const unsigned char    *ref;
+  unsigned char          *dst;
+  int                     frame_type;
+  int                     nonzero;
+  unsigned                uncoded_ssd;
+  unsigned                coded_ssd;
+  int                     coded_dc;
+  oc_token_checkpoint    *checkpoint;
+  oc_fragment            *frags;
+  int                     mb_mode;
+  int                     mv_offs[2];
+  int                     nmv_offs;
+  int                     ac_bits;
+  int                     borderi;
+  int                     qti;
+  int                     qii;
+  int                     pi;
+  int                     zzi;
+  int                     v;
+  int                     val;
+  int                     d;
+  int                     s;
+  int                     dc;
   frags=_enc->state.frags;
   frag_offs=_enc->state.frag_buf_offs[_fragi];
   ystride=_enc->state.ref_ystride[_pli];
+  src=_enc->state.ref_frame_data[OC_FRAME_IO]+frag_offs;
+  borderi=frags[_fragi].borderi;
+  qii=frags[_fragi].qii;
+  if(qii&~3){
+#if 1
+    /*Enable early skip detection.*/
+    frags[_fragi].coded=0;
+    return 0;
+#else
+    /*Try and code the fragment anyway.*/
+    qii&=3;
+    frags[_fragi].qii=qii;
+#endif
+  }
   mb_mode=frags[_fragi].mb_mode;
-  src=_enc->state.ref_frame_data[OC_FRAME_IO]+frag_offs;
   ref=_enc->state.ref_frame_data[
    _enc->state.ref_frame_idx[OC_FRAME_FOR_MODE[mb_mode]]]+frag_offs;
   dst=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_SELF]]
    +frag_offs;
-  /*Although the fragment coding overhead determination is accurate, it is
-     greedy, using very coarse-grained local information.
-    Allowing it to mildly discourage coding turns out to be beneficial, but
-     it's not clear that allowing it to encourage coding through negative
-     coding overhead deltas is useful.
-    For that reason, we disallow negative coding_overheads.*/
-  if(_overhead_bits<0)_overhead_bits=0;
   /*Motion compensation:*/
   switch(mb_mode){
     case OC_MODE_INTRA:{
@@ -598,66 +730,29 @@
     _enc->frag_satd[_fragi]=satd;
   }
 #endif
-  frame_type=_enc->state.frame_type;
-  borderi=frags[_fragi].borderi;
-  uncoded_ssd=uncoded_dc=0;
-  if(frame_type!=OC_INTRA_FRAME){
-    if(mb_mode==OC_MODE_INTER_NOMV){
-      if(borderi<0){
-        for(pi=0;pi<64;pi++){
-          uncoded_ssd+=data[pi]*data[pi];
-          uncoded_dc+=data[pi];
-        }
-      }
-      else{
-        ogg_int64_t mask;
-        mask=_enc->state.borders[borderi].mask;
-        for(pi=0;pi<64;pi++,mask>>=1)if(mask&1){
-          uncoded_ssd+=data[pi]*data[pi];
-          uncoded_dc+=data[pi];
-        }
-      }
-    }
-    else{
-      oc_enc_frag_sub(_enc,buffer,src,
-       _enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_PREV]]
-       +frag_offs,ystride);
-      if(borderi<0){
-        for(pi=0;pi<64;pi++){
-          uncoded_ssd+=buffer[pi]*buffer[pi];
-          uncoded_dc+=buffer[pi];
-        }
-      }
-      else{
-        ogg_int64_t mask;
-        mask=_enc->state.borders[borderi].mask;
-        for(pi=0;pi<64;pi++,mask>>=1)if(mask&1){
-          uncoded_ssd+=buffer[pi]*buffer[pi];
-          uncoded_dc+=buffer[pi];
-        }
-      }
-    }
-    /*Scale to match DCT domain.*/
-    uncoded_ssd<<=4;
-  }
   /*Transform:*/
   oc_enc_fdct8x8(_enc,buffer,data);
-  /*Quantize:*/
-  /*TODO: Block-level quantizers.*/
-  dequant=_pipe->dequant[_pli][0][mb_mode!=OC_MODE_INTRA];
-  enquant=_pipe->enquant[_pli][0][mb_mode!=OC_MODE_INTRA];
+  /*Quantize the DC coefficient:*/
+  qti=mb_mode!=OC_MODE_INTRA;
+  enquant=_pipe->enquant[_pli][0][qti];
+  dc_dequant=_pipe->dequant[_pli][0][qti][0];
+  v=buffer[0];
+  val=v<<1;
+  s=OC_SIGNMASK(val);
+  val+=dc_dequant+s^s;
+  val=((enquant[0].m*(ogg_int32_t)val>>16)+val>>enquant[0].l)-s;
+  data[0]=OC_CLAMPI(-580,val,580);
   nonzero=0;
-  for(zzi=0;zzi<64;zzi++){
-    int v;
-    int val;
-    int d;
+  /*Quantize the AC coefficients:*/
+  dequant=_pipe->dequant[_pli][qii][qti];
+  enquant=_pipe->enquant[_pli][qii][qti];
+  for(zzi=1;zzi<64;zzi++){
     v=buffer[OC_FZIG_ZAG[zzi]];
     d=dequant[zzi];
     zzbuffer[zzi]=v;
     val=v<<1;
     v=abs(val);
     if(v>=d){
-      int s;
       s=OC_SIGNMASK(val);
       /*The bias added here rounds ties away from zero, since token
          optimization can only decrease the magnitude of the quantized
@@ -674,7 +769,7 @@
   /*Tokenize.*/
   checkpoint=*_stack;
   ac_bits=oc_enc_tokenize_ac(_enc,_pli,_fragi,data,dequant,zzbuffer,nonzero+1,
-   _stack,mb_mode==OC_MODE_INTRA?3:0);
+   _stack,qti?0:3);
   dc=data[0];
   /*Reconstruct.
     TODO: nonzero may need to be adjusted after tokenization.*/
@@ -688,14 +783,15 @@
     for(ci=0;ci<64;ci++)data[ci]=p;
   }
   else{
-    data[0]*=dequant[0];
+    data[0]*=dc_dequant;
     oc_idct8x8(&_enc->state,data,nonzero+1,nonzero+1);
   }
-  if(mb_mode==OC_MODE_INTRA)oc_enc_frag_recon_intra(_enc,dst,ystride,data);
+  if(!qti)oc_enc_frag_recon_intra(_enc,dst,ystride,data);
   else{
     oc_enc_frag_recon_inter(_enc,dst,
      nmv_offs==1?ref+mv_offs[0]:dst,ystride,data);
   }
+  frame_type=_enc->state.frame_type;
 #if !defined(OC_COLLECT_METRICS)
   if(frame_type!=OC_INTRA_FRAME)
 #endif
@@ -719,46 +815,46 @@
     }
     /*Scale to match DCT domain.*/
     coded_ssd<<=4;
-    /*We actually only want the AC contribution to the SSDs.*/
-    uncoded_ssd-=uncoded_dc*uncoded_dc>>2;
+    /*We actually only want the AC contribution to the SSD.*/
     coded_ssd-=coded_dc*coded_dc>>2;
 #if defined(OC_COLLECT_METRICS)
     _enc->frag_ssd[_fragi]=coded_ssd;
   }
   if(frame_type!=OC_INTRA_FRAME){
 #endif
+    uncoded_ssd=_pipe->skip_ssd[_pli][_fragi-_pipe->froffset[_pli]];
+    if(uncoded_ssd<UINT_MAX){
+      /*Although the fragment coding overhead determination is accurate, it is
+         greedy, using very coarse-grained local information.
+        Allowing it to mildly discourage coding turns out to be beneficial, but
+         it's not clear that allowing it to encourage coding through negative
+         coding overhead deltas is useful.
+        For that reason, we disallow negative coding_overheads.*/
+      if(_overhead_bits<0)_overhead_bits=0;
+      if(uncoded_ssd<=coded_ssd+(_overhead_bits+ac_bits)*_enc->lambda&&
+       /*Don't allow luma blocks to be skipped in 4MV mode when VP3
+          compatibility is enabled.*/
+       (!_enc->vp3_compatible||mb_mode!=OC_MODE_INTER_MV_FOUR||_pli)){
+        /*Hm, not worth it; roll back.*/
+        oc_enc_tokenlog_rollback(_enc,checkpoint,(*_stack)-checkpoint);
+        *_stack=checkpoint;
+        frags[_fragi].coded=0;
+        return 0;
+      }
+    }
+    else _mo->dc_flag=1;
     _mo->uncoded_ac_ssd+=uncoded_ssd;
-    /*DC is a special case; if there's more than a full-quantizer improvement
-       in the effective DC component, always force-code the block.
-      One might expect this to be abs(uncoded_dc-coded_dc), but this performs
-       slightly better, since coded_dc will always be near zero, but may be on
-       the opposite side of zero from uncoded_dc.*/
-    dc_flag=abs(uncoded_dc)-abs(coded_dc)>dequant[0]<<1;
-    if(!dc_flag&&uncoded_ssd<=coded_ssd+(_overhead_bits+ac_bits)*_enc->lambda&&
-     /*Don't allow luma blocks to be skipped in 4MV mode when VP3 compatibility
-        is enabled.*/
-     (!_enc->vp3_compatible||mb_mode!=OC_MODE_INTER_MV_FOUR)){
-      /*Hm, not worth it; roll back.*/
-      oc_enc_tokenlog_rollback(_enc,checkpoint,(*_stack)-checkpoint);
-      *_stack=checkpoint;
-      _mo->coded_ac_ssd+=uncoded_ssd;
-      frags[_fragi].coded=0;
-      return 0;
-    }
-    else{
-      _mo->dc_flag|=dc_flag;
-      _mo->coded_ac_ssd+=coded_ssd;
-      _mo->ac_bits+=ac_bits;
-    }
+    _mo->coded_ac_ssd+=coded_ssd;
+    _mo->ac_bits+=ac_bits;
   }
+  oc_qii_state_advance(_pipe->qs+_pli,_pipe->qs+_pli,qii);
   frags[_fragi].dc=dc;
   frags[_fragi].coded=1;
   return 1;
 }
 
-/* mode_overhead is scaled by << OC_BIT_SCALE */
 static int oc_enc_mb_transform_quantize_luma(oc_enc_ctx *_enc,
- oc_enc_pipeline_state *_pipe,int _mbi,int _mode_overhead){
+ oc_enc_pipeline_state *_pipe,unsigned _mbi,int _mode_overhead){
   /*Worst case token stack usage for 4 fragments.*/
   oc_token_checkpoint  stack[64*4];
   oc_token_checkpoint *stackptr;
@@ -771,11 +867,13 @@
   ptrdiff_t            nuncoded_fragis;
   oc_rd_metric         mo;
   oc_fr_state          fr_checkpoint;
+  oc_qii_state         qs_checkpoint;
   int                  mb_mode;
   int                  ncoded;
   ptrdiff_t            fragi;
   int                  bi;
   *&fr_checkpoint=*(_pipe->fr+0);
+  *&qs_checkpoint=*(_pipe->qs+0);
   sb_maps=(const oc_sb_map *)_enc->state.sb_maps;
   mb_modes=_enc->state.mb_modes;
   frags=_enc->state.frags;
@@ -807,12 +905,13 @@
       /*Some individual blocks were worth coding.
         See if that's still true when accounting for mode and MV overhead.*/
       cost=mo.coded_ac_ssd+_enc->lambda*(mo.ac_bits
-       +oc_fr_cost4(&fr_checkpoint,_pipe->fr+0)+(_mode_overhead>>OC_BIT_SCALE));
+       +oc_fr_cost4(&fr_checkpoint,_pipe->fr+0)+_mode_overhead);
       if(mo.uncoded_ac_ssd<=cost){
         /*Taking macroblock overhead into account, it is not worth coding this
            MB.*/
         oc_enc_tokenlog_rollback(_enc,stack,stackptr-stack);
         *(_pipe->fr+0)=*&fr_checkpoint;
+        *(_pipe->qs+0)=*&qs_checkpoint;
         for(bi=0;bi<4;bi++){
           fragi=sb_maps[_mbi>>2][_mbi&3][bi];
           if(frags[fragi].coded){
@@ -879,9 +978,9 @@
         }
       }
     }
-    oc_fr_finish_sb(_pipe->fr+_pli);
-    sb_flags[sbi].coded_fully=_pipe->fr[_pli].sb_full_last;
-    sb_flags[sbi].coded_partially=_pipe->fr[_pli].sb_partial_last;
+    oc_fr_state_flush_sb(_pipe->fr+_pli);
+    sb_flags[sbi].coded_fully=_pipe->fr[_pli].sb_full;
+    sb_flags[sbi].coded_partially=_pipe->fr[_pli].sb_partial;
   }
   _pipe->ncoded_fragis[_pli]=ncoded_fragis;
   _pipe->nuncoded_fragis[_pli]=nuncoded_fragis;
@@ -924,17 +1023,16 @@
     year=2003
   }*/
 
-/*Cost information about a MB mode.*/
-struct oc_mode_choice{
-  unsigned cost;
-  unsigned ssd;
-  unsigned rate;
-  unsigned overhead;
-};
+/*Computes (_ssd+_lambda*_rate)/(1<<OC_BIT_SCALE) with rounding, avoiding
+   overflow for large lambda values.*/
+#define OC_MODE_RD_COST(_ssd,_rate,_lambda) \
+ ((_ssd)>>OC_BIT_SCALE)+((_rate)>>OC_BIT_SCALE)*(_lambda) \
+ +(((_ssd)&(1<<OC_BIT_SCALE)-1)+((_rate)&(1<<OC_BIT_SCALE)-1)*(_lambda) \
+ +((1<<OC_BIT_SCALE)>>1)>>OC_BIT_SCALE)
 
-
-
-static void oc_mode_dct_cost_accum(oc_mode_choice *_modec,
+/*Estimate the R-D cost of the DCT coefficients given the SATD of a block after
+   prediction.*/
+static unsigned oc_dct_cost2(unsigned *_ssd,
  int _qi,int _pli,int _qti,int _satd){
   unsigned rmse;
   int      bin;
@@ -952,19 +1050,558 @@
   z0=OC_MODE_RD[_qi][_pli][_qti][bin].rmse;
   dy=OC_MODE_RD[_qi][_pli][_qti][bin+1].rate-y0;
   dz=OC_MODE_RD[_qi][_pli][_qti][bin+1].rmse-z0;
-  _modec->rate+=OC_MAXI(y0+(dy*dx>>OC_SAD_SHIFT),0);
   rmse=OC_MAXI(z0+(dz*dx>>OC_SAD_SHIFT),0);
-  _modec->ssd+=rmse*rmse>>2*OC_RMSE_SCALE-OC_BIT_SCALE;
+  *_ssd=rmse*rmse>>2*OC_RMSE_SCALE-OC_BIT_SCALE;
+  return OC_MAXI(y0+(dy*dx>>OC_SAD_SHIFT),0);
 }
 
+/*Select luma block-level quantizers for a MB in an INTRA frame.*/
+static unsigned oc_analyze_intra_mb_luma(oc_enc_ctx *_enc,
+ const oc_qii_state *_qs,unsigned _mbi){
+  const unsigned char *src;
+  const ptrdiff_t     *frag_buf_offs;
+  const oc_sb_map     *sb_maps;
+  oc_fragment         *frags;
+  ptrdiff_t            frag_offs;
+  ptrdiff_t            fragi;
+  oc_qii_state         qs[4][3];
+  unsigned             cost[4][3];
+  unsigned             ssd[4][3];
+  unsigned             rate[4][3];
+  int                  prev[3][3];
+  unsigned             satd;
+  unsigned             best_cost;
+  unsigned             best_ssd;
+  unsigned             best_rate;
+  int                  best_qii;
+  int                  qii;
+  int                  lambda;
+  int                  ystride;
+  int                  nqis;
+  int                  bi;
+  frag_buf_offs=_enc->state.frag_buf_offs;
+  sb_maps=(const oc_sb_map *)_enc->state.sb_maps;
+  src=_enc->state.ref_frame_data[OC_FRAME_IO];
+  ystride=_enc->state.ref_ystride[0];
+  fragi=sb_maps[_mbi>>2][_mbi&3][0];
+  frag_offs=frag_buf_offs[fragi];
+  satd=oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride);
+  nqis=_enc->state.nqis;
+  lambda=_enc->lambda;
+  for(qii=0;qii<nqis;qii++){
+    oc_qii_state_advance(qs[0]+qii,_qs,qii);
+    rate[0][qii]=oc_dct_cost2(ssd[0]+qii,_enc->state.qis[qii],0,0,satd)
+     +(qs[0][qii].bits-_qs->bits<<OC_BIT_SCALE);
+    cost[0][qii]=OC_MODE_RD_COST(ssd[0][qii],rate[0][qii],lambda);
+  }
+  for(bi=1;bi<4;bi++){
+    fragi=sb_maps[_mbi>>2][_mbi&3][bi];
+    frag_offs=frag_buf_offs[fragi];
+    satd=oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride);
+    for(qii=0;qii<nqis;qii++){
+      oc_qii_state qt[3];
+      unsigned     cur_ssd;
+      unsigned     cur_rate;
+      int          best_qij;
+      int          qij;
+      oc_qii_state_advance(qt+0,qs[bi-1]+0,qii);
+      cur_rate=oc_dct_cost2(&cur_ssd,_enc->state.qis[qii],0,0,satd);
+      best_ssd=ssd[bi-1][0]+cur_ssd;
+      best_rate=rate[bi-1][0]+cur_rate
+       +(qt[0].bits-qs[bi-1][0].bits<<OC_BIT_SCALE);
+      best_cost=OC_MODE_RD_COST(best_ssd,best_rate,lambda);
+      best_qij=0;
+      for(qij=1;qij<nqis;qij++){
+        unsigned chain_ssd;
+        unsigned chain_rate;
+        unsigned chain_cost;
+        oc_qii_state_advance(qt+qij,qs[bi-1]+qij,qii);
+        chain_ssd=ssd[bi-1][qij]+cur_ssd;
+        chain_rate=rate[bi-1][qij]+cur_rate
+         +(qt[qij].bits-qs[bi-1][qij].bits<<OC_BIT_SCALE);
+        chain_cost=OC_MODE_RD_COST(chain_ssd,chain_rate,lambda);
+        if(chain_cost<best_cost){
+          best_cost=chain_cost;
+          best_ssd=chain_ssd;
+          best_rate=chain_rate;
+          best_qij=qij;
+        }
+      }
+      *(qs[bi]+qii)=*(qt+best_qij);
+      cost[bi][qii]=best_cost;
+      ssd[bi][qii]=best_ssd;
+      rate[bi][qii]=best_rate;
+      prev[bi-1][qii]=best_qij;
+    }
+  }
+  best_qii=0;
+  best_cost=cost[3][0];
+  for(qii=1;qii<nqis;qii++){
+    if(cost[3][qii]<best_cost){
+      best_cost=cost[3][qii];
+      best_qii=qii;
+    }
+  }
+  frags=_enc->state.frags;
+  for(bi=3;;){
+    fragi=sb_maps[_mbi>>2][_mbi&3][bi];
+    frags[fragi].qii=best_qii;
+    if(bi--<=0)break;
+    best_qii=prev[bi][best_qii];
+  }
+  return best_cost;
+}
+
+/*Select a block-level quantizer for a single chroma block in an INTRA frame.*/
+static unsigned oc_analyze_intra_chroma_block(oc_enc_ctx *_enc,
+ const oc_qii_state *_qs,int _pli,ptrdiff_t _fragi){
+  const unsigned char *src;
+  oc_fragment         *frags;
+  ptrdiff_t            frag_offs;
+  oc_qii_state         qt[3];
+  unsigned             cost[3];
+  unsigned             satd;
+  unsigned             best_cost;
+  int                  best_qii;
+  int                  qii;
+  int                  lambda;
+  int                  ystride;
+  int                  nqis;
+  src=_enc->state.ref_frame_data[OC_FRAME_IO];
+  ystride=_enc->state.ref_ystride[_pli];
+  frag_offs=_enc->state.frag_buf_offs[_fragi];
+  satd=oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride);
+  nqis=_enc->state.nqis;
+  lambda=_enc->lambda;
+  best_qii=0;
+  for(qii=0;qii<nqis;qii++){
+    unsigned cur_rate;
+    unsigned cur_ssd;
+    oc_qii_state_advance(qt+qii,_qs,qii);
+    cur_rate=oc_dct_cost2(&cur_ssd,_enc->state.qis[qii],_pli,0,satd)
+     +(qt[qii].bits-_qs->bits<<OC_BIT_SCALE);
+    cost[qii]=OC_MODE_RD_COST(cur_ssd,cur_rate,lambda);
+  }
+  best_cost=cost[0];
+  for(qii=1;qii<nqis;qii++){
+    if(cost[qii]<best_cost){
+      best_cost=cost[qii];
+      best_qii=qii;
+    }
+  }
+  frags=_enc->state.frags;
+  frags[_fragi].qii=best_qii;
+  return best_cost;
+}
+
+static void oc_enc_sb_transform_quantize_intra_chroma(oc_enc_ctx *_enc,
+ oc_enc_pipeline_state *_pipe,int _pli,int _sbi_start,int _sbi_end){
+  const oc_sb_map *sb_maps;
+  oc_sb_flags     *sb_flags;
+  ptrdiff_t       *coded_fragis;
+  ptrdiff_t        ncoded_fragis;
+  int              sbi;
+  sb_maps=(const oc_sb_map *)_enc->state.sb_maps;
+  sb_flags=_enc->state.sb_flags;
+  coded_fragis=_pipe->coded_fragis[_pli];
+  ncoded_fragis=_pipe->ncoded_fragis[_pli];
+  for(sbi=_sbi_start;sbi<_sbi_end;sbi++){
+    /*Worst case token stack usage for 1 fragment.*/
+    oc_token_checkpoint stack[64];
+    int                 quadi;
+    int                 bi;
+    for(quadi=0;quadi<4;quadi++)for(bi=0;bi<4;bi++){
+      ptrdiff_t fragi;
+      fragi=sb_maps[sbi][quadi][bi];
+      if(fragi>=0){
+        oc_token_checkpoint *stackptr;
+        oc_analyze_intra_chroma_block(_enc,_pipe->qs+_pli,_pli,fragi);
+        stackptr=stack;
+        oc_enc_block_transform_quantize(_enc,
+         _pipe,_pli,fragi,0,NULL,&stackptr);
+        coded_fragis[ncoded_fragis++]=fragi;
+      }
+    }
+  }
+  _pipe->ncoded_fragis[_pli]=ncoded_fragis;
+}
+
+/*Analysis stage for an INTRA frame.*/
+int oc_enc_analyze_intra(oc_enc_ctx *_enc,int _recode){
+  oc_enc_pipeline_state   pipe;
+  const unsigned char    *map_idxs;
+  int                     nmap_idxs;
+  oc_sb_flags            *sb_flags;
+  signed char            *mb_modes;
+  const oc_mb_map        *mb_maps;
+  oc_mb_enc_info         *embs;
+  oc_fragment            *frags;
+  unsigned                stripe_sby;
+  unsigned                mcu_nvsbs;
+  int                     notstart;
+  int                     notdone;
+  int                     refi;
+  int                     pli;
+  _enc->state.frame_type=OC_INTRA_FRAME;
+  oc_enc_tokenize_start(_enc);
+  oc_enc_pipeline_init(_enc,&pipe);
+  /*Choose MVs and MB modes and quantize and code luma.
+    Must be done in Hilbert order.*/
+  map_idxs=OC_MB_MAP_IDXS[_enc->state.info.pixel_fmt];
+  nmap_idxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
+  _enc->state.ncoded_fragis[0]=0;
+  _enc->state.ncoded_fragis[1]=0;
+  _enc->state.ncoded_fragis[2]=0;
+  sb_flags=_enc->state.sb_flags;
+  mb_modes=_enc->state.mb_modes;
+  mb_maps=(const oc_mb_map *)_enc->state.mb_maps;
+  embs=_enc->mb_info;
+  frags=_enc->state.frags;
+  notstart=0;
+  notdone=1;
+  mcu_nvsbs=_enc->mcu_nvsbs;
+  for(stripe_sby=0;notdone;stripe_sby+=mcu_nvsbs){
+    unsigned sbi;
+    unsigned sbi_end;
+    notdone=oc_enc_pipeline_set_stripe(_enc,&pipe,stripe_sby);
+    sbi_end=pipe.sbi_end[0];
+    for(sbi=pipe.sbi0[0];sbi<sbi_end;sbi++){
+      int quadi;
+      /*Mode addressing is through Y plane, always 4 MB per SB.*/
+      for(quadi=0;quadi<4;quadi++)if(sb_flags[sbi].quad_valid&1<<quadi){
+        unsigned  mbi;
+        int       mapii;
+        int       mapi;
+        int       bi;
+        ptrdiff_t fragi;
+        mbi=sbi<<2|quadi;
+        /*Motion estimation:
+          We always do a basic 1MV search for all macroblocks, coded or not,
+           keyframe or not.*/
+        if(!_recode&&_enc->state.curframe_num>0)oc_mcenc_search(_enc,mbi);
+        oc_analyze_intra_mb_luma(_enc,pipe.qs+0,mbi);
+        mb_modes[mbi]=OC_MODE_INTRA;
+        oc_enc_mb_transform_quantize_luma(_enc,&pipe,mbi,0);
+        /*Propagate final MB mode and MVs to the chroma blocks.*/
+        for(mapii=4;mapii<nmap_idxs;mapii++){
+          mapi=map_idxs[mapii];
+          pli=mapi>>2;
+          bi=mapi&3;
+          fragi=mb_maps[mbi][pli][bi];
+          frags[fragi].mb_mode=OC_MODE_INTRA;
+        }
+      }
+    }
+    oc_enc_pipeline_finish_mcu_plane(_enc,&pipe,0,notstart,notdone);
+    /*Code chroma planes.*/
+    for(pli=1;pli<3;pli++){
+      oc_enc_sb_transform_quantize_intra_chroma(_enc,&pipe,
+       pli,pipe.sbi0[pli],pipe.sbi_end[pli]);
+      oc_enc_pipeline_finish_mcu_plane(_enc,&pipe,pli,notstart,notdone);
+    }
+    notstart=1;
+  }
+  /*Finish filling in the reference frame borders.*/
+  refi=_enc->state.ref_frame_idx[OC_FRAME_SELF];
+  for(pli=0;pli<3;pli++)oc_state_borders_fill_caps(&_enc->state,refi,pli);
+  _enc->state.ntotal_coded_fragis=_enc->state.nfrags;
+  return 0;
+}
+
+
+
+/*Cost information about a MB mode.*/
+struct oc_mode_choice{
+  unsigned      cost;
+  unsigned      ssd;
+  unsigned      rate;
+  unsigned      overhead;
+  unsigned char qii[12];
+};
+
+
+
 static void oc_mode_set_cost(oc_mode_choice *_modec,int _lambda){
-  _modec->cost=_modec->ssd+(_modec->rate+_modec->overhead)*_lambda;
+  _modec->cost=OC_MODE_RD_COST(_modec->ssd,
+   _modec->rate+_modec->overhead,_lambda);
 }
 
-static void oc_cost_intra(oc_enc_ctx *_enc,oc_mode_choice *_modec,
- int _mbi,int _qi){
+/*A set of skip SSD's to use to disable early skipping.*/
+static const unsigned OC_NOSKIP[12]={
+  UINT_MAX,UINT_MAX,UINT_MAX,UINT_MAX,
+  UINT_MAX,UINT_MAX,UINT_MAX,UINT_MAX,
+  UINT_MAX,UINT_MAX,UINT_MAX,UINT_MAX
+};
+
+/*The estimated number of bits used by a coded chroma block to specify the AC
+   quantizer.
+  TODO: Currently this is just 0.5*log2(3) (estimating about 50% compression);
+   we should measure it.*/
+#define OC_CHROMA_QII_RATE ((0xCAE00D1DU>>31-OC_BIT_SCALE)+1>>1)
+
+static void oc_analyze_mb_mode_luma(oc_enc_ctx *_enc,
+ oc_mode_choice *_modec,const oc_fr_state *_fr,const oc_qii_state *_qs,
+ const unsigned _frag_satd[12],const unsigned _skip_ssd[12],int _qti){
+  oc_fr_state  fr;
+  oc_qii_state qs;
+  unsigned     ssd;
+  unsigned     rate;
+  int          overhead;
+  unsigned     satd;
+  unsigned     best_cost;
+  unsigned     best_ssd;
+  unsigned     best_rate;
+  int          best_overhead;
+  int          best_fri;
+  int          best_qii;
+  unsigned     cur_cost;
+  unsigned     cur_ssd;
+  unsigned     cur_rate;
+  int          cur_overhead;
+  int          lambda;
+  int          nqis;
+  int          nskipped;
+  int          bi;
+  int          qii;
+  lambda=_enc->lambda;
+  nqis=_enc->state.nqis;
+  /*We could do a trellis optimization here, but we don't make final skip
+     decisions until after transform+quantization, so the result wouldn't be
+     optimal anyway.
+    Instead we just use a greedy approach; for most SATD values, the
+     differences between the qiis are large enough to drown out the cost to
+     code the flags, anyway.*/
+  *&fr=*_fr;
+  *&qs=*_qs;
+  ssd=rate=overhead=nskipped=0;
+  for(bi=0;bi<4;bi++){
+    oc_fr_state  ft[2];
+    oc_qii_state qt[3];
+    satd=_frag_satd[bi];
+    *(ft+0)=*&fr;
+    oc_fr_code_block(ft+0);
+    oc_qii_state_advance(qt+0,&qs,0);
+    best_overhead=(ft[0].bits-fr.bits<<OC_BIT_SCALE);
+    best_rate=oc_dct_cost2(&best_ssd,_enc->state.qis[0],0,_qti,satd)
+     +(qt[0].bits-qs.bits<<OC_BIT_SCALE);
+    best_cost=OC_MODE_RD_COST(ssd+best_ssd,rate+best_rate+best_overhead,lambda);
+    best_fri=0;
+    best_qii=0;
+    for(qii=1;qii<nqis;qii++){
+      oc_qii_state_advance(qt+qii,&qs,qii);
+      cur_rate=oc_dct_cost2(&cur_ssd,_enc->state.qis[qii],0,_qti,satd)
+       +(qt[qii].bits-qs.bits<<OC_BIT_SCALE);
+      cur_cost=OC_MODE_RD_COST(ssd+cur_ssd,rate+cur_rate+best_overhead,lambda);
+      if(cur_cost<best_cost){
+        best_cost=cur_cost;
+        best_ssd=cur_ssd;
+        best_rate=cur_rate;
+        best_qii=qii;
+      }
+    }
+    if(_skip_ssd[bi]<UINT_MAX&&nskipped<3){
+      *(ft+1)=*&fr;
+      oc_fr_skip_block(ft+1);
+      cur_overhead=ft[1].bits-fr.bits<<OC_BIT_SCALE;
+      cur_ssd=_skip_ssd[bi]<<OC_BIT_SCALE;
+      cur_cost=OC_MODE_RD_COST(ssd+cur_ssd,rate+cur_overhead,lambda);
+      if(cur_cost<=best_cost){
+        best_cost=cur_cost;
+        best_ssd=cur_ssd;
+        best_rate=0;
+        best_overhead=cur_overhead;
+        best_fri=1;
+        best_qii+=4;
+      }
+    }
+    rate+=best_rate;
+    ssd+=best_ssd;
+    overhead+=best_overhead;
+    *&fr=*(ft+best_fri);
+    if(best_fri==0)*&qs=*(qt+best_qii);
+    else nskipped++;
+    _modec->qii[bi]=best_qii;
+  }
+  _modec->ssd=ssd;
+  _modec->rate=rate;
+  _modec->overhead=OC_MAXI(overhead,0);
+}
+
+static void oc_analyze_mb_mode_chroma(oc_enc_ctx *_enc,
+ oc_mode_choice *_modec,const oc_fr_state *_fr,const oc_qii_state *_qs,
+ const unsigned _frag_satd[12],const unsigned _skip_ssd[12],int _qti){
+  unsigned ssd;
+  unsigned rate;
+  unsigned satd;
+  unsigned best_cost;
+  unsigned best_ssd;
+  unsigned best_rate;
+  int      best_qii;
+  unsigned cur_cost;
+  unsigned cur_ssd;
+  unsigned cur_rate;
+  int      lambda;
+  int      nblocks;
+  int      nqis;
+  int      pli;
+  int      bi;
+  int      qii;
+  lambda=_enc->lambda;
+  nqis=_enc->state.nqis;
+  ssd=_modec->ssd;
+  rate=_modec->rate;
+  /*Because (except in 4:4:4 mode) we aren't considering chroma blocks in coded
+     order, we assume a constant overhead for coded block and qii flags.*/
+  nblocks=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
+  nblocks=(nblocks-4>>1)+4;
+  bi=4;
+  for(pli=1;pli<3;pli++){
+    for(;bi<nblocks;bi++){
+      satd=_frag_satd[bi];
+      best_rate=oc_dct_cost2(&best_ssd,_enc->state.qis[0],pli,_qti,satd)
+       +OC_CHROMA_QII_RATE;
+      best_cost=OC_MODE_RD_COST(ssd+best_ssd,rate+best_rate,lambda);
+      best_qii=0;
+      for(qii=1;qii<nqis;qii++){
+        cur_rate=oc_dct_cost2(&cur_ssd,_enc->state.qis[qii],0,_qti,satd)
+         +OC_CHROMA_QII_RATE;
+        cur_cost=OC_MODE_RD_COST(ssd+cur_ssd,rate+cur_rate,lambda);
+        if(cur_cost<best_cost){
+          best_cost=cur_cost;
+          best_ssd=cur_ssd;
+          best_rate=cur_rate;
+          best_qii=qii;
+        }
+      }
+      if(_skip_ssd[bi]<UINT_MAX){
+        cur_cost=_skip_ssd[bi];
+        if(cur_cost<=best_cost){
+          best_cost=cur_cost;
+          best_ssd=cur_cost<<OC_BIT_SCALE;
+          best_rate=0;
+          best_qii+=4;
+        }
+      }
+      rate+=best_rate;
+      ssd+=best_ssd;
+      _modec->qii[bi]=best_qii;
+    }
+    nblocks=(nblocks-4<<1)+4;
+  }
+  _modec->ssd=ssd;
+  _modec->rate=rate;
+}
+
+static void oc_skip_cost(oc_enc_ctx *_enc,oc_enc_pipeline_state *_pipe,
+ unsigned _mbi,unsigned _ssd[12]){
+  OC_ALIGN16(ogg_int16_t  buffer[64]);
+  const unsigned char    *src;
+  const unsigned char    *ref;
+  int                     ystride;
+  const oc_fragment      *frags;
+  const ptrdiff_t        *frag_buf_offs;
+  const ptrdiff_t        *sb_map;
+  const oc_mb_map_plane  *mb_map;
+  const unsigned char    *map_idxs;
+  int                     map_nidxs;
+  ogg_int64_t             mask;
+  unsigned                uncoded_ssd;
+  int                     uncoded_dc;
+  unsigned                dc_dequant;
+  int                     dc_flag;
+  int                     mapii;
+  int                     mapi;
+  int                     pli;
+  int                     bi;
+  ptrdiff_t               fragi;
+  ptrdiff_t               frag_offs;
+  int                     borderi;
+  int                     pi;
+  src=_enc->state.ref_frame_data[OC_FRAME_IO];
+  ref=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_PREV]];
+  ystride=_enc->state.ref_ystride[0];
+  frags=_enc->state.frags;
+  frag_buf_offs=_enc->state.frag_buf_offs;
+  sb_map=_enc->state.sb_maps[_mbi>>2][_mbi&3];
+  dc_dequant=_enc->state.dequant_tables[_enc->state.qis[0]][0][1][0];
+  for(bi=0;bi<4;bi++){
+    fragi=sb_map[bi];
+    frag_offs=frag_buf_offs[fragi];
+    oc_enc_frag_sub(_enc,buffer,src+frag_offs,ref+frag_offs,ystride);
+    borderi=frags[fragi].borderi;
+    uncoded_ssd=uncoded_dc=0;
+    if(borderi<0){
+      for(pi=0;pi<64;pi++){
+        uncoded_ssd+=buffer[pi]*buffer[pi];
+        uncoded_dc+=buffer[pi];
+      }
+    }
+    else{
+      ogg_int64_t mask;
+      mask=_enc->state.borders[borderi].mask;
+      for(pi=0;pi<64;pi++,mask>>=1)if(mask&1){
+        uncoded_ssd+=buffer[pi]*buffer[pi];
+        uncoded_dc+=buffer[pi];
+      }
+    }
+    /*Scale to match DCT domain.*/
+    uncoded_ssd<<=4;
+    /*We actually only want the AC contribution to the SSD.*/
+    uncoded_ssd-=uncoded_dc*uncoded_dc>>2;
+    /*DC is a special case; if there's more than a full-quantizer improvement
+       in the effective DC component, always force-code the block.*/
+    dc_flag=abs(uncoded_dc)>dc_dequant<<1;
+    uncoded_ssd|=-dc_flag;
+    _pipe->skip_ssd[0][fragi-_pipe->froffset[0]]=_ssd[bi]=uncoded_ssd;
+  }
+  mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
+  map_nidxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
+  map_idxs=OC_MB_MAP_IDXS[_enc->state.info.pixel_fmt];
+  map_nidxs=(map_nidxs-4>>1)+4;
+  mapii=4;
+  for(pli=1;pli<3;pli++){
+    ystride=_enc->state.ref_ystride[pli];
+    dc_dequant=_enc->state.dequant_tables[_enc->state.qis[0]][pli][1][0];
+    for(;mapii<map_nidxs;mapii++){
+      mapi=map_idxs[mapii];
+      bi=mapi&3;
+      fragi=mb_map[pli][bi];
+      frag_offs=frag_buf_offs[fragi];
+      oc_enc_frag_sub(_enc,buffer,src+frag_offs,ref+frag_offs,ystride);
+      borderi=frags[fragi].borderi;
+      uncoded_ssd=uncoded_dc=0;
+      if(borderi<0){
+        for(pi=0;pi<64;pi++){
+          uncoded_ssd+=buffer[pi]*buffer[pi];
+          uncoded_dc+=buffer[pi];
+        }
+      }
+      else{
+        mask=_enc->state.borders[borderi].mask;
+        for(pi=0;pi<64;pi++,mask>>=1)if(mask&1){
+          uncoded_ssd+=buffer[pi]*buffer[pi];
+          uncoded_dc+=buffer[pi];
+        }
+      }
+      /*Scale to match DCT domain.*/
+      uncoded_ssd<<=4;
+      /*We actually only want the AC contribution to the SSD.*/
+      uncoded_ssd-=uncoded_dc*uncoded_dc>>2;
+      /*DC is a special case; if there's more than a full-quantizer improvement
+         in the effective DC component, always force-code the block.*/
+      dc_flag=abs(uncoded_dc)>dc_dequant<<1;
+      uncoded_ssd|=-dc_flag;
+      _pipe->skip_ssd[pli][fragi-_pipe->froffset[pli]]=_ssd[mapii]=uncoded_ssd;
+    }
+    map_nidxs=(map_nidxs-4<<1)+4;
+  }
+}
+
+static void oc_mb_intra_satd(oc_enc_ctx *_enc,unsigned _mbi,
+ unsigned _frag_satd[12]){
   const unsigned char   *src;
   const ptrdiff_t       *frag_buf_offs;
+  const ptrdiff_t       *sb_map;
   const oc_mb_map_plane *mb_map;
   const unsigned char   *map_idxs;
   int                    map_nidxs;
@@ -976,16 +1613,15 @@
   ptrdiff_t              fragi;
   ptrdiff_t              frag_offs;
   frag_buf_offs=_enc->state.frag_buf_offs;
-  mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
+  sb_map=_enc->state.sb_maps[_mbi>>2][_mbi&3];
   src=_enc->state.ref_frame_data[OC_FRAME_IO];
-  _modec->rate=_modec->ssd=0;
   ystride=_enc->state.ref_ystride[0];
   for(bi=0;bi<4;bi++){
-    fragi=mb_map[0][bi];
+    fragi=sb_map[bi];
     frag_offs=frag_buf_offs[fragi];
-    oc_mode_dct_cost_accum(_modec,_qi,0,0,
-     oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride));
+    _frag_satd[bi]=oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride);
   }
+  mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
   map_idxs=OC_MB_MAP_IDXS[_enc->state.info.pixel_fmt];
   map_nidxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
   /*Note: This assumes ref_ystride[1]==ref_ystride[2].*/
@@ -996,20 +1632,29 @@
     bi=mapi&3;
     fragi=mb_map[pli][bi];
     frag_offs=frag_buf_offs[fragi];
-    oc_mode_dct_cost_accum(_modec,_qi,pli,0,
-     oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride));
+    _frag_satd[mapii]=oc_enc_frag_intra_satd(_enc,src+frag_offs,ystride);
   }
-  _modec->overhead=
+}
+
+static void oc_cost_intra(oc_enc_ctx *_enc,oc_mode_choice *_modec,
+ unsigned _mbi,const oc_fr_state *_fr,const oc_qii_state *_qs,
+ const unsigned _frag_satd[12],const unsigned _skip_ssd[12]){
+  oc_analyze_mb_mode_luma(_enc,_modec,_fr,_qs,_frag_satd,_skip_ssd,0);
+  oc_analyze_mb_mode_chroma(_enc,_modec,_fr,_qs,_frag_satd,_skip_ssd,0);
+  _modec->overhead+=
    oc_mode_scheme_chooser_cost(&_enc->chooser,OC_MODE_INTRA)<<OC_BIT_SCALE;
   oc_mode_set_cost(_modec,_enc->lambda);
 }
 
 static void oc_cost_inter(oc_enc_ctx *_enc,oc_mode_choice *_modec,
- int _mbi,int _mb_mode,const signed char *_mv,int _qi){
+ unsigned _mbi,int _mb_mode,const signed char *_mv,
+ const oc_fr_state *_fr,const oc_qii_state *_qs,const unsigned _skip_ssd[12]){
+  unsigned               frag_satd[12];
   const unsigned char   *src;
   const unsigned char   *ref;
   int                    ystride;
   const ptrdiff_t       *frag_buf_offs;
+  const ptrdiff_t       *sb_map;
   const oc_mb_map_plane *mb_map;
   const unsigned char   *map_idxs;
   int                    map_nidxs;
@@ -1027,28 +1672,27 @@
    _enc->state.ref_frame_idx[OC_FRAME_FOR_MODE[_mb_mode]]];
   ystride=_enc->state.ref_ystride[0];
   frag_buf_offs=_enc->state.frag_buf_offs;
-  mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
+  sb_map=_enc->state.sb_maps[_mbi>>2][_mbi&3];
   dx=_mv[0];
   dy=_mv[1];
   _modec->rate=_modec->ssd=0;
   if(oc_state_get_mv_offsets(&_enc->state,mv_offs,0,dx,dy)>1){
     for(bi=0;bi<4;bi++){
-      fragi=mb_map[0][bi];
+      fragi=sb_map[bi];
       frag_offs=frag_buf_offs[fragi];
-      oc_mode_dct_cost_accum(_modec,_qi,0,1,oc_enc_frag_satd2_thresh(_enc,
-       src+frag_offs,ref+frag_offs+mv_offs[0],ref+frag_offs+mv_offs[1],ystride,
-       UINT_MAX));
+      frag_satd[bi]=oc_enc_frag_satd2_thresh(_enc,src+frag_offs,
+       ref+frag_offs+mv_offs[0],ref+frag_offs+mv_offs[1],ystride,UINT_MAX);
     }
   }
   else{
     for(bi=0;bi<4;bi++){
-      fragi=mb_map[0][bi];
+      fragi=sb_map[bi];
       frag_offs=frag_buf_offs[fragi];
-      oc_mode_dct_cost_accum(_modec,_qi,0,1,
-       oc_enc_frag_satd_thresh(_enc,src+frag_offs,
-       ref+frag_offs+mv_offs[0],ystride,UINT_MAX));
+      frag_satd[bi]=oc_enc_frag_satd_thresh(_enc,src+frag_offs,
+       ref+frag_offs+mv_offs[0],ystride,UINT_MAX);
     }
   }
+  mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
   map_idxs=OC_MB_MAP_IDXS[_enc->state.info.pixel_fmt];
   map_nidxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
   /*Note: This assumes ref_ystride[1]==ref_ystride[2].*/
@@ -1060,9 +1704,8 @@
       bi=mapi&3;
       fragi=mb_map[pli][bi];
       frag_offs=frag_buf_offs[fragi];
-      oc_mode_dct_cost_accum(_modec,_qi,pli,1,oc_enc_frag_satd2_thresh(_enc,
-       src+frag_offs,ref+frag_offs+mv_offs[0],ref+frag_offs+mv_offs[1],ystride,
-       UINT_MAX));
+      frag_satd[mapii]=oc_enc_frag_satd2_thresh(_enc,src+frag_offs,
+       ref+frag_offs+mv_offs[0],ref+frag_offs+mv_offs[1],ystride,UINT_MAX);
     }
   }
   else{
@@ -1072,25 +1715,29 @@
       bi=mapi&3;
       fragi=mb_map[pli][bi];
       frag_offs=frag_buf_offs[fragi];
-      oc_mode_dct_cost_accum(_modec,_qi,pli,1,oc_enc_frag_satd_thresh(_enc,
-       src+frag_offs,ref+frag_offs+mv_offs[0],ystride,UINT_MAX));
+      frag_satd[mapii]=oc_enc_frag_satd_thresh(_enc,src+frag_offs,
+       ref+frag_offs+mv_offs[0],ystride,UINT_MAX);
     }
   }
-  _modec->overhead=
+  oc_analyze_mb_mode_luma(_enc,_modec,_fr,_qs,frag_satd,_skip_ssd,1);
+  oc_analyze_mb_mode_chroma(_enc,_modec,_fr,_qs,frag_satd,_skip_ssd,1);
+  _modec->overhead+=
    oc_mode_scheme_chooser_cost(&_enc->chooser,_mb_mode)<<OC_BIT_SCALE;
   oc_mode_set_cost(_modec,_enc->lambda);
 }
 
 static void oc_cost_inter_nomv(oc_enc_ctx *_enc,oc_mode_choice *_modec,
- int _mbi,int _mb_mode,int _qi){
+ unsigned _mbi,int _mb_mode,const oc_fr_state *_fr,const oc_qii_state *_qs,
+ const unsigned _skip_ssd[12]){
   static const oc_mv OC_MV_ZERO;
-  oc_cost_inter(_enc,_modec,_mbi,_mb_mode,OC_MV_ZERO,_qi);
+  oc_cost_inter(_enc,_modec,_mbi,_mb_mode,OC_MV_ZERO,_fr,_qs,_skip_ssd);
 }
 
 static int oc_cost_inter1mv(oc_enc_ctx *_enc,oc_mode_choice *_modec,
- int _mbi,int _mb_mode,const signed char *_mv,int _qi){
+ unsigned _mbi,int _mb_mode,const signed char *_mv,
+ const oc_fr_state *_fr,const oc_qii_state *_qs,const unsigned _skip_ssd[12]){
   int bits0;
-  oc_cost_inter(_enc,_modec,_mbi,_mb_mode,_mv,_qi);
+  oc_cost_inter(_enc,_modec,_mbi,_mb_mode,_mv,_fr,_qs,_skip_ssd);
   bits0=OC_MV_BITS[0][_mv[0]+31]+OC_MV_BITS[0][_mv[1]+31];
   _modec->overhead+=OC_MINI(_enc->mv_bits[0]+bits0,_enc->mv_bits[1]+12)
    -OC_MINI(_enc->mv_bits[0],_enc->mv_bits[1])<<OC_BIT_SCALE;
@@ -1098,8 +1745,15 @@
   return bits0;
 }
 
-static int oc_cost_inter4mv(oc_enc_ctx *_enc,oc_mode_choice *_modec,int _mbi,
- oc_mv _mv[4],int _qi){
+/*A mapping from oc_mb_map (raster) ordering to oc_sb_map (Hilbert) ordering.*/
+static const unsigned char OC_MB_PHASE[4][4]={
+  {0,1,3,2},{0,3,1,2},{0,3,1,2},{2,3,1,0}
+};
+
+static void oc_cost_inter4mv(oc_enc_ctx *_enc,oc_mode_choice *_modec,
+ unsigned _mbi,oc_mv _mv[4],const oc_fr_state *_fr,const oc_qii_state *_qs,
+ const unsigned _skip_ssd[12]){
+  unsigned               frag_satd[12];
   oc_mv                  cbmvs[4];
   const unsigned char   *src;
   const unsigned char   *ref;
@@ -1109,6 +1763,7 @@
   const oc_mb_map_plane *mb_map;
   const unsigned char   *map_idxs;
   int                    map_nidxs;
+  int                    nqis;
   int                    mapii;
   int                    mapi;
   int                    mv_offs[2];
@@ -1119,6 +1774,7 @@
   ptrdiff_t              fragi;
   ptrdiff_t              frag_offs;
   int                    bits0;
+  int                    bits1;
   unsigned               satd;
   src=_enc->state.ref_frame_data[OC_FRAME_IO];
   ref=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_PREV]];
@@ -1127,7 +1783,6 @@
   frag_mvs=_enc->state.frag_mvs;
   mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
   _modec->rate=_modec->ssd=0;
-  bits0=0;
   for(bi=0;bi<4;bi++){
     fragi=mb_map[0][bi];
     dx=_mv[bi][0];
@@ -1137,7 +1792,6 @@
     frag_mvs[fragi][0]=(signed char)dx;
     frag_mvs[fragi][1]=(signed char)dy;
     frag_offs=frag_buf_offs[fragi];
-    bits0+=OC_MV_BITS[0][dx+31]+OC_MV_BITS[0][dy+31];
     if(oc_state_get_mv_offsets(&_enc->state,mv_offs,0,dx,dy)>1){
       satd=oc_enc_frag_satd2_thresh(_enc,src+frag_offs,
        ref+frag_offs+mv_offs[0],ref+frag_offs+mv_offs[1],ystride,UINT_MAX);
@@ -1146,10 +1800,26 @@
       satd=oc_enc_frag_satd_thresh(_enc,src+frag_offs,
        ref+frag_offs+mv_offs[0],ystride,UINT_MAX);
     }
-    oc_mode_dct_cost_accum(_modec,_qi,0,1,satd);
+    frag_satd[OC_MB_PHASE[_mbi&3][bi]]=satd;
   }
+  oc_analyze_mb_mode_luma(_enc,_modec,_fr,_qs,frag_satd,
+   _enc->vp3_compatible?OC_NOSKIP:_skip_ssd,1);
+  /*Figure out which blocks are being skipped and give them (0,0) MVs.*/
+  bits0=0;
+  bits1=0;
+  nqis=_enc->state.nqis;
+  for(bi=0;bi<4;bi++){
+    if(_modec->qii[OC_MB_PHASE[_mbi&3][bi]]>=nqis){
+      memset(cbmvs+bi,0,sizeof(*cbmvs));
+    }
+    else{
+      memcpy(cbmvs+bi,_mv+bi,sizeof(*cbmvs));
+      bits0+=OC_MV_BITS[0][_mv[bi][0]+31]+OC_MV_BITS[0][_mv[bi][1]+31];
+      bits1+=12;
+    }
+  }
   (*OC_SET_CHROMA_MVS_TABLE[_enc->state.info.pixel_fmt])(cbmvs,
-   (const oc_mv *)_mv);
+   (const oc_mv *)cbmvs);
   map_idxs=OC_MB_MAP_IDXS[_enc->state.info.pixel_fmt];
   map_nidxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
   /*Note: This assumes ref_ystride[1]==ref_ystride[2].*/
@@ -1172,19 +1842,20 @@
       satd=oc_enc_frag_satd_thresh(_enc,src+frag_offs,
        ref+frag_offs+mv_offs[0],ystride,UINT_MAX);
     }
-    oc_mode_dct_cost_accum(_modec,_qi,pli,1,satd);
+    frag_satd[mapii]=satd;
   }
-  _modec->overhead=oc_mode_scheme_chooser_cost(&_enc->chooser,
-   OC_MODE_INTER_MV_FOUR)+OC_MINI(_enc->mv_bits[0]+bits0,_enc->mv_bits[1]+48)
+  oc_analyze_mb_mode_chroma(_enc,_modec,_fr,_qs,frag_satd,_skip_ssd,1);
+  _modec->overhead+=
+   oc_mode_scheme_chooser_cost(&_enc->chooser,OC_MODE_INTER_MV_FOUR)
+   +OC_MINI(_enc->mv_bits[0]+bits0,_enc->mv_bits[1]+bits1)
    -OC_MINI(_enc->mv_bits[0],_enc->mv_bits[1])<<OC_BIT_SCALE;
   oc_mode_set_cost(_modec,_enc->lambda);
-  return bits0;
 }
 
 int oc_enc_analyze(oc_enc_ctx *_enc,int _frame_type,int _recode){
   oc_set_chroma_mvs_func  set_chroma_mvs;
-  oc_mcenc_ctx            mcenc;
   oc_enc_pipeline_state   pipe;
+  oc_qii_state            intra_luma_qs;
   oc_mv                   last_mv;
   oc_mv                   prior_mv;
   ogg_int64_t             interbits;
@@ -1197,12 +1868,14 @@
   size_t                  nuncoded_mbis;
   oc_sb_flags            *sb_flags;
   signed char            *mb_modes;
+  const oc_sb_map        *sb_maps;
   const oc_mb_map        *mb_maps;
   oc_mb_enc_info         *embs;
   oc_fragment            *frags;
   oc_mv                  *frag_mvs;
   int                     qi;
   unsigned                stripe_sby;
+  unsigned                mcu_nvsbs;
   int                     notstart;
   int                     notdone;
   int                     vdec;
@@ -1210,12 +1883,13 @@
   unsigned                sbi_end;
   int                     refi;
   int                     pli;
+  if(_frame_type==OC_INTRA_FRAME)return oc_enc_analyze_intra(_enc,_recode);
   set_chroma_mvs=OC_SET_CHROMA_MVS_TABLE[_enc->state.info.pixel_fmt];
   _enc->state.frame_type=_frame_type;
-  if(!_recode&&_enc->state.curframe_num>0)oc_mcenc_start(_enc,&mcenc);
   oc_mode_scheme_chooser_reset(&_enc->chooser);
   oc_enc_tokenize_start(_enc);
   oc_enc_pipeline_init(_enc,&pipe);
+  oc_qii_state_init(&intra_luma_qs);
   _enc->mv_bits[0]=_enc->mv_bits[1]=0;
   interbits=intrabits=0;
   last_mv[0]=last_mv[1]=prior_mv[0]=prior_mv[1]=0;
@@ -1233,241 +1907,237 @@
   _enc->state.ncoded_fragis[2]=0;
   sb_flags=_enc->state.sb_flags;
   mb_modes=_enc->state.mb_modes;
+  sb_maps=(const oc_sb_map *)_enc->state.sb_maps;
   mb_maps=(const oc_mb_map *)_enc->state.mb_maps;
   embs=_enc->mb_info;
   frags=_enc->state.frags;
   frag_mvs=_enc->state.frag_mvs;
-  sbi_end=_enc->state.fplanes[0].nsbs;
   vdec=!(_enc->state.info.pixel_fmt&2);
   notstart=0;
   notdone=1;
-  for(stripe_sby=0;notdone;stripe_sby+=pipe.mcu_nvsbs){
-    const oc_fragment_plane *fplane;
-    int                      sby_end;
-    fplane=_enc->state.fplanes+0;
-    pipe.fragy0[0]=stripe_sby<<2;
-    sby_end=fplane->nvsbs;
-    notdone=stripe_sby+pipe.mcu_nvsbs<sby_end;
-    if(notdone){
-      sby_end=stripe_sby+pipe.mcu_nvsbs;
-      pipe.fragy_end[0]=sby_end<<2;
-    }
-    else pipe.fragy_end[0]=fplane->nvfrags;
-    sbi=stripe_sby*fplane->nhsbs;
-    sbi_end=sby_end*fplane->nhsbs;
-    for(;sbi<sbi_end;sbi++){
+  mcu_nvsbs=_enc->mcu_nvsbs;
+  for(stripe_sby=0;notdone;stripe_sby+=mcu_nvsbs){
+    notdone=oc_enc_pipeline_set_stripe(_enc,&pipe,stripe_sby);
+    sbi_end=pipe.sbi_end[0];
+    for(sbi=pipe.sbi0[0];sbi<sbi_end;sbi++){
       int quadi;
       /*Mode addressing is through Y plane, always 4 MB per SB.*/
       for(quadi=0;quadi<4;quadi++)if(sb_flags[sbi].quad_valid&1<<quadi){
-        unsigned  mbi;
-        int       mb_mode;
-        int       dx;
-        int       dy;
-        int       mapii;
-        int       mapi;
-        int       bi;
-        ptrdiff_t fragi;
+        oc_mode_choice modes[8];
+        unsigned       skip_ssd[12];
+        unsigned       intra_satd[12];
+        int            mb_mv_bits_0;
+        int            mb_gmv_bits_0;
+        int            inter_mv_pref;
+        int            mb_mode;
+        int            dx;
+        int            dy;
+        unsigned       mbi;
+        int            mapii;
+        int            mapi;
+        int            bi;
+        ptrdiff_t      fragi;
         mbi=sbi<<2|quadi;
-        if(!_recode&&_enc->state.curframe_num>0){
-          /*Motion estimation:
-            We always do a basic 1MV search for all macroblocks, coded or not,
-             keyframe or not.*/
-          /*Move the motion vector predictors back a frame.*/
-          memmove(embs[mbi].analysis_mv+1,
-           embs[mbi].analysis_mv,2*sizeof(embs[mbi].analysis_mv[0]));
-          /*Search the last frame.*/
-          oc_mcenc_search(_enc,&mcenc,mbi,OC_FRAME_PREV);
-          /*Search the golden frame.*/
-          oc_mcenc_search(_enc,&mcenc,mbi,OC_FRAME_GOLD);
-        }
+        /*Motion estimation:
+          We always do a basic 1MV search for all macroblocks, coded or not,
+           keyframe or not.*/
+        if(!_recode)oc_mcenc_search(_enc,mbi);
         dx=dy=0;
-        if(_enc->state.frame_type==OC_INTRA_FRAME){
-          mb_modes[mbi]=mb_mode=OC_MODE_INTRA;
-          oc_enc_mb_transform_quantize_luma(_enc,&pipe,mbi,0);
+        /*Find the block choice with the lowest estimated coding cost.
+          If a Cb or Cr block is coded but no Y' block from a macro block then
+           the mode MUST be OC_MODE_INTER_NOMV.
+          This is the default state to which the mode data structure is
+           initialised in encoder and decoder at the start of each frame.*/
+        /*Block coding cost is estimated from correlated SATD metrics.*/
+        /*At this point, all blocks that are in frame are still marked coded.*/
+        if(!_recode){
+          memcpy(embs[mbi].unref_mv,
+           embs[mbi].analysis_mv[0],sizeof(embs[mbi].unref_mv));
+          embs[mbi].refined=0;
         }
-        else{
-          oc_mode_choice modes[8];
-          int            mb_mv_bits_0;
-          int            mb_gmv_bits_0;
-          int            mb_4mv_bits_0;
-          int            mb_4mv_bits_1;
-          int            inter_mv_pref;
-          /*Find the block choice with the lowest estimated coding cost.
-            If a Cb or Cr block is coded but no Y' block from a macro block then
-             the mode MUST be OC_MODE_INTER_NOMV.
-            This is the default state to which the mode data structure is
-             initialised in encoder and decoder at the start of each frame.*/
-          /*Block coding cost is estimated from correlated SATD metrics.*/
-          /*At this point, all blocks that are in frame are still marked coded.*/
-          if(!_recode){
-            memcpy(embs[mbi].unref_mv,
-             embs[mbi].analysis_mv[0],sizeof(embs[mbi].unref_mv));
-            embs[mbi].refined=0;
+        oc_mb_intra_satd(_enc,mbi,intra_satd);
+        /*Estimate the cost of coding this MB in a keyframe.*/
+        oc_cost_intra(_enc,modes+OC_MODE_INTRA,mbi,
+         pipe.fr+0,&intra_luma_qs,intra_satd,OC_NOSKIP);
+        intrabits+=modes[OC_MODE_INTRA].rate;
+        for(bi=0;bi<4;bi++){
+          oc_qii_state_advance(&intra_luma_qs,&intra_luma_qs,
+           modes[OC_MODE_INTRA].qii[bi]);
+        }
+        /*Estimate the cost in a delta frame for various modes.*/
+        oc_skip_cost(_enc,&pipe,mbi,skip_ssd);
+        oc_cost_inter_nomv(_enc,modes+OC_MODE_INTER_NOMV,mbi,
+         OC_MODE_INTER_NOMV,pipe.fr+0,pipe.qs+0,skip_ssd);
+        oc_cost_intra(_enc,modes+OC_MODE_INTRA,mbi,
+         pipe.fr+0,pipe.qs+0,intra_satd,skip_ssd);
+        mb_mv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_INTER_MV,mbi,
+         OC_MODE_INTER_MV,embs[mbi].unref_mv[OC_FRAME_PREV],
+         pipe.fr+0,pipe.qs+0,skip_ssd);
+        oc_cost_inter(_enc,modes+OC_MODE_INTER_MV_LAST,mbi,
+         OC_MODE_INTER_MV_LAST,last_mv,pipe.fr+0,pipe.qs+0,skip_ssd);
+        oc_cost_inter(_enc,modes+OC_MODE_INTER_MV_LAST2,mbi,
+         OC_MODE_INTER_MV_LAST2,prior_mv,pipe.fr+0,pipe.qs+0,skip_ssd);
+        oc_cost_inter_nomv(_enc,modes+OC_MODE_GOLDEN_NOMV,mbi,
+         OC_MODE_GOLDEN_NOMV,pipe.fr+0,pipe.qs+0,skip_ssd);
+        mb_gmv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_GOLDEN_MV,mbi,
+         OC_MODE_GOLDEN_MV,embs[mbi].unref_mv[OC_FRAME_GOLD],
+         pipe.fr+0,pipe.qs+0,skip_ssd);
+        oc_cost_inter4mv(_enc,modes+OC_MODE_INTER_MV_FOUR,mbi,
+         embs[mbi].block_mv,pipe.fr+0,pipe.qs+0,skip_ssd);
+        /*The explicit MV modes (2,6,7) have not yet gone through halfpel
+           refinement.
+          We choose the explicit MV mode that's already furthest ahead on bits
+           and refine only that one.
+          We have to be careful to remember which ones we've refined so that
+           we don't refine it again if we re-encode this frame.*/
+        inter_mv_pref=_enc->lambda*3;
+        if(modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_INTER_MV].cost&&
+         modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_GOLDEN_MV].cost){
+          if(!(embs[mbi].refined&0x80)){
+            oc_mcenc_refine4mv(_enc,mbi);
+            embs[mbi].refined|=0x80;
           }
-          oc_cost_inter_nomv(_enc,modes+OC_MODE_INTER_NOMV,mbi,OC_MODE_INTER_NOMV,qi);
-          oc_cost_intra(_enc,modes+OC_MODE_INTRA,mbi,qi);
-          intrabits+=modes[OC_MODE_INTRA].rate;
-          mb_mv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_INTER_MV,mbi,
-           OC_MODE_INTER_MV,embs[mbi].unref_mv[OC_FRAME_PREV],qi);
-          oc_cost_inter(_enc,modes+OC_MODE_INTER_MV_LAST,mbi,
-           OC_MODE_INTER_MV_LAST,last_mv,qi);
-          oc_cost_inter(_enc,modes+OC_MODE_INTER_MV_LAST2,mbi,
-           OC_MODE_INTER_MV_LAST2,prior_mv,qi);
-          oc_cost_inter_nomv(_enc,modes+OC_MODE_GOLDEN_NOMV,mbi,
-           OC_MODE_GOLDEN_NOMV,qi);
+          oc_cost_inter4mv(_enc,modes+OC_MODE_INTER_MV_FOUR,mbi,
+           embs[mbi].ref_mv,pipe.fr+0,pipe.qs+0,skip_ssd);
+        }
+        else if(modes[OC_MODE_GOLDEN_MV].cost+inter_mv_pref<
+         modes[OC_MODE_INTER_MV].cost){
+          if(!(embs[mbi].refined&0x40)){
+            oc_mcenc_refine1mv(_enc,mbi,OC_FRAME_GOLD);
+            embs[mbi].refined|=0x40;
+          }
           mb_gmv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_GOLDEN_MV,mbi,
-           OC_MODE_GOLDEN_MV,embs[mbi].unref_mv[OC_FRAME_GOLD],qi);
-          mb_4mv_bits_0=oc_cost_inter4mv(_enc,modes+OC_MODE_INTER_MV_FOUR,mbi,
-           embs[mbi].block_mv,qi);
-          mb_4mv_bits_1=48;
-          /*The explicit MV modes (2,6,7) have not yet gone through halfpel
-             refinement.
-            We choose the explicit MV mode that's already furthest ahead on bits
-             and refine only that one.
-            We have to be careful to remember which ones we've refined so that
-             we don't refine it again if we re-encode this frame.*/
-          inter_mv_pref=_enc->lambda*3<<OC_BIT_SCALE;
-          if(modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_INTER_MV].cost&&
-           modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_GOLDEN_MV].cost){
-            if(!(embs[mbi].refined&0x80)){
-              oc_mcenc_refine4mv(_enc,mbi);
-              embs[mbi].refined|=0x80;
-            }
-            mb_4mv_bits_0=oc_cost_inter4mv(_enc,modes+OC_MODE_INTER_MV_FOUR,mbi,
-             embs[mbi].ref_mv,qi);
+           OC_MODE_GOLDEN_MV,embs[mbi].analysis_mv[0][OC_FRAME_GOLD],
+           pipe.fr+0,pipe.qs+0,skip_ssd);
+        }
+        if(!(embs[mbi].refined&0x04)){
+          oc_mcenc_refine1mv(_enc,mbi,OC_FRAME_PREV);
+          embs[mbi].refined|=0x04;
+        }
+        mb_mv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_INTER_MV,mbi,
+         OC_MODE_INTER_MV,embs[mbi].analysis_mv[0][OC_FRAME_PREV],
+         pipe.fr+0,pipe.qs+0,skip_ssd);
+        /*Finally, pick the mode with the cheapest estimated R-D cost.*/
+        mb_mode=0;
+        if(modes[1].cost<modes[0].cost)mb_mode=1;
+        if(modes[3].cost<modes[mb_mode].cost)mb_mode=3;
+        if(modes[4].cost<modes[mb_mode].cost)mb_mode=4;
+        if(modes[5].cost<modes[mb_mode].cost)mb_mode=5;
+        if(modes[6].cost<modes[mb_mode].cost)mb_mode=6;
+        if(modes[7].cost<modes[mb_mode].cost)mb_mode=7;
+        /*We prefer OC_MODE_INTER_MV, but not over LAST and LAST2.*/
+        if(mb_mode==OC_MODE_INTER_MV_LAST||mb_mode==OC_MODE_INTER_MV_LAST2){
+          inter_mv_pref=0;
+        }
+        if(modes[2].cost<modes[mb_mode].cost+inter_mv_pref)mb_mode=2;
+        mb_modes[mbi]=mb_mode;
+        /*Propagate the MVs to the luma blocks.*/
+        if(mb_mode!=OC_MODE_INTER_MV_FOUR){
+          switch(mb_mode){
+            case OC_MODE_INTER_MV:{
+              dx=embs[mbi].analysis_mv[0][OC_FRAME_PREV][0];
+              dy=embs[mbi].analysis_mv[0][OC_FRAME_PREV][1];
+            }break;
+            case OC_MODE_INTER_MV_LAST:{
+              dx=last_mv[0];
+              dy=last_mv[1];
+            }break;
+            case OC_MODE_INTER_MV_LAST2:{
+              dx=prior_mv[0];
+              dy=prior_mv[1];
+            }break;
+            case OC_MODE_GOLDEN_MV:{
+              dx=embs[mbi].analysis_mv[0][OC_FRAME_GOLD][0];
+              dy=embs[mbi].analysis_mv[0][OC_FRAME_GOLD][1];
+            }break;
           }
-          else if(modes[OC_MODE_GOLDEN_MV].cost+inter_mv_pref<
-           modes[OC_MODE_INTER_MV].cost){
-            if(!(embs[mbi].refined&0x40)){
-              oc_mcenc_refine1mv(_enc,mbi,OC_FRAME_GOLD);
-              embs[mbi].refined|=0x40;
-            }
-            mb_gmv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_GOLDEN_MV,mbi,
-             OC_MODE_GOLDEN_MV,embs[mbi].analysis_mv[0][OC_FRAME_GOLD],qi);
+          for(bi=0;bi<4;bi++){
+            fragi=mb_maps[mbi][0][bi];
+            frag_mvs[fragi][0]=(signed char)dx;
+            frag_mvs[fragi][1]=(signed char)dy;
           }
-          if(!(embs[mbi].refined&0x04)){
-            oc_mcenc_refine1mv(_enc,mbi,OC_FRAME_PREV);
-            embs[mbi].refined|=0x04;
-          }
-          mb_mv_bits_0=oc_cost_inter1mv(_enc,modes+OC_MODE_INTER_MV,mbi,
-           OC_MODE_INTER_MV,embs[mbi].analysis_mv[0][OC_FRAME_PREV],qi);
-          /*Finally, pick the mode with the cheapest estimated bit cost.*/
-          mb_mode=0;
-          if(modes[1].cost<modes[0].cost)mb_mode=1;
-          if(modes[3].cost<modes[mb_mode].cost)mb_mode=3;
-          if(modes[4].cost<modes[mb_mode].cost)mb_mode=4;
-          if(modes[5].cost<modes[mb_mode].cost)mb_mode=5;
-          if(modes[6].cost<modes[mb_mode].cost)mb_mode=6;
-          if(modes[7].cost<modes[mb_mode].cost)mb_mode=7;
-          /*We prefer OC_MODE_INTER_MV, but not over LAST and LAST2.*/
-          if(mb_mode==OC_MODE_INTER_MV_LAST||mb_mode==OC_MODE_INTER_MV_LAST2){
-            inter_mv_pref=0;
-          }
-          if(modes[2].cost<modes[mb_mode].cost+inter_mv_pref)mb_mode=2;
-          mb_modes[mbi]=mb_mode;
-          /*Propagate the MVs to the luma blocks.*/
-          if(mb_mode!=OC_MODE_INTER_MV_FOUR){
-            switch(mb_mode){
-              case OC_MODE_INTER_MV:{
-                dx=embs[mbi].analysis_mv[0][OC_FRAME_PREV][0];
-                dy=embs[mbi].analysis_mv[0][OC_FRAME_PREV][1];
-              }break;
-              case OC_MODE_INTER_MV_LAST:{
-                dx=last_mv[0];
-                dy=last_mv[1];
-              }break;
-              case OC_MODE_INTER_MV_LAST2:{
-                dx=prior_mv[0];
-                dy=prior_mv[1];
-              }break;
-              case OC_MODE_GOLDEN_MV:{
-                dx=embs[mbi].analysis_mv[0][OC_FRAME_GOLD][0];
-                dy=embs[mbi].analysis_mv[0][OC_FRAME_GOLD][1];
-              }break;
-            }
-            for(bi=0;bi<4;bi++){
-              fragi=mb_maps[mbi][0][bi];
-              frag_mvs[fragi][0]=(signed char)dx;
-              frag_mvs[fragi][1]=(signed char)dy;
-            }
-          }
-          if(oc_enc_mb_transform_quantize_luma(_enc,&pipe,mbi,
-           modes[mb_mode].overhead)>0){
-            int orig_mb_mode;
-            orig_mb_mode=mb_mode;
-            mb_mode=mb_modes[mbi];
-            switch(mb_mode){
-              case OC_MODE_INTER_MV:{
-                memcpy(prior_mv,last_mv,sizeof(prior_mv));
-                /*If we're backing out from 4MV, find the MV we're actually
-                   using.*/
-                if(orig_mb_mode==OC_MODE_INTER_MV_FOUR){
-                  for(bi=0;;bi++){
-                    fragi=mb_maps[mbi][0][bi];
-                    if(frags[fragi].coded){
-                      memcpy(last_mv,frag_mvs[fragi],sizeof(last_mv));
-                      dx=frag_mvs[fragi][0];
-                      dy=frag_mvs[fragi][1];
-                      break;
-                    }
-                  }
-                  mb_mv_bits_0=OC_MV_BITS[0][dx+31]+OC_MV_BITS[0][dy+31];
-                }
-                /*Otherwise we used the original analysis MV.*/
-                else{
-                  memcpy(last_mv,
-                   embs[mbi].analysis_mv[0][OC_FRAME_PREV],sizeof(last_mv));
-                }
-                _enc->mv_bits[0]+=mb_mv_bits_0;
-                _enc->mv_bits[1]+=12;
-              }break;
-              case OC_MODE_INTER_MV_LAST2:{
-                oc_mv tmp_mv;
-                memcpy(tmp_mv,prior_mv,sizeof(tmp_mv));
-                memcpy(prior_mv,last_mv,sizeof(prior_mv));
-                memcpy(last_mv,tmp_mv,sizeof(last_mv));
-              }break;
-              case OC_MODE_GOLDEN_MV:{
-                _enc->mv_bits[0]+=mb_gmv_bits_0;
-                _enc->mv_bits[1]+=12;
-              }break;
-              case OC_MODE_INTER_MV_FOUR:{
-                oc_mv lbmvs[4];
-                oc_mv cbmvs[4];
-                memcpy(prior_mv,last_mv,sizeof(prior_mv));
-                for(bi=0;bi<4;bi++){
+        }
+        for(bi=0;bi<4;bi++){
+          fragi=sb_maps[mbi>>2][mbi&3][bi];
+          frags[fragi].qii=modes[mb_mode].qii[bi];
+        }
+        if(oc_enc_mb_transform_quantize_luma(_enc,&pipe,mbi,
+         modes[mb_mode].overhead>>OC_BIT_SCALE)>0){
+          int orig_mb_mode;
+          orig_mb_mode=mb_mode;
+          mb_mode=mb_modes[mbi];
+          switch(mb_mode){
+            case OC_MODE_INTER_MV:{
+              memcpy(prior_mv,last_mv,sizeof(prior_mv));
+              /*If we're backing out from 4MV, find the MV we're actually
+                 using.*/
+              if(orig_mb_mode==OC_MODE_INTER_MV_FOUR){
+                for(bi=0;;bi++){
                   fragi=mb_maps[mbi][0][bi];
                   if(frags[fragi].coded){
                     memcpy(last_mv,frag_mvs[fragi],sizeof(last_mv));
-                    memcpy(lbmvs[bi],frag_mvs[fragi],sizeof(lbmvs[bi]));
-                    _enc->mv_bits[0]+=OC_MV_BITS[0][frag_mvs[fragi][0]+31]
-                     +OC_MV_BITS[0][frag_mvs[fragi][1]+31];
-                    _enc->mv_bits[1]+=12;
+                    dx=frag_mvs[fragi][0];
+                    dy=frag_mvs[fragi][1];
+                    break;
                   }
-                  /*Replace the block MVs for not-coded blocks with (0,0).*/
-                  else memset(lbmvs[bi],0,sizeof(lbmvs[bi]));
                 }
-                (*set_chroma_mvs)(cbmvs,(const oc_mv *)lbmvs);
-                for(mapii=4;mapii<nmap_idxs;mapii++){
-                  mapi=map_idxs[mapii];
-                  pli=mapi>>2;
-                  bi=mapi&3;
-                  fragi=mb_maps[mbi][pli][bi];
-                  frags[fragi].mb_mode=mb_mode;
-                  memcpy(frag_mvs[fragi],cbmvs[bi],sizeof(frag_mvs[fragi]));
+                mb_mv_bits_0=OC_MV_BITS[0][dx+31]+OC_MV_BITS[0][dy+31];
+              }
+              /*Otherwise we used the original analysis MV.*/
+              else{
+                memcpy(last_mv,
+                 embs[mbi].analysis_mv[0][OC_FRAME_PREV],sizeof(last_mv));
+              }
+              _enc->mv_bits[0]+=mb_mv_bits_0;
+              _enc->mv_bits[1]+=12;
+            }break;
+            case OC_MODE_INTER_MV_LAST2:{
+              oc_mv tmp_mv;
+              memcpy(tmp_mv,prior_mv,sizeof(tmp_mv));
+              memcpy(prior_mv,last_mv,sizeof(prior_mv));
+              memcpy(last_mv,tmp_mv,sizeof(last_mv));
+            }break;
+            case OC_MODE_GOLDEN_MV:{
+              _enc->mv_bits[0]+=mb_gmv_bits_0;
+              _enc->mv_bits[1]+=12;
+            }break;
+            case OC_MODE_INTER_MV_FOUR:{
+              oc_mv lbmvs[4];
+              oc_mv cbmvs[4];
+              memcpy(prior_mv,last_mv,sizeof(prior_mv));
+              for(bi=0;bi<4;bi++){
+                fragi=mb_maps[mbi][0][bi];
+                if(frags[fragi].coded){
+                  memcpy(last_mv,frag_mvs[fragi],sizeof(last_mv));
+                  memcpy(lbmvs[bi],frag_mvs[fragi],sizeof(lbmvs[bi]));
+                  _enc->mv_bits[0]+=OC_MV_BITS[0][frag_mvs[fragi][0]+31]
+                   +OC_MV_BITS[0][frag_mvs[fragi][1]+31];
+                  _enc->mv_bits[1]+=12;
                 }
-              }break;
-            }
-            coded_mbis[ncoded_mbis++]=mbi;
-            oc_mode_scheme_chooser_update(&_enc->chooser,mb_mode);
-            interbits+=modes[mb_mode].rate+modes[mb_mode].overhead;
+                /*Replace the block MVs for not-coded blocks with (0,0).*/
+                else memset(lbmvs[bi],0,sizeof(lbmvs[bi]));
+              }
+              (*set_chroma_mvs)(cbmvs,(const oc_mv *)lbmvs);
+              for(mapii=4;mapii<nmap_idxs;mapii++){
+                mapi=map_idxs[mapii];
+                pli=mapi>>2;
+                bi=mapi&3;
+                fragi=mb_maps[mbi][pli][bi];
+                frags[fragi].mb_mode=mb_mode;
+                frags[fragi].qii=modes[OC_MODE_INTER_MV_FOUR].qii[mapii];
+                memcpy(frag_mvs[fragi],cbmvs[bi],sizeof(frag_mvs[fragi]));
+              }
+            }break;
           }
-          else{
-            *(uncoded_mbis-++nuncoded_mbis)=mbi;
-            mb_mode=OC_MODE_INTER_NOMV;
-            dx=dy=0;
-          }
+          coded_mbis[ncoded_mbis++]=mbi;
+          oc_mode_scheme_chooser_update(&_enc->chooser,mb_mode);
+          interbits+=modes[mb_mode].rate+modes[mb_mode].overhead;
         }
+        else{
+          *(uncoded_mbis-++nuncoded_mbis)=mbi;
+          mb_mode=OC_MODE_INTER_NOMV;
+          dx=dy=0;
+        }
         /*Propagate final MB mode and MVs to the chroma blocks.
           This has already been done for 4MV mode, since it requires individual
            block motion vectors.*/
@@ -1478,30 +2148,24 @@
             bi=mapi&3;
             fragi=mb_maps[mbi][pli][bi];
             frags[fragi].mb_mode=mb_mode;
+            /*If we switched from 4MV mode to INTER_MV mode, then the qii
+               values won't have been chosen with the right MV, but it's
+               probaby not worth re-estimating them.*/
+            frags[fragi].qii=modes[mb_mode].qii[mapii];
             frag_mvs[fragi][0]=(signed char)dx;
             frag_mvs[fragi][1]=(signed char)dy;
           }
         }
       }
-      oc_fr_finish_sb(pipe.fr+0);
-      sb_flags[sbi].coded_fully=pipe.fr[0].sb_full_last;
-      sb_flags[sbi].coded_partially=pipe.fr[0].sb_partial_last;
+      oc_fr_state_flush_sb(pipe.fr+0);
+      sb_flags[sbi].coded_fully=pipe.fr[0].sb_full;
+      sb_flags[sbi].coded_partially=pipe.fr[0].sb_partial;
     }
     oc_enc_pipeline_finish_mcu_plane(_enc,&pipe,0,notstart,notdone);
     /*Code chroma planes.*/
     for(pli=1;pli<3;pli++){
-      fplane=_enc->state.fplanes+pli;
-      sbi=fplane->sboffset+(stripe_sby>>vdec)*fplane->nhsbs;
-      pipe.fragy0[pli]=stripe_sby<<2-vdec;
-      if(notdone){
-        sbi_end=sbi+(sby_end-stripe_sby>>vdec)*fplane->nhsbs;
-        pipe.fragy_end[pli]=sby_end<<2-vdec;
-      }
-      else{
-        sbi_end=fplane->sboffset+fplane->nsbs;
-        pipe.fragy_end[pli]=fplane->nvfrags;
-      }
-      oc_enc_sb_transform_quantize_chroma(_enc,&pipe,pli,sbi,sbi_end);
+      oc_enc_sb_transform_quantize_chroma(_enc,&pipe,
+       pli,pipe.sbi0[pli],pipe.sbi_end[pli]);
       oc_enc_pipeline_finish_mcu_plane(_enc,&pipe,pli,notstart,notdone);
     }
     notstart=1;
@@ -1516,10 +2180,7 @@
     /*Technically the chroma plane counts are over-estimations, because they
        don't account for continuing runs from the luma planes, but the
        inaccuracy is small.*/
-    for(pli=0;pli<3;pli++){
-      oc_fr_flush(pipe.fr+pli);
-      interbits+=pipe.fr[pli].bits<<OC_BIT_SCALE;
-    }
+    for(pli=0;pli<3;pli++)interbits+=pipe.fr[pli].bits<<OC_BIT_SCALE;
     interbits+=OC_MINI(_enc->mv_bits[0],_enc->mv_bits[1])<<OC_BIT_SCALE;
     interbits+=
      _enc->chooser.scheme_bits[_enc->chooser.scheme_list[0]]<<OC_BIT_SCALE;
@@ -1545,6 +2206,9 @@
 # include <stdio.h>
 # include <math.h>
 
+/*TODO: It may be helpful (for block-level quantizers especially) to separate
+   out the contributions from AC and DC into separate tables.*/
+
 # define OC_ZWEIGHT   (0.25)
 # define OC_BIN(_satd) (OC_MINI((_satd)>>OC_SAD_SHIFT,OC_SAD_BINS-1))
 
@@ -1688,6 +2352,7 @@
   ptrdiff_t          fragii;
   double             fragw;
   int                qti;
+  int                qii;
   int                qi;
   int                pli;
   int                zzi;
@@ -1707,7 +2372,6 @@
     oc_has_mode_metrics=1;
   }
   qti=_enc->state.frame_type;
-  qi=_enc->state.qis[0];
   frags=_enc->state.frags;
   frag_satd=_enc->frag_satd;
   frag_ssd=_enc->frag_ssd;
@@ -1718,8 +2382,8 @@
   fragw=1.0/_enc->state.nfrags;
   for(pli=0;pli<3;pli++){
     ptrdiff_t ti[64];
-    int       eob_runs[64];
-    int       eob_rem[64];
+    int       eob_token[64];
+    int       eob_run[64];
     /*Set up token indices and eob run counts.
       We don't bother trying to figure out the real cost of the runs that span
        coefficients; instead we use the costs that were available when R-D
@@ -1729,11 +2393,14 @@
       if(ti[zzi]>0){
         token=_enc->dct_tokens[pli][zzi][0];
         eb=_enc->extra_bits[pli][zzi][0];
-        eob_runs[zzi]=-oc_dct_token_skip(token,eb);
+        eob_token[zzi]=token;
+        eob_run[zzi]=-oc_dct_token_skip(token,eb);
       }
-      else eob_runs[zzi]=0;
+      else{
+        eob_token[zzi]=OC_NDCT_EOB_TOKEN_MAX;
+        eob_run[zzi]=0;
+      }
     }
-    memcpy(eob_rem,eob_runs,sizeof(eob_rem));
     /*Scan the list of coded fragments for this plane.*/
     ncoded_fragis+=_enc->state.ncoded_fragis[pli];
     for(;fragii<ncoded_fragis;fragii++){
@@ -1747,25 +2414,28 @@
       fragi=coded_fragis[fragii];
       frag_bits=0;
       for(zzi=0;zzi<64;){
-        if(eob_rem[zzi]>0){
+        if(eob_run[zzi]>0){
           /*We've reached the end of the block.*/
-          eob_rem[zzi]--;
+          eob_run[zzi]--;
           break;
         }
         huffi=_enc->huff_idxs[qti][zzi>0][pli+1>>1]
          +OC_ZZI_HUFF_OFFSET[zzi];
-        if(eob_runs[zzi]>0){
+        if(eob_token[zzi]<OC_NDCT_EOB_TOKEN_MAX){
           /*This token caused an EOB run to be flushed.
             Therefore it gets the bits associated with it.*/
-          frag_bits+=_enc->huff_codes[huffi][token].nbits
-           +OC_DCT_TOKEN_EXTRA_BITS[token];
-          eob_runs[zzi]=0;
+          frag_bits+=_enc->huff_codes[huffi][eob_token[zzi]].nbits
+           +OC_DCT_TOKEN_EXTRA_BITS[eob_token[zzi]];
+          eob_token[zzi]=OC_NDCT_EOB_TOKEN_MAX;
         }
         token=_enc->dct_tokens[pli][zzi][ti[zzi]];
         eb=_enc->extra_bits[pli][zzi][ti[zzi]];
         ti[zzi]++;
         skip=oc_dct_token_skip(token,eb);
-        if(skip<0)eob_runs[zzi]=eob_rem[zzi]=-skip;
+        if(skip<0){
+          eob_token[zzi]=token;
+          eob_run[zzi]=-skip;
+        }
         else{
           /*A regular DCT value token; accumulate the bits for it.*/
           frag_bits+=_enc->huff_codes[huffi][token].nbits
@@ -1774,6 +2444,7 @@
         }
       }
       mb_mode=frags[fragi].mb_mode;
+      qi=_enc->state.qis[frags[fragi].qii];
       satd=frag_satd[fragi];
       bin=OC_MINI(satd>>OC_SAD_SHIFT,OC_SAD_BINS-1);
       oc_mode_metrics_add(OC_MODE_METRICS[qi][pli][mb_mode!=OC_MODE_INTRA]+bin,
@@ -1781,7 +2452,9 @@
     }
   }
   /*Update global SATD/rate/RMSE estimation matrix.*/
-  oc_enc_mode_metrics_update(_enc,qi);
+  for(qii=0;qii<_enc->state.nqis;qii++){
+    oc_enc_mode_metrics_update(_enc,_enc->state.qis[qii]);
+  }
 }
 
 void oc_enc_mode_metrics_dump(oc_enc_ctx *_enc){

Modified: branches/theora-gumboot/lib/enc/encapiwrapper.c
===================================================================
--- branches/theora-gumboot/lib/enc/encapiwrapper.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/encapiwrapper.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -42,6 +42,7 @@
 int theora_encode_init(theora_state *_te,theora_info *_ci){
   th_api_info *apiinfo;
   th_info      info;
+  ogg_uint32_t keyframe_frequency_force;
   /*Allocate our own combined API wrapper/theora_info struct.
     We put them both in one malloc'd block so that when the API wrapper is
      freed, the info struct goes with it.
@@ -64,6 +65,12 @@
   _te->granulepos=0;
   _te->i=&apiinfo->info;
   _te->i->codec_setup=&apiinfo->api;
+  /*Set the precise requested keyframe frequency.*/
+  keyframe_frequency_force=_ci->keyframe_auto_p?
+   _ci->keyframe_frequency_force:_ci->keyframe_frequency;
+  th_encode_ctl(apiinfo->api.encode,
+   TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE,
+   &keyframe_frequency_force,sizeof(keyframe_frequency_force));
   /*TODO: Additional codec setup using the extra fields in theora_info.*/
   return 0;
 }

Modified: branches/theora-gumboot/lib/enc/encfrag.c
===================================================================
--- branches/theora-gumboot/lib/enc/encfrag.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/encfrag.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -356,7 +356,7 @@
 unsigned oc_enc_frag_intra_satd_c(const unsigned char *_src,int _ystride){
   ogg_int16_t buf[64];
   oc_intra_hadamard(buf,_src,_ystride);
-  return oc_hadamard_sad_thresh(buf,0xFF000)
+  return oc_hadamard_sad_thresh(buf,UINT_MAX)
    -abs(buf[0]+buf[1]+buf[2]+buf[3]+buf[4]+buf[5]+buf[6]+buf[7]);
 }
 

Modified: branches/theora-gumboot/lib/enc/encint.h
===================================================================
--- branches/theora-gumboot/lib/enc/encint.h	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/encint.h	2009-07-23 00:51:02 UTC (rev 16320)
@@ -29,8 +29,9 @@
 
 
 
+typedef oc_mv                         oc_mv2[2];
+
 typedef struct oc_enc_opt_vtable      oc_enc_opt_vtable;
-typedef struct oc_mcenc_ctx           oc_mcenc_ctx;
 typedef struct oc_mb_enc_info         oc_mb_enc_info;
 typedef struct oc_mode_scheme_chooser oc_mode_scheme_chooser;
 typedef struct oc_rc_state            oc_rc_state;
@@ -116,7 +117,7 @@
      can be used to estimate constant velocity and constant acceleration
      predictors.
     Uninitialized MVs are (0,0).*/
-  oc_mv         analysis_mv[3][2]; /* [cur,prev,prev2][frame,golden] */
+  oc_mv2        analysis_mv[3];
   /*Current unrefined analysis MVs.*/
   oc_mv         unref_mv[2];
   /*Unrefined block MVs.*/
@@ -151,7 +152,7 @@
   /*The list of mode coding schemes, sorted in ascending order of bit cost.*/
   unsigned char        scheme_list[8];
   /*The number of bits used by each mode coding scheme.*/
-  int                  scheme_bits[8];
+  ptrdiff_t            scheme_bits[8];
 };
 
 
@@ -193,8 +194,8 @@
 
 void oc_enc_calc_lambda(oc_enc_ctx *_enc,int _frame_type);
 void oc_rc_state_init(oc_rc_state *_rc,const oc_enc_ctx *_enc);
-void oc_enc_update_rc_state(oc_enc_ctx *_enc,
- long _bits,int _qti,int _qi,int _trial);
+int oc_enc_update_rc_state(oc_enc_ctx *_enc,
+ long _bits,int _qti,int _qi,int _trial,int _droppable);
 int oc_enc_select_qi(oc_enc_ctx *_enc,int _qti,int _clamp);
 
 
@@ -230,6 +231,8 @@
   unsigned char            vp3_compatible;
   /*Whether or not any INTER frames have been coded.*/
   unsigned char            coded_inter_frame;
+  /*Whether or not previous frame was dropped.*/
+  unsigned char            prevframe_dropped;
   /*Stores most recently chosen Huffman tables for each frame type, DC and AC
      coefficients, and luma and chroma tokens.
     The actual Huffman table used for a given coefficient depends not only on
@@ -239,6 +242,10 @@
   size_t                   mv_bits[2];
   /*The mode scheme chooser for estimating mode coding costs.*/
   oc_mode_scheme_chooser   chooser;
+  /*The number of vertical super blocks in an MCU.*/
+  int                      mcu_nvsbs;
+  /*The SSD error for skipping each fragment in the current MCU.*/
+  unsigned                *mcu_skip_ssd;
   /*The DCT token lists for each coefficient and each plane.*/
   unsigned char          **dct_tokens[3];
   /*The extra bits associated with each DCT token.*/
@@ -287,25 +294,8 @@
 
 
 
-/*Temporary state used for motion estimation.*/
-struct oc_mcenc_ctx{
-  /*The candidate motion vectors.*/
-  int                candidates[12][2];
-  /*The start of the Set B candidates.*/
-  int                setb0;
-  /*The total number of candidates.*/
-  int                ncandidates;
-  /*Accelerated predictor weights for each frame type.*/
-  ogg_int32_t        mvapw1[2];
-  ogg_int32_t        mvapw2[2];
-};
-
-
-/*Prep the motion search for the next frame.*/
-void oc_mcenc_start(oc_enc_ctx *_enc,oc_mcenc_ctx *_mcenc);
-
-/*Search for a single MB MV (and with OC_FRAME_PREV, block MVs) in one frame.*/
-void oc_mcenc_search(oc_enc_ctx *_enc,oc_mcenc_ctx *_mcenc,int _mbi,int _frame);
+/*Perform fullpel motion search for a single MB against both reference frames.*/
+void oc_mcenc_search(oc_enc_ctx *_enc,int _mbi);
 /*Refine a MB MV for one frame.*/
 void oc_mcenc_refine1mv(oc_enc_ctx *_enc,int _mbi,int _frame);
 /*Refine the block MVs.*/

Modified: branches/theora-gumboot/lib/enc/encode.c
===================================================================
--- branches/theora-gumboot/lib/enc/encode.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/encode.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -27,24 +27,24 @@
 static const int OC_VP31_RANGE_SIZES[1]={63};
 static const th_quant_base OC_VP31_BASES_INTRA_Y[2]={
   {
-     16, 11, 10, 16, 24,  40, 51, 61,
-     12, 12, 14, 19, 26,  58, 60, 55,
-     14, 13, 16, 24, 40,  57, 69, 56,
-     14, 17, 22, 29, 51,  87, 80, 62,
-     18, 22, 37, 58, 68, 109,103, 77,
-     24, 35, 55, 64, 81, 104,113, 92,
-     49, 64, 78, 87,103, 121,120,101,
-     72, 92, 95, 98,112, 100,103, 99
+     16, 11, 10, 16, 24, 40, 51, 61,
+     12, 12, 14, 19, 26, 58, 60, 55,
+     14, 13, 16, 24, 40, 57, 69, 56,
+     14, 17, 22, 29, 51, 87, 80, 62,
+     18, 22, 37, 58, 68,109,103, 77,
+     24, 35, 55, 64, 81,104,113, 92,
+     49, 64, 78, 87,103,121,120,101,
+     72, 92, 95, 98,112,100,103, 99
   },
   {
-     16, 11, 10, 16, 24,  40, 51, 61,
-     12, 12, 14, 19, 26,  58, 60, 55,
-     14, 13, 16, 24, 40,  57, 69, 56,
-     14, 17, 22, 29, 51,  87, 80, 62,
-     18, 22, 37, 58, 68, 109,103, 77,
-     24, 35, 55, 64, 81, 104,113, 92,
-     49, 64, 78, 87,103, 121,120,101,
-     72, 92, 95, 98,112, 100,103, 99
+     16, 11, 10, 16, 24, 40, 51, 61,
+     12, 12, 14, 19, 26, 58, 60, 55,
+     14, 13, 16, 24, 40, 57, 69, 56,
+     14, 17, 22, 29, 51, 87, 80, 62,
+     18, 22, 37, 58, 68,109,103, 77,
+     24, 35, 55, 64, 81,104,113, 92,
+     49, 64, 78, 87,103,121,120,101,
+     72, 92, 95, 98,112,100,103, 99
   }
 };
 static const th_quant_base OC_VP31_BASES_INTRA_C[2]={
@@ -137,8 +137,182 @@
   }
 };
 
+/*The current default quantization parameters.*/
+static const int OC_DEF_QRANGE_SIZES[3]={32,16,15};
+static const th_quant_base OC_DEF_BASES_INTRA_Y[4]={
+  {
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+     15, 15, 15, 15, 15, 15, 15, 15,
+  },
+  {
+     15, 12, 12, 15, 18, 20, 20, 21,
+     13, 13, 14, 17, 18, 21, 21, 20,
+     14, 14, 15, 18, 20, 21, 21, 21,
+     14, 16, 17, 19, 20, 21, 21, 21,
+     16, 17, 20, 21, 21, 21, 21, 21,
+     18, 19, 20, 21, 21, 21, 21, 21,
+     20, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21
+  },
+  {
+     16, 12, 11, 16, 20, 25, 27, 28,
+     13, 13, 14, 18, 21, 28, 28, 27,
+     14, 13, 16, 20, 25, 28, 28, 28,
+     14, 16, 19, 22, 27, 29, 29, 28,
+     17, 19, 25, 28, 28, 30, 30, 29,
+     20, 24, 27, 28, 29, 30, 30, 29,
+     27, 28, 29, 29, 30, 30, 30, 30,
+     29, 29, 29, 29, 30, 30, 30, 29
+  },
+  {
+     16, 11, 10, 16, 24, 40, 51, 61,
+     12, 12, 14, 19, 26, 58, 60, 55,
+     14, 13, 16, 24, 40, 57, 69, 56,
+     14, 17, 22, 29, 51, 87, 80, 62,
+     18, 22, 37, 58, 68,109,103, 77,
+     24, 35, 55, 64, 81,104,113, 92,
+     49, 64, 78, 87,103,121,120,101,
+     72, 92, 95, 98,112,100,103, 99
+  }
+};
+static const th_quant_base OC_DEF_BASES_INTRA_C[4]={
+  {
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19,
+     19, 19, 19, 19, 19, 19, 19, 19
+  },
+  {
+     18, 18, 21, 25, 26, 26, 26, 26,
+     18, 20, 22, 26, 26, 26, 26, 26,
+     21, 22, 25, 26, 26, 26, 26, 26,
+     25, 26, 26, 26, 26, 26, 26, 26,
+     26, 26, 26, 26, 26, 26, 26, 26,
+     26, 26, 26, 26, 26, 26, 26, 26,
+     26, 26, 26, 26, 26, 26, 26, 26,
+     26, 26, 26, 26, 26, 26, 26, 26
+  },
+  {
+     17, 18, 22, 31, 36, 36, 36, 36,
+     18, 20, 24, 34, 36, 36, 36, 36,
+     22, 24, 33, 36, 36, 36, 36, 36,
+     31, 34, 36, 36, 36, 36, 36, 36,
+     36, 36, 36, 36, 36, 36, 36, 36,
+     36, 36, 36, 36, 36, 36, 36, 36,
+     36, 36, 36, 36, 36, 36, 36, 36,
+     36, 36, 36, 36, 36, 36, 36, 36
+  },
+  {
+     17, 18, 24, 47, 99, 99, 99, 99,
+     18, 21, 26, 66, 99, 99, 99, 99,
+     24, 26, 56, 99, 99, 99, 99, 99,
+     47, 66, 99, 99, 99, 99, 99, 99,
+     99, 99, 99, 99, 99, 99, 99, 99,
+     99, 99, 99, 99, 99, 99, 99, 99,
+     99, 99, 99, 99, 99, 99, 99, 99,
+     99, 99, 99, 99, 99, 99, 99, 99
+  }
+};
+static const th_quant_base OC_DEF_BASES_INTER[4]={
+  {
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21,
+     21, 21, 21, 21, 21, 21, 21, 21
+  },
+  {
+     18, 18, 18, 21, 23, 24, 25, 27,
+     18, 18, 21, 23, 24, 25, 27, 28,
+     18, 21, 23, 24, 25, 27, 28, 29,
+     21, 23, 24, 25, 27, 28, 29, 29,
+     23, 24, 25, 27, 28, 29, 29, 29,
+     24, 25, 27, 28, 29, 29, 29, 30,
+     25, 27, 28, 29, 29, 29, 30, 30,
+     27, 28, 29, 29, 29, 30, 30, 30
+  },
+  {
+     17, 17, 17, 20, 23, 26, 28, 32,
+     17, 17, 20, 23, 26, 28, 32, 34,
+     17, 20, 23, 26, 28, 32, 34, 37,
+     20, 23, 26, 28, 32, 34, 37, 37,
+     23, 26, 28, 32, 34, 37, 37, 37,
+     26, 28, 32, 34, 37, 37, 37, 41,
+     28, 32, 34, 37, 37, 37, 41, 42,
+     32, 34, 37, 37, 37, 41, 42, 42
+  },
+  {
+     16, 16, 16, 20, 24, 28, 32, 40,
+     16, 16, 20, 24, 28, 32, 40, 48,
+     16, 20, 24, 28, 32, 40, 48, 64,
+     20, 24, 28, 32, 40, 48, 64, 64,
+     24, 28, 32, 40, 48, 64, 64, 64,
+     28, 32, 40, 48, 64, 64, 64, 96,
+     32, 40, 48, 64, 64, 64, 96,128,
+     40, 48, 64, 64, 64, 96,128,128
+  }
+};
 
+const th_quant_info TH_DEF_QUANT_INFO={
+  {
+    365,348,333,316,300,287,277,265,
+    252,240,229,219,206,197,189,180,
+    171,168,160,153,146,139,132,127,
+    121,115,110,107,101, 97, 94, 89,
+     85, 83, 78, 73, 72, 67, 66, 62,
+     60, 59, 56, 53, 52, 48, 47, 43,
+     42, 40, 36, 35, 34, 33, 31, 30,
+     28, 25, 24, 22, 20, 17, 14, 10
+  },
+  {
+    365,348,333,316,300,287,277,265,
+    252,240,229,219,206,197,189,180,
+    171,168,160,153,146,139,132,127,
+    121,115,110,107,101, 97, 94, 89,
+     85, 83, 78, 73, 72, 67, 66, 62,
+     60, 59, 56, 53, 52, 48, 47, 43,
+     42, 40, 36, 35, 34, 33, 31, 30,
+     28, 25, 24, 22, 20, 17, 14, 10
+  },
+  {
+    30,25,20,20,15,15,14,14,
+    13,13,12,12,11,11,10,10,
+     9, 9, 8, 8, 7, 7, 7, 7,
+     6, 6, 6, 6, 5, 5, 5, 5,
+     4, 4, 4, 4, 3, 3, 3, 3,
+     2, 2, 2, 2, 2, 2, 2, 2,
+     0, 0, 0, 0, 0, 0, 0, 0,
+     0, 0, 0, 0, 0, 0, 0, 0
+  },
+  {
+    {
+      {3,OC_DEF_QRANGE_SIZES,OC_DEF_BASES_INTRA_Y},
+      {3,OC_DEF_QRANGE_SIZES,OC_DEF_BASES_INTRA_C},
+      {3,OC_DEF_QRANGE_SIZES,OC_DEF_BASES_INTRA_C}
+    },
+    {
+      {3,OC_DEF_QRANGE_SIZES,OC_DEF_BASES_INTER},
+      {3,OC_DEF_QRANGE_SIZES,OC_DEF_BASES_INTER},
+      {3,OC_DEF_QRANGE_SIZES,OC_DEF_BASES_INTER}
+    }
+  }
+};
 
+
+
 /*The Huffman codes used for macro block modes.*/
 
 const unsigned char OC_MODE_BITS[2][OC_NMODES]={
@@ -843,7 +1017,7 @@
   int qti;
   if(_enc==NULL)return TH_EFAULT;
   if(_enc->packet_state>OC_PACKET_SETUP_HDR)return TH_EINVAL;
-  if(_qinfo==NULL)_qinfo=&TH_VP31_QUANT_INFO;
+  if(_qinfo==NULL)_qinfo=&TH_DEF_QUANT_INFO;
   /*TODO: Analyze for packing purposes instead of just doing a shallow copy.*/
   memcpy(&_enc->qinfo,_qinfo,sizeof(_enc->qinfo));
   for(qi=0;qi<64;qi++)for(pli=0;pli<3;pli++)for(qti=0;qti<2;qti++){
@@ -861,9 +1035,13 @@
 }
 
 static int oc_enc_init(oc_enc_ctx *_enc,const th_info *_info){
-  th_info info;
-  int     ret;
-  int     pli;
+  th_info   info;
+  size_t    mcu_nmbs;
+  ptrdiff_t mcu_nfrags;
+  int       hdec;
+  int       vdec;
+  int       ret;
+  int       pli;
   /*Clean up the requested settings.*/
   memcpy(&info,_info,sizeof(info));
   info.version_major=TH_VERSION_MAJOR;
@@ -879,6 +1057,15 @@
   _enc->frag_dc=_ogg_calloc(_enc->state.nfrags,sizeof(*_enc->frag_dc));
   _enc->coded_mbis=
    (unsigned *)_ogg_malloc(_enc->state.nmbs*sizeof(*_enc->coded_mbis));
+  hdec=!(_enc->state.info.pixel_fmt&1);
+  vdec=!(_enc->state.info.pixel_fmt&1);
+  /*If chroma is sub-sampled in the vertical direction, we have to encode two
+     super block rows of Y' for each super block row of Cb and Cr.*/
+  _enc->mcu_nvsbs=1<<vdec;
+  mcu_nmbs=_enc->mcu_nvsbs*_enc->state.fplanes[0].nhsbs*(size_t)4;
+  mcu_nfrags=4*mcu_nmbs+(8*mcu_nmbs>>hdec+vdec);
+  _enc->mcu_skip_ssd=(unsigned *)_ogg_malloc(
+   mcu_nfrags*sizeof(*_enc->mcu_skip_ssd));
   for(pli=0;pli<3;pli++){
     _enc->dct_tokens[pli]=(unsigned char **)oc_malloc_2d(64,
      _enc->state.fplanes[pli].nfrags,sizeof(**_enc->dct_tokens));
@@ -930,12 +1117,22 @@
     oc_free_2d(_enc->extra_bits[pli]);
     oc_free_2d(_enc->dct_tokens[pli]);
   }
+  _ogg_free(_enc->mcu_skip_ssd);
   _ogg_free(_enc->coded_mbis);
   _ogg_free(_enc->frag_dc);
   _ogg_free(_enc->mb_info);
   oc_state_clear(&_enc->state);
 }
 
+static void oc_enc_drop_frame(th_enc_ctx *_enc){
+  /*Use the previous frame's reconstruction.*/
+  _enc->state.ref_frame_idx[OC_FRAME_SELF]=
+   _enc->state.ref_frame_idx[OC_FRAME_PREV];
+  /*Flag motion vector analysis about the frame drop.*/
+  _enc->prevframe_dropped=1;
+  /*Zero the packet.*/
+  oggpackB_reset(&_enc->opb);
+}
 
 static void oc_enc_compress_keyframe(oc_enc_ctx *_enc,int _recode){
   if(_enc->state.info.target_bitrate>0){
@@ -951,7 +1148,7 @@
   if(!_recode&&_enc->state.curframe_num==0){
     if(_enc->state.info.target_bitrate>0){
       oc_enc_update_rc_state(_enc,oggpackB_bytes(&_enc->opb)<<3,
-       OC_INTRA_FRAME,_enc->state.qis[0],1);
+                             OC_INTRA_FRAME,_enc->state.qis[0],1,0);
     }
     oc_enc_compress_keyframe(_enc,1);
   }
@@ -974,8 +1171,9 @@
          prime feed-forward statistics.*/
       _enc->coded_inter_frame=1;
       if(_enc->state.info.target_bitrate>0){
+        /*Rate control also needs to prime.*/
         oc_enc_update_rc_state(_enc,oggpackB_bytes(&_enc->opb)<<3,
-         OC_INTER_FRAME,_enc->state.qis[0],1);
+         OC_INTER_FRAME,_enc->state.qis[0],1,0);
       }
       oc_enc_compress_frame(_enc,1);
     }
@@ -1206,6 +1404,7 @@
   }
 }
 
+#include<stdio.h>
 int th_encode_ycbcr_in(th_enc_ctx *_enc,th_ycbcr_buffer _img){
   th_ycbcr_buffer img;
   int             cframe_width;
@@ -1218,6 +1417,7 @@
   int             vdec;
   int             pli;
   int             refi;
+  int             drop;
   /*Step 1: validate parameters.*/
   if(_enc==NULL||_img==NULL)return TH_EFAULT;
   if(_enc->packet_state==OC_PACKET_DONE)return TH_EINVAL;
@@ -1276,16 +1476,23 @@
    _enc->state.curframe_num-_enc->state.keyframe_num+_enc->dup_count>=
    _enc->keyframe_frequency_force){
     oc_enc_compress_keyframe(_enc,0);
+    drop=0;
   }
-  /*Compress the frame.*/
-  else oc_enc_compress_frame(_enc,0);
+  else{
+    oc_enc_compress_frame(_enc,0);
+    drop=1;
+  }
   oc_restore_fpu(&_enc->state);
-  /*Update state variables.*/
-  _enc->packet_state=OC_PACKET_READY;
+  /*drop currently indicates if the frame is droppable.*/
   if(_enc->state.info.target_bitrate>0){
-    oc_enc_update_rc_state(_enc,oggpackB_bytes(&_enc->opb)<<3,
-     _enc->state.frame_type,_enc->state.qis[0],0);
+    drop=oc_enc_update_rc_state(_enc,oggpackB_bytes(&_enc->opb)<<3,
+     _enc->state.frame_type,_enc->state.qis[0],0,drop);
   }
+  else drop=0;
+  /*drop now indicates if the frame was dropped.*/
+  if(drop)oc_enc_drop_frame(_enc);
+  else _enc->prevframe_dropped=0;
+  _enc->packet_state=OC_PACKET_READY;
   _enc->prev_dup_count=_enc->nqueued_dups=_enc->dup_count;
   _enc->dup_count=0;
 #if defined(OC_DUMP_IMAGES)
@@ -1315,8 +1522,9 @@
     }
   }
   else return 0;
+  _last_p=_last_p&&_enc->nqueued_dups<=0;
   _op->b_o_s=0;
-  _op->e_o_s=_last_p=_last_p&&_enc->nqueued_dups<=0;
+  _op->e_o_s=_last_p;
   oc_enc_set_granpos(_enc);
   _op->packetno=th_granule_frame(_enc,_enc->state.granpos)+3;
   _op->granulepos=_enc->state.granpos;

Modified: branches/theora-gumboot/lib/enc/enquant.c
===================================================================
--- branches/theora-gumboot/lib/enc/enquant.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/enquant.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -170,17 +170,6 @@
       oc_iquant_init(_enquant[qi][pli][qti]+zzi,
        _dequant[qi][pli][qti][zzi]);
     }
-    /*Now compute an "average" quantizer for each qi level.
-      We do one for INTER and one for INTRA, since their behavior is very
-       different, but average across chroma channels.
-      The basic approach is to compute a harmonic average of the squared
-       quantizer, weighted by the expected squared magnitude of the DCT
-       coefficients.
-      Under the (not quite true) assumption that DCT coefficients are
-       Laplacian-distributed, this preserves the product Q*lambda, where
-       lambda=sqrt(2/sigma**2) is the Laplacian distribution parameter.
-      The value Q*lambda completely determines the entropy of the
-       coefficients.*/
   }
 }
 
@@ -210,7 +199,7 @@
    mode is significantly flatter) and b) the DPCM prediction of the DC
    coefficient gives a very minor improvement in the INTRA case and a quite
    significant one in the INTER case (over the expected variance).*/
-static ogg_uint16_t OC_RPSD[2][64]={
+static const ogg_uint16_t OC_RPSD[2][64]={
   {
     52725,17370,10399, 6867, 5115, 3798, 2942, 2076,
     17370, 9900, 6948, 4994, 3836, 2869, 2229, 1619,
@@ -239,7 +228,7 @@
    quantization, over a large set of test video encoded at all possible rates.
   TODO: These values are only from INTER frames; it should be re-measured for
    INTRA frames.*/
-static ogg_uint16_t OC_PCD[4][3]={
+static const ogg_uint16_t OC_PCD[4][3]={
   {59926, 3038, 2572},
   {55201, 5597, 4738},
   {55201, 5597, 4738},
@@ -247,6 +236,17 @@
 };
 
 
+/*Compute an "average" quantizer for each qi level.
+  We do one for INTER and one for INTRA, since their behavior is very
+   different, but average across chroma channels.
+  The basic approach is to compute a harmonic average of the squared quantizer,
+   weighted by the expected squared magnitude of the DCT coefficients.
+  Under the (not quite true) assumption that DCT coefficients are
+   Laplacian-distributed, this preserves the product Q*lambda, where
+   lambda=sqrt(2/sigma**2) is the Laplacian distribution parameter (not to be
+   confused with the lambda used in R-D optimization throughout most of the
+   rest of the code).
+  The value Q*lambda completely determines the entropy of the coefficients.*/
 void oc_enquant_qavg_init(ogg_int64_t _log_qavg[2][64],
  ogg_uint16_t *_dequant[64][3][2],int _pixel_fmt){
   int qi;

Modified: branches/theora-gumboot/lib/enc/huffenc.c
===================================================================
--- branches/theora-gumboot/lib/enc/huffenc.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/huffenc.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -862,7 +862,7 @@
     for(j=1;j<TH_NDCT_TOKENS;j++){
       maxlen=OC_MAXI(_codes[i][j].nbits,maxlen);
     }
-    mask=(1<<maxlen)-1;
+    mask=(1<<(maxlen>>1)<<(maxlen+1>>1))-1;
     /*Copy over the codes into our temporary workspace.
       The bit patterns are aligned, and the original entry each code is from
        is stored as well.*/

Modified: branches/theora-gumboot/lib/enc/mcenc.c
===================================================================
--- branches/theora-gumboot/lib/enc/mcenc.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/mcenc.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -19,6 +19,24 @@
 #include <string.h>
 #include "encint.h"
 
+
+
+typedef struct oc_mcenc_ctx           oc_mcenc_ctx;
+
+
+
+/*Temporary state used for motion estimation.*/
+struct oc_mcenc_ctx{
+  /*The candidate motion vectors.*/
+  int                candidates[13][2];
+  /*The start of the Set B candidates.*/
+  int                setb0;
+  /*The total number of candidates.*/
+  int                ncandidates;
+};
+
+
+
 /*The maximum Y plane SAD value for accepting the median predictor.*/
 #define OC_YSAD_THRESH1            (256)
 /*The amount to right shift the minimum error by when inflating it for
@@ -70,84 +88,60 @@
 };
 
 
-void oc_mcenc_start(oc_enc_ctx *_enc,oc_mcenc_ctx *_mcenc){
-  ogg_int64_t nframes;
-  /*Set up the accelerated MV weights for previous frame prediction.*/
-  _mcenc->mvapw1[OC_FRAME_PREV]=(ogg_int32_t)1<<17;
-  _mcenc->mvapw2[OC_FRAME_PREV]=(ogg_int32_t)1<<16;
-  /*Set up the accelerated MV weights for golden frame prediction.*/
-  nframes=_enc->state.curframe_num-_enc->state.keyframe_num;
-  _mcenc->mvapw1[OC_FRAME_GOLD]=(ogg_int32_t)(
-   nframes!=1?(nframes<<17)/(nframes-1):0);
-  _mcenc->mvapw2[OC_FRAME_GOLD]=(ogg_int32_t)(
-   nframes!=2?(nframes<<16)/(nframes-2):0);
-}
-
 static void oc_mcenc_find_candidates(oc_enc_ctx *_enc,oc_mcenc_ctx *_mcenc,
- int _mbi,int _frame){
+ int _accum[2],int _mbi,int _frame){
   oc_mb_enc_info *embs;
-  ogg_int32_t     mvapw1;
-  ogg_int32_t     mvapw2;
   int             a[3][2];
   int             ncandidates;
   unsigned        nmbi;
   int             i;
   embs=_enc->mb_info;
+  /*Skip a position to store the median predictor in.*/
+  ncandidates=1;
   if(embs[_mbi].ncneighbors>0){
-    /*Fill in the first part of set A: the last motion vectors used and the
-       vectors from adjacent blocks.*/
-    /*Skip a position to store the median predictor in.*/
-    ncandidates=1;
+    /*Fill in the first part of set A: the vectors from adjacent blocks.*/
     for(i=0;i<embs[_mbi].ncneighbors;i++){
       nmbi=embs[_mbi].cneighbors[i];
       _mcenc->candidates[ncandidates][0]=embs[nmbi].analysis_mv[0][_frame][0];
       _mcenc->candidates[ncandidates][1]=embs[nmbi].analysis_mv[0][_frame][1];
       ncandidates++;
     }
-    /*Add a few additional vectors to set A: the vector used in the
-       previous frame and the (0,0) vector.*/
-    _mcenc->candidates[ncandidates][0]=embs[_mbi].analysis_mv[1][_frame][0];
-    _mcenc->candidates[ncandidates][1]=embs[_mbi].analysis_mv[1][_frame][1];
-    ncandidates++;
-    _mcenc->candidates[ncandidates][0]=0;
-    _mcenc->candidates[ncandidates][1]=0;
-    ncandidates++;
-    /*Use the first three vectors of set A to find our best predictor: their
-       median.*/
-    memcpy(a,_mcenc->candidates+1,sizeof(a));
-    OC_SORT2I(a[0][0],a[1][0]);
-    OC_SORT2I(a[0][1],a[1][1]);
-    OC_SORT2I(a[1][0],a[2][0]);
-    OC_SORT2I(a[1][1],a[2][1]);
-    OC_SORT2I(a[0][0],a[1][0]);
-    OC_SORT2I(a[0][1],a[1][1]);
-    _mcenc->candidates[0][0]=a[1][0];
-    _mcenc->candidates[0][1]=a[1][1];
   }
-  else{
-    /*The upper-left most macro block has no neighbors at all
-      We just use 0,0 as the median predictor and its previous motion vector
-       for set A.*/
-    _mcenc->candidates[0][0]=0;
-    _mcenc->candidates[0][1]=1;
-    _mcenc->candidates[1][0]=embs[_mbi].analysis_mv[1][_frame][0];
-    _mcenc->candidates[1][1]=embs[_mbi].analysis_mv[1][_frame][1];
-    ncandidates=2;
-  }
-  /*Fill in set B: accelerated predictors for this and adjacent macro
-     blocks.*/
+  /*Add a few additional vectors to set A: the vectors used in the previous
+     frames and the (0,0) vector.*/
+  _mcenc->candidates[ncandidates][0]=OC_CLAMPI(-31,_accum[0],31);
+  _mcenc->candidates[ncandidates][1]=OC_CLAMPI(-31,_accum[1],31);
+  ncandidates++;
+  _mcenc->candidates[ncandidates][0]=OC_CLAMPI(-31,
+   embs[_mbi].analysis_mv[1][_frame][0]+_accum[0],31);
+  _mcenc->candidates[ncandidates][1]=OC_CLAMPI(-31,
+   embs[_mbi].analysis_mv[1][_frame][1]+_accum[1],31);
+  ncandidates++;
+  _mcenc->candidates[ncandidates][0]=0;
+  _mcenc->candidates[ncandidates][1]=0;
+  ncandidates++;
+  /*Use the first three vectors of set A to find our best predictor: their
+     median.*/
+  memcpy(a,_mcenc->candidates+1,sizeof(a));
+  OC_SORT2I(a[0][0],a[1][0]);
+  OC_SORT2I(a[0][1],a[1][1]);
+  OC_SORT2I(a[1][0],a[2][0]);
+  OC_SORT2I(a[1][1],a[2][1]);
+  OC_SORT2I(a[0][0],a[1][0]);
+  OC_SORT2I(a[0][1],a[1][1]);
+  _mcenc->candidates[0][0]=a[1][0];
+  _mcenc->candidates[0][1]=a[1][1];
+  /*Fill in set B: accelerated predictors for this and adjacent macro blocks.*/
   _mcenc->setb0=ncandidates;
-  mvapw1=_mcenc->mvapw1[_frame];
-  mvapw2=_mcenc->mvapw2[_frame];
   /*The first time through the loop use the current macro block.*/
   nmbi=_mbi;
   for(i=0;;i++){
     _mcenc->candidates[ncandidates][0]=OC_CLAMPI(-31,
-     OC_DIV_POW2_RE(embs[nmbi].analysis_mv[1][_frame][0]*mvapw1
-     -embs[nmbi].analysis_mv[2][_frame][0]*mvapw2,16),31);
+     2*embs[_mbi].analysis_mv[1][_frame][0]
+     -embs[_mbi].analysis_mv[2][_frame][0]+_accum[0],31);
     _mcenc->candidates[ncandidates][1]=OC_CLAMPI(-31,
-     OC_DIV_POW2_RE(embs[nmbi].analysis_mv[1][_frame][1]*mvapw1
-     -embs[nmbi].analysis_mv[2][_frame][1]*mvapw2,16),31);
+     2*embs[_mbi].analysis_mv[1][_frame][1]
+     -embs[_mbi].analysis_mv[2][_frame][1]+_accum[1],31);
     ncandidates++;
     if(i>=embs[_mbi].npneighbors)break;
     nmbi=embs[_mbi].pneighbors[i];
@@ -246,9 +240,10 @@
   The actual motion vector is stored in the appropriate place in the
    oc_mb_enc_info structure.
   _mcenc:    The motion compensation context.
+  _accum:    Drop frame/golden MV accumulators.
   _mbi:      The macro block index.
   _frame:    The frame to search, either OC_FRAME_PREV or OC_FRAME_GOLD.*/
-void oc_mcenc_search(oc_enc_ctx *_enc,oc_mcenc_ctx *_mcenc,int _mbi,int _frame){
+void oc_mcenc_search_frame(oc_enc_ctx *_enc,int _accum[2],int _mbi,int _frame){
   /*Note: Traditionally this search is done using a rate-distortion objective
      function of the form D+lambda*R.
     However, xiphmont tested this and found it produced a small degredation,
@@ -264,6 +259,7 @@
      may cause increased degredation in many blocks to come.
     We could artificially reduce lambda to compensate, but it's faster to just
      disable it entirely, and use D (the distortion) as the sole criterion.*/
+  oc_mcenc_ctx         mcenc;
   const ptrdiff_t     *frag_buf_offs;
   const ptrdiff_t     *fragis;
   const unsigned char *src;
@@ -282,12 +278,12 @@
   int                  bi;
   embs=_enc->mb_info;
   /*Find some candidate motion vectors.*/
-  oc_mcenc_find_candidates(_enc,_mcenc,_mbi,_frame);
+  oc_mcenc_find_candidates(_enc,&mcenc,_accum,_mbi,_frame);
   /*Clear the cache of locations we've examined.*/
   memset(hit_cache,0,sizeof(hit_cache));
   /*Start with the median predictor.*/
-  candx=_mcenc->candidates[0][0];
-  candy=_mcenc->candidates[0][1];
+  candx=mcenc.candidates[0][0];
+  candy=mcenc.candidates[0][1];
   hit_cache[candy+15]|=(ogg_int32_t)1<<candx+15;
   frag_buf_offs=_enc->state.frag_buf_offs;
   fragis=_enc->state.mb_maps[_mbi][0];
@@ -320,9 +316,9 @@
     }
     t2+=(t2>>OC_YSAD_THRESH2_SCALE_BITS)+OC_YSAD_THRESH2_OFFSET;
     /*Examine the candidates in set A.*/
-    for(ci=1;ci<_mcenc->setb0;ci++){
-      candx=_mcenc->candidates[ci][0];
-      candy=_mcenc->candidates[ci][1];
+    for(ci=1;ci<mcenc.setb0;ci++){
+      candx=mcenc.candidates[ci][0];
+      candy=mcenc.candidates[ci][1];
       /*If we've already examined this vector, then we would be using it if it
          was better than what we are using.*/
       hitbit=(ogg_int32_t)1<<candx+15;
@@ -345,9 +341,9 @@
     }
     if(best_err>t2){
       /*Examine the candidates in set B.*/
-      for(;ci<_mcenc->ncandidates;ci++){
-        candx=_mcenc->candidates[ci][0];
-        candy=_mcenc->candidates[ci][1];
+      for(;ci<mcenc.ncandidates;ci++){
+        candx=mcenc.candidates[ci][0];
+        candy=mcenc.candidates[ci][1];
         hitbit=(ogg_int32_t)1<<candx+15;
         if(hit_cache[candy+15]&hitbit)continue;
         hit_cache[candy+15]|=hitbit;
@@ -494,6 +490,45 @@
   }
 }
 
+void oc_mcenc_search(oc_enc_ctx *_enc,int _mbi){
+  oc_mv2         *mvs;
+  int             accum_p[2];
+  int             accum_g[2];
+  mvs=_enc->mb_info[_mbi].analysis_mv;
+  if(_enc->prevframe_dropped){
+    accum_p[0]=mvs[0][OC_FRAME_PREV][0];
+    accum_p[1]=mvs[0][OC_FRAME_PREV][1];
+  }
+  else accum_p[1]=accum_p[0]=0;
+  accum_g[0]=mvs[2][OC_FRAME_GOLD][0];
+  accum_g[1]=mvs[2][OC_FRAME_GOLD][1];
+  mvs[0][OC_FRAME_PREV][0]-=mvs[2][OC_FRAME_PREV][0];
+  mvs[0][OC_FRAME_PREV][1]-=mvs[2][OC_FRAME_PREV][1];
+  /*Move the motion vector predictors back a frame.*/
+  memmove(mvs+1,mvs,2*sizeof(*mvs));
+  /*Search the last frame.*/
+  oc_mcenc_search_frame(_enc,accum_p,_mbi,OC_FRAME_PREV);
+  mvs[2][OC_FRAME_PREV][0]=accum_p[0];
+  mvs[2][OC_FRAME_PREV][1]=accum_p[1];
+  /*GOLDEN MVs are different from PREV MVs in that they're each absolute
+     offsets from some frame in the past rather than relative offsets from the
+     frame before.
+    For predictor calculation to make sense, we need them to be in the same
+     form as PREV MVs.*/
+  mvs[1][OC_FRAME_GOLD][0]-=mvs[2][OC_FRAME_GOLD][0];
+  mvs[1][OC_FRAME_GOLD][1]-=mvs[2][OC_FRAME_GOLD][1];
+  mvs[2][OC_FRAME_GOLD][0]-=accum_g[0];
+  mvs[2][OC_FRAME_GOLD][1]-=accum_g[1];
+  /*Search the golden frame.*/
+  oc_mcenc_search_frame(_enc,accum_g,_mbi,OC_FRAME_GOLD);
+  /*Put GOLDEN MVs back into absolute offset form.
+    The newest MV is already an absolute offset.*/
+  mvs[2][OC_FRAME_GOLD][0]+=accum_g[0];
+  mvs[2][OC_FRAME_GOLD][1]+=accum_g[1];
+  mvs[1][OC_FRAME_GOLD][0]+=mvs[2][OC_FRAME_GOLD][0];
+  mvs[1][OC_FRAME_GOLD][1]+=mvs[2][OC_FRAME_GOLD][1];
+}
+
 #if 0
 static int oc_mcenc_ysad_halfpel_mbrefine(const oc_enc_ctx *_enc,int _mbi,
  int _vec[2],int _best_err,int _frame){

Modified: branches/theora-gumboot/lib/enc/modedec.h
===================================================================
--- branches/theora-gumboot/lib/enc/modedec.h	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/modedec.h	2009-07-23 00:51:02 UTC (rev 16320)
@@ -58,61 +58,61 @@
     {
       /*Y'  qi=0  INTRA*/
       {
-        {  172,  -63},{  218, 1603},{  265, 3547},{  333, 5324},
-        {  424, 6541},{  520, 7452},{  615, 8306},{  706, 9139},
-        {  796, 9953},{  891,10771},{  989,11586},{ 1096,12392},
-        { 1205,13151},{ 1304,13829},{ 1388,14586},{ 1475,15372},
-        { 1566,16084},{ 1654,16833},{ 1746,17548},{ 1838,18221},
-        { 1927,18914},{ 2017,19622},{ 2102,20326},{ 2170,21128}
+        {   92,  -93},{  144, 1641},{  206, 3502},{  287, 5122},
+        {  372, 6414},{  443, 7565},{  510, 8623},{  585, 9644},
+        {  676,10560},{  781,11419},{  888,12258},{ 1016,12976},
+        { 1149,13593},{ 1259,14189},{ 1338,14882},{ 1420,15631},
+        { 1507,16320},{ 1575,17079},{ 1662,17768},{ 1785,18242},
+        { 1920,18699},{ 2034,19226},{ 2140,19873},{ 2266,20580}
       },
       /*Y'  qi=0  INTER*/
       {
-        {  136, -147},{   93, 1359},{  122, 2917},{  149, 4559},
-        {  165, 6181},{  177, 7697},{  190, 9078},{  204,10362},
-        {  220,11653},{  240,12884},{  268,14050},{  301,15223},
-        {  336,16392},{  370,17564},{  404,18716},{  443,19858},
-        {  482,20992},{  526,22096},{  586,23182},{  653,24238},
-        {  725,25263},{  797,26287},{  874,27271},{  959,28217}
+        {   54,  -81},{   49, 1270},{   63, 2894},{   92, 4499},
+        {  116, 6121},{  128, 7731},{  137, 9254},{  145,10692},
+        {  152,12066},{  160,13378},{  169,14664},{  180,15931},
+        {  192,17162},{  205,18358},{  220,19523},{  234,20680},
+        {  249,21819},{  268,22937},{  290,24059},{  318,25156},
+        {  355,26209},{  401,27229},{  458,28199},{  527,29110}
       }
     },
     {
       /*Cb  qi=0  INTRA*/
       {
-        {    9,    2},{   67,  365},{  111,  742},{  129, 1183},
-        {  142, 1661},{  157, 2165},{  169, 2686},{  173, 3205},
-        {  181, 3685},{  190, 4166},{  196, 4618},{  202, 5034},
-        {  209, 5470},{  217, 5883},{  224, 6272},{  237, 6630},
-        {  253, 6962},{  260, 7315},{  275, 7663},{  287, 8010},
-        {  294, 8367},{  308, 8640},{  328, 8931},{  367, 9355}
+        {   14,  -41},{   88, 1681},{  142, 3495},{  194, 5195},
+        {  247, 6736},{  319, 7954},{  408, 9092},{  513,10196},
+        {  586,11242},{  625,12110},{  686,12876},{  757,13647},
+        {  863,14417},{  951,15327},{ 1048,15959},{ 1143,16375},
+        { 1176,17395},{ 1296,18290},{ 1394,19013},{ 1413,19822},
+        { 1451,20096},{ 1580,19435},{ 1735,19400},{ 1906,19311}
       },
       /*Cb  qi=0  INTER*/
       {
-        {  129,  -50},{  123,  303},{  117,  654},{  114, 1025},
-        {  113, 1434},{  112, 1854},{  117, 2271},{  122, 2682},
-        {  126, 3101},{  129, 3532},{  132, 3962},{  134, 4383},
-        {  136, 4802},{  139, 5188},{  142, 5544},{  145, 5904},
-        {  145, 6270},{  146, 6638},{  148, 6998},{  149, 7345},
-        {  150, 7697},{  153, 8045},{  154, 8401},{  153, 8788}
+        {   48,  -38},{   37, 1282},{   54, 2989},{   72, 4622},
+        {   86, 6143},{   91, 7621},{   89, 9109},{   88,10585},
+        {   92,12024},{   98,13436},{  112,14802},{  134,16081},
+        {  151,17340},{  162,18504},{  157,19632},{  156,20786},
+        {  157,21969},{  158,23135},{  182,24229},{  214,25376},
+        {  249,26479},{  317,27419},{  409,28251},{  499,29072}
       }
     },
     {
       /*Cr  qi=0  INTRA*/
       {
-        {    5,    4},{   58,  373},{  102,  762},{  127, 1227},
-        {  139, 1710},{  147, 2210},{  156, 2712},{  165, 3178},
-        {  174, 3642},{  183, 4103},{  198, 4561},{  209, 4989},
-        {  217, 5373},{  225, 5788},{  235, 6194},{  245, 6587},
-        {  253, 7005},{  268, 7368},{  287, 7714},{  298, 8043},
-        {  304, 8410},{  318, 8695},{  327, 8926},{  342, 9294}
+        {   12,  -61},{   79, 1696},{  130, 3505},{  187, 5173},
+        {  259, 6635},{  341, 7928},{  436, 9156},{  504,10231},
+        {  540,11198},{  634,12076},{  706,13090},{  797,14137},
+        {  879,14780},{ 1020,15100},{ 1175,15410},{ 1394,15924},
+        { 1575,16180},{ 1525,16416},{ 1572,17079},{ 1663,17785},
+        { 1763,18425},{ 1899,18957},{ 1978,19101},{ 2085,19615}
       },
       /*Cr  qi=0  INTER*/
       {
-        {   88,   18},{   98,  337},{  108,  648},{  119, 1017},
-        {  117, 1432},{  117, 1842},{  121, 2250},{  125, 2663},
-        {  127, 3082},{  129, 3503},{  131, 3920},{  131, 4345},
-        {  134, 4757},{  137, 5155},{  138, 5551},{  137, 5941},
-        {  138, 6336},{  140, 6715},{  143, 7100},{  146, 7467},
-        {  150, 7805},{  153, 8150},{  157, 8499},{  159, 8860}
+        {   35,   37},{   34, 1298},{   55, 2970},{   72, 4601},
+        {   80, 6192},{   90, 7717},{  100, 9176},{  102,10612},
+        {   99,12037},{   98,13436},{  107,14800},{  117,16141},
+        {  129,17479},{  147,18788},{  177,19979},{  212,21146},
+        {  254,22239},{  324,23121},{  382,24135},{  517,24606},
+        {  675,25070},{  809,25430},{ 1022,25417},{ 1195,25635}
       }
     }
   },
@@ -120,61 +120,61 @@
     {
       /*Y'  qi=1  INTRA*/
       {
-        {  180,  -58},{  226, 1601},{  279, 3502},{  358, 5179},
-        {  463, 6309},{  571, 7184},{  674, 8016},{  776, 8821},
-        {  878, 9601},{  985,10382},{ 1096,11169},{ 1216,11930},
-        { 1333,12652},{ 1437,13332},{ 1535,14052},{ 1636,14795},
-        { 1736,15477},{ 1833,16184},{ 1930,16870},{ 2030,17514},
-        { 2130,18188},{ 2228,18859},{ 2326,19535},{ 2417,20310}
+        {   89,  -92},{  145, 1639},{  212, 3487},{  297, 5077},
+        {  387, 6341},{  459, 7478},{  530, 8523},{  612, 9516},
+        {  703,10412},{  815,11246},{  932,12045},{ 1064,12747},
+        { 1199,13350},{ 1313,13910},{ 1400,14582},{ 1494,15296},
+        { 1582,15963},{ 1656,16705},{ 1760,17339},{ 1890,17775},
+        { 2030,18211},{ 2155,18700},{ 2273,19318},{ 2401,20055}
       },
       /*Y'  qi=1  INTER*/
       {
-        {  146,  -73},{   98, 1355},{  128, 2908},{  156, 4550},
-        {  173, 6168},{  188, 7635},{  203, 8959},{  221,10217},
-        {  242,11464},{  269,12679},{  304,13838},{  344,14978},
-        {  388,16124},{  435,17267},{  479,18403},{  529,19526},
-        {  583,20640},{  645,21716},{  723,22748},{  807,23762},
-        {  892,24739},{  980,25687},{ 1074,26614},{ 1179,27501}
+        {   53,    6},{   47, 1303},{   63, 2906},{   94, 4514},
+        {  117, 6142},{  129, 7743},{  138, 9233},{  147,10654},
+        {  154,12018},{  162,13302},{  173,14570},{  185,15825},
+        {  198,17043},{  214,18229},{  230,19387},{  246,20530},
+        {  264,21660},{  286,22779},{  314,23872},{  349,24942},
+        {  393,25975},{  449,26959},{  522,27865},{  606,28685}
       }
     },
     {
       /*Cb  qi=1  INTRA*/
       {
-        {    9,    2},{   70,  365},{  120,  742},{  143, 1183},
-        {  153, 1663},{  163, 2167},{  173, 2690},{  180, 3208},
-        {  188, 3686},{  200, 4164},{  207, 4612},{  214, 5008},
-        {  228, 5426},{  239, 5823},{  245, 6192},{  257, 6527},
-        {  273, 6841},{  282, 7178},{  299, 7512},{  315, 7837},
-        {  324, 8190},{  344, 8438},{  369, 8685},{  410, 9117}
+        {   13,  -42},{   92, 1681},{  148, 3482},{  200, 5169},
+        {  258, 6696},{  334, 7894},{  429, 9020},{  547,10080},
+        {  624,11083},{  660,11944},{  722,12692},{  797,13382},
+        {  909,14137},{ 1018,14996},{ 1136,15467},{ 1233,15884},
+        { 1273,17029},{ 1429,17688},{ 1563,18130},{ 1566,19083},
+        { 1603,19339},{ 1713,19022},{ 1794,19501},{ 1894,19971}
       },
       /*Cb  qi=1  INTER*/
       {
-        {   86,  -49},{   98,  303},{  108,  655},{  116, 1027},
-        {  113, 1433},{  114, 1848},{  120, 2263},{  126, 2679},
-        {  130, 3103},{  132, 3529},{  134, 3956},{  137, 4378},
-        {  139, 4770},{  142, 5146},{  145, 5518},{  145, 5878},
-        {  147, 6239},{  150, 6591},{  153, 6941},{  153, 7298},
-        {  155, 7648},{  158, 7991},{  161, 8340},{  167, 8699}
+        {   45,   -1},{   35, 1285},{   53, 3000},{   72, 4634},
+        {   85, 6152},{   88, 7625},{   88, 9100},{   87,10558},
+        {   92,11985},{  100,13372},{  115,14713},{  133,16030},
+        {  148,17220},{  155,18354},{  162,19504},{  169,20617},
+        {  173,21731},{  183,22884},{  196,24099},{  219,25239},
+        {  274,26246},{  336,27225},{  447,27989},{  642,28426}
       }
     },
     {
       /*Cr  qi=1  INTRA*/
       {
-        {    5,    4},{   63,  373},{  111,  762},{  136, 1227},
-        {  149, 1711},{  159, 2211},{  167, 2715},{  177, 3180},
-        {  187, 3639},{  198, 4062},{  216, 4473},{  228, 4910},
-        {  234, 5316},{  244, 5723},{  256, 6115},{  268, 6484},
-        {  282, 6876},{  300, 7212},{  316, 7532},{  327, 7840},
-        {  335, 8183},{  352, 8432},{  362, 8632},{  372, 8949}
+        {   13,  -61},{   84, 1695},{  134, 3500},{  192, 5150},
+        {  273, 6565},{  362, 7816},{  465, 8975},{  534, 9979},
+        {  562,11007},{  658,11974},{  742,12918},{  851,13809},
+        {  946,14345},{ 1041,14772},{ 1189,15150},{ 1442,15625},
+        { 1626,16013},{ 1600,16334},{ 1643,16901},{ 1784,17061},
+        { 1863,17850},{ 2008,18492},{ 2096,18504},{ 2208,18948}
       },
       /*Cr  qi=1  INTER*/
       {
-        {  139,    9},{  120,  326},{  112,  649},{  116, 1028},
-        {  117, 1441},{  120, 1842},{  124, 2245},{  127, 2663},
-        {  129, 3087},{  130, 3513},{  132, 3932},{  134, 4344},
-        {  137, 4748},{  139, 5144},{  141, 5536},{  143, 5921},
-        {  143, 6297},{  145, 6665},{  148, 7030},{  152, 7392},
-        {  155, 7729},{  157, 8067},{  160, 8410},{  164, 8739}
+        {   33,   40},{   32, 1311},{   53, 2997},{   70, 4627},
+        {   78, 6194},{   88, 7709},{   97, 9164},{   99,10603},
+        {  100,11996},{  102,13344},{  108,14685},{  125,16010},
+        {  145,17340},{  163,18612},{  190,19828},{  230,20993},
+        {  290,22025},{  365,22926},{  462,23684},{  548,24377},
+        {  690,24670},{  905,24715},{ 1163,24700},{ 1361,24835}
       }
     }
   },
@@ -182,61 +182,61 @@
     {
       /*Y'  qi=2  INTRA*/
       {
-        {  186,  -63},{  235, 1599},{  293, 3459},{  382, 5040},
-        {  502, 6099},{  622, 6939},{  738, 7732},{  855, 8498},
-        {  969, 9249},{ 1088,10000},{ 1214,10745},{ 1344,11462},
-        { 1472,12147},{ 1589,12822},{ 1699,13505},{ 1813,14184},
-        { 1925,14844},{ 2032,15535},{ 2140,16201},{ 2249,16824},
-        { 2355,17461},{ 2460,18093},{ 2570,18726},{ 2665,19470}
+        {   96,  -93},{  151, 1634},{  220, 3453},{  313, 4992},
+        {  408, 6222},{  484, 7342},{  561, 8360},{  651, 9325},
+        {  749,10189},{  868,10979},{  992,11750},{ 1137,12414},
+        { 1277,12983},{ 1394,13535},{ 1490,14178},{ 1593,14859},
+        { 1697,15490},{ 1782,16196},{ 1904,16785},{ 2049,17185},
+        { 2198,17601},{ 2334,18063},{ 2479,18576},{ 2637,19231}
       },
       /*Y'  qi=2  INTER*/
       {
-        {  114,  -52},{  100, 1348},{  133, 2895},{  163, 4538},
-        {  182, 6128},{  200, 7525},{  217, 8799},{  239,10033},
-        {  267,11258},{  302,12447},{  347,13598},{  397,14723},
-        {  451,15836},{  505,16967},{  566,18081},{  636,19149},
-        {  711,20211},{  796,21263},{  892,22248},{  991,23201},
-        { 1091,24136},{ 1204,25012},{ 1323,25848},{ 1442,26670}
+        {   38,    6},{   47, 1303},{   65, 2874},{   97, 4477},
+        {  120, 6110},{  133, 7690},{  143, 9164},{  151,10557},
+        {  160,11886},{  169,13182},{  180,14456},{  192,15697},
+        {  208,16895},{  226,18059},{  245,19199},{  265,20325},
+        {  288,21441},{  315,22542},{  351,23613},{  398,24646},
+        {  456,25631},{  533,26535},{  624,27364},{  730,28141}
       }
     },
     {
       /*Cb  qi=2  INTRA*/
       {
-        {    9,    2},{   75,  366},{  127,  742},{  147, 1184},
-        {  158, 1665},{  171, 2171},{  182, 2693},{  188, 3210},
-        {  198, 3673},{  210, 4109},{  219, 4538},{  228, 4954},
-        {  240, 5368},{  252, 5743},{  263, 6092},{  278, 6416},
-        {  294, 6721},{  308, 7038},{  325, 7358},{  333, 7686},
-        {  344, 8014},{  371, 8220},{  404, 8422},{  441, 8683}
+        {   14,  -42},{   98, 1678},{  153, 3470},{  208, 5136},
+        {  275, 6636},{  359, 7802},{  455, 8905},{  585, 9905},
+        {  667,10832},{  703,11684},{  773,12383},{  852,12981},
+        {  975,13734},{ 1089,14636},{ 1240,14901},{ 1327,15361},
+        { 1363,16635},{ 1558,17015},{ 1688,17112},{ 1731,17907},
+        { 1806,18258},{ 1896,18183},{ 1986,18415},{ 2092,18724}
       },
       /*Cb  qi=2  INTER*/
       {
-        {  141, -126},{  130,  236},{  120,  594},{  113,  979},
-        {  115, 1411},{  116, 1837},{  122, 2252},{  128, 2668},
-        {  132, 3094},{  135, 3523},{  136, 3946},{  138, 4358},
-        {  141, 4753},{  145, 5135},{  147, 5496},{  148, 5850},
-        {  150, 6214},{  154, 6561},{  158, 6889},{  161, 7227},
-        {  164, 7563},{  166, 7894},{  169, 8237},{  175, 8573}
+        {   56,  -36},{   38, 1306},{   59, 2994},{   78, 4605},
+        {   89, 6120},{   93, 7608},{   94, 9080},{   93,10531},
+        {   95,11953},{  105,13317},{  119,14627},{  136,15872},
+        {  146,17024},{  151,18150},{  154,19336},{  156,20493},
+        {  158,21626},{  178,22783},{  200,23951},{  253,24973},
+        {  354,25781},{  453,26541},{  614,26996},{  829,27217}
       }
     },
     {
       /*Cr  qi=2  INTRA*/
       {
-        {    5,    4},{   66,  373},{  114,  762},{  139, 1228},
-        {  154, 1714},{  165, 2216},{  172, 2720},{  183, 3187},
-        {  195, 3637},{  205, 4047},{  222, 4443},{  239, 4857},
-        {  249, 5249},{  262, 5642},{  278, 6031},{  290, 6378},
-        {  307, 6742},{  323, 7071},{  342, 7359},{  355, 7644},
-        {  363, 7972},{  383, 8186},{  399, 8373},{  428, 8675}
+        {   15,  -61},{   88, 1694},{  139, 3487},{  202, 5116},
+        {  287, 6506},{  380, 7700},{  496, 8798},{  580, 9768},
+        {  622,10761},{  718,11697},{  809,12600},{  920,13505},
+        { 1039,13896},{ 1143,14305},{ 1277,14754},{ 1561,15080},
+        { 1758,15412},{ 1663,16069},{ 1699,16737},{ 1814,17012},
+        { 1907,17708},{ 2096,17832},{ 2227,17987},{ 2366,18301}
       },
       /*Cr  qi=2  INTER*/
       {
-        {  109,   -7},{  109,  326},{  114,  640},{  119, 1017},
-        {  120, 1423},{  122, 1830},{  126, 2243},{  128, 2663},
-        {  130, 3089},{  132, 3514},{  134, 3931},{  137, 4345},
-        {  138, 4748},{  140, 5138},{  143, 5521},{  145, 5895},
-        {  148, 6262},{  151, 6624},{  155, 6988},{  158, 7343},
-        {  162, 7670},{  169, 7987},{  171, 8300},{  174, 8630}
+        {   47,   38},{   37, 1307},{   59, 2972},{   75, 4597},
+        {   83, 6174},{   92, 7679},{  101, 9121},{  102,10531},
+        {  101,11908},{  105,13248},{  114,14583},{  133,15918},
+        {  158,17215},{  178,18492},{  217,19655},{  275,20684},
+        {  331,21704},{  406,22633},{  524,23211},{  647,23855},
+        {  780,24431},{  945,24976},{ 1129,25331},{ 1284,25846}
       }
     }
   },
@@ -244,61 +244,61 @@
     {
       /*Y'  qi=3  INTRA*/
       {
-        {  191,  -64},{  242, 1597},{  305, 3413},{  407, 4918},
-        {  541, 5923},{  672, 6731},{  797, 7504},{  924, 8251},
-        { 1047, 8986},{ 1175, 9717},{ 1311,10437},{ 1453,11125},
-        { 1590,11786},{ 1718,12431},{ 1838,13095},{ 1958,13784},
-        { 2078,14411},{ 2196,15059},{ 2309,15712},{ 2424,16311},
-        { 2538,16930},{ 2651,17541},{ 2766,18161},{ 2869,18889}
+        {   96,  -92},{  154, 1631},{  227, 3432},{  327, 4936},
+        {  427, 6135},{  505, 7245},{  585, 8253},{  678, 9204},
+        {  781,10052},{  901,10827},{ 1032,11560},{ 1187,12187},
+        { 1332,12759},{ 1456,13294},{ 1559,13912},{ 1666,14582},
+        { 1781,15189},{ 1879,15847},{ 2010,16374},{ 2168,16730},
+        { 2317,17147},{ 2457,17604},{ 2613,18104},{ 2800,18694}
       },
       /*Y'  qi=3  INTER*/
       {
-        {  147,  -56},{  103, 1351},{  138, 2897},{  169, 4523},
-        {  191, 6071},{  212, 7429},{  234, 8690},{  261, 9919},
-        {  296,11128},{  338,12302},{  392,13431},{  454,14530},
-        {  522,15620},{  593,16713},{  664,17804},{  745,18866},
-        {  844,19878},{  943,20872},{ 1050,21826},{ 1163,22748},
-        { 1280,23627},{ 1406,24454},{ 1535,25254},{ 1671,26041}
+        {   68, -109},{   48, 1299},{   66, 2908},{   99, 4517},
+        {  120, 6143},{  133, 7697},{  144, 9136},{  154,10499},
+        {  163,11818},{  173,13106},{  185,14367},{  200,15593},
+        {  218,16779},{  236,17935},{  257,19068},{  281,20185},
+        {  308,21286},{  343,22359},{  389,23402},{  444,24412},
+        {  513,25358},{  603,26212},{  713,26967},{  837,27669}
       }
     },
     {
       /*Cb  qi=3  INTRA*/
       {
-        {   11,    2},{   78,  366},{  131,  743},{  152, 1186},
-        {  164, 1668},{  177, 2173},{  186, 2694},{  192, 3207},
-        {  205, 3664},{  220, 4088},{  232, 4508},{  242, 4919},
-        {  253, 5313},{  269, 5663},{  287, 5992},{  301, 6308},
-        {  317, 6588},{  332, 6894},{  350, 7204},{  364, 7506},
-        {  375, 7818},{  403, 8020},{  439, 8208},{  483, 8456}
+        {   14,  -43},{  103, 1677},{  160, 3461},{  217, 5106},
+        {  287, 6564},{  376, 7706},{  477, 8781},{  616, 9705},
+        {  700,10616},{  736,11534},{  815,12211},{  891,12820},
+        { 1015,13560},{ 1140,14340},{ 1271,14680},{ 1358,15248},
+        { 1443,16313},{ 1650,16405},{ 1756,16652},{ 1795,17484},
+        { 1860,17904},{ 1986,17772},{ 2107,18046},{ 2259,18275}
       },
       /*Cb  qi=3  INTER*/
       {
-        {  121,  -62},{  119,  286},{  116,  631},{  112, 1004},
-        {  112, 1427},{  118, 1851},{  125, 2268},{  131, 2687},
-        {  134, 3111},{  137, 3536},{  140, 3950},{  143, 4354},
-        {  146, 4746},{  150, 5117},{  152, 5493},{  155, 5843},
-        {  158, 6173},{  161, 6509},{  164, 6834},{  167, 7165},
-        {  171, 7499},{  175, 7831},{  178, 8153},{  179, 8462}
+        {   28,  -47},{   34, 1342},{   56, 3028},{   76, 4635},
+        {   87, 6137},{   90, 7601},{   90, 9057},{   89,10499},
+        {   93,11902},{  106,13247},{  123,14544},{  141,15787},
+        {  162,16923},{  159,18057},{  150,19204},{  158,20339},
+        {  181,21448},{  219,22518},{  257,23631},{  310,24678},
+        {  395,25523},{  552,26114},{  743,26662},{  898,27327}
       }
     },
     {
       /*Cr  qi=3  INTRA*/
       {
-        {    5,    4},{   71,  374},{  121,  764},{  145, 1230},
-        {  158, 1717},{  169, 2221},{  178, 2723},{  188, 3189},
-        {  200, 3634},{  211, 4035},{  230, 4419},{  248, 4823},
-        {  262, 5199},{  279, 5563},{  292, 5946},{  306, 6291},
-        {  330, 6623},{  352, 6924},{  376, 7223},{  389, 7488},
-        {  393, 7763},{  411, 7973},{  432, 8158},{  457, 8455}
+        {   14,  -62},{   92, 1693},{  147, 3478},{  214, 5074},
+        {  307, 6416},{  407, 7584},{  518, 8671},{  609, 9631},
+        {  658,10592},{  744,11541},{  840,12402},{  971,13227},
+        { 1098,13599},{ 1226,13926},{ 1385,14369},{ 1674,14648},
+        { 1854,15025},{ 1731,15854},{ 1768,16535},{ 1965,16573},
+        { 2090,17025},{ 2224,17419},{ 2340,17438},{ 2487,17679}
       },
       /*Cr  qi=3  INTER*/
       {
-        {   96,   17},{  107,  333},{  111,  656},{  117, 1031},
-        {  120, 1440},{  123, 1848},{  128, 2257},{  131, 2679},
-        {  132, 3107},{  134, 3529},{  137, 3939},{  140, 4340},
-        {  142, 4738},{  145, 5130},{  148, 5500},{  150, 5854},
-        {  154, 6212},{  159, 6569},{  164, 6924},{  170, 7258},
-        {  174, 7567},{  178, 7883},{  183, 8190},{  196, 8493}
+        {   32,   19},{   36, 1325},{   58, 3003},{   72, 4626},
+        {   80, 6180},{   89, 7674},{   99, 9109},{  100,10506},
+        {   98,11873},{  103,13200},{  118,14506},{  142,15816},
+        {  167,17099},{  196,18328},{  235,19511},{  284,20590},
+        {  361,21459},{  455,22256},{  634,22807},{  780,23369},
+        {  923,23834},{ 1178,23888},{ 1388,23983},{ 1584,24268}
       }
     }
   },
@@ -306,61 +306,61 @@
     {
       /*Y'  qi=4  INTRA*/
       {
-        {  192,  -64},{  245, 1594},{  314, 3374},{  428, 4815},
-        {  574, 5781},{  715, 6566},{  852, 7311},{  992, 8028},
-        { 1128, 8727},{ 1268, 9429},{ 1411,10136},{ 1561,10799},
-        { 1711,11419},{ 1849,12044},{ 1977,12684},{ 2103,13333},
-        { 2232,13939},{ 2360,14569},{ 2485,15194},{ 2606,15774},
-        { 2723,16370},{ 2844,16938},{ 2964,17526},{ 3073,18257}
+        {   88,  -92},{  156, 1630},{  234, 3404},{  339, 4869},
+        {  443, 6045},{  525, 7145},{  613, 8142},{  710, 9074},
+        {  816, 9894},{  939,10643},{ 1078,11348},{ 1248,11923},
+        { 1399,12465},{ 1526,12982},{ 1631,13595},{ 1741,14265},
+        { 1868,14847},{ 1986,15451},{ 2127,15931},{ 2278,16305},
+        { 2429,16736},{ 2570,17216},{ 2736,17679},{ 2943,18173}
       },
       /*Y'  qi=4  INTER*/
       {
-        {  132,  -95},{  100, 1357},{  140, 2894},{  173, 4496},
-        {  196, 5989},{  219, 7318},{  246, 8578},{  279, 9789},
-        {  320,10973},{  374,12128},{  440,13231},{  514,14309},
-        {  596,15382},{  679,16465},{  769,17527},{  872,18543},
-        {  978,19537},{ 1092,20482},{ 1216,21384},{ 1343,22259},
-        { 1478,23075},{ 1623,23822},{ 1775,24492},{ 1939,25083}
+        {   64,  -92},{   46, 1322},{   67, 2879},{  101, 4481},
+        {  123, 6100},{  137, 7642},{  148, 9072},{  158,10422},
+        {  168,11732},{  178,13023},{  192,14277},{  209,15490},
+        {  229,16661},{  251,17796},{  276,18912},{  302,20024},
+        {  335,21107},{  378,22156},{  430,23181},{  500,24142},
+        {  586,25032},{  692,25831},{  821,26529},{  958,27184}
       }
     },
     {
       /*Cb  qi=4  INTRA*/
       {
-        {   10,    2},{   80,  366},{  136,  743},{  158, 1186},
-        {  169, 1670},{  181, 2176},{  193, 2696},{  200, 3206},
-        {  212, 3659},{  228, 4080},{  239, 4490},{  254, 4891},
-        {  271, 5271},{  284, 5605},{  301, 5919},{  318, 6225},
-        {  337, 6510},{  358, 6799},{  384, 7069},{  395, 7356},
-        {  409, 7640},{  439, 7840},{  471, 8023},{  521, 8202}
+        {   15,  -42},{  103, 1675},{  165, 3449},{  229, 5072},
+        {  306, 6494},{  402, 7604},{  506, 8651},{  659, 9508},
+        {  749,10397},{  782,11347},{  877,11959},{  973,12410},
+        { 1079,13224},{ 1172,14162},{ 1313,14452},{ 1433,14883},
+        { 1524,15984},{ 1716,16235},{ 1847,16418},{ 1895,17396},
+        { 1933,17996},{ 2047,17836},{ 2184,17977},{ 2348,18062}
       },
       /*Cb  qi=4  INTER*/
       {
-        {  126,  -54},{  121,  305},{  117,  662},{  112, 1042},
-        {  110, 1447},{  117, 1859},{  125, 2275},{  130, 2696},
-        {  134, 3121},{  137, 3540},{  140, 3956},{  143, 4352},
-        {  147, 4732},{  150, 5096},{  154, 5444},{  159, 5783},
-        {  163, 6120},{  165, 6452},{  169, 6781},{  174, 7106},
-        {  177, 7426},{  182, 7748},{  189, 8069},{  187, 8390}
+        {   51,  -78},{   36, 1347},{   59, 3016},{   79, 4612},
+        {   90, 6112},{   93, 7577},{   95, 9036},{   95,10478},
+        {   98,11876},{  109,13196},{  128,14482},{  148,15730},
+        {  156,16871},{  167,17934},{  185,19036},{  193,20172},
+        {  202,21324},{  239,22409},{  289,23474},{  353,24482},
+        {  492,25159},{  700,25465},{  988,25598},{ 1263,25732}
       }
     },
     {
       /*Cr  qi=4  INTRA*/
       {
-        {    5,    4},{   76,  374},{  128,  764},{  150, 1230},
-        {  162, 1718},{  173, 2223},{  183, 2727},{  195, 3191},
-        {  208, 3629},{  219, 4019},{  240, 4385},{  263, 4773},
-        {  279, 5145},{  293, 5503},{  305, 5869},{  320, 6195},
-        {  346, 6506},{  370, 6792},{  396, 7055},{  418, 7299},
-        {  428, 7591},{  443, 7811},{  461, 7996},{  494, 8275}
+        {   12,  -62},{   97, 1691},{  154, 3468},{  225, 5030},
+        {  328, 6330},{  437, 7450},{  555, 8508},{  644, 9469},
+        {  682,10455},{  772,11386},{  891,12095},{ 1039,12842},
+        { 1200,13122},{ 1308,13477},{ 1437,13962},{ 1787,14139},
+        { 2003,14533},{ 1898,15278},{ 1920,15695},{ 2081,15668},
+        { 2136,16450},{ 2262,16950},{ 2406,16978},{ 2530,17286}
       },
       /*Cr  qi=4  INTER*/
       {
-        {  110,   25},{  110,  339},{  115,  661},{  115, 1040},
-        {  117, 1453},{  121, 1863},{  125, 2274},{  129, 2695},
-        {  131, 3115},{  133, 3531},{  136, 3942},{  139, 4343},
-        {  143, 4729},{  146, 5105},{  149, 5470},{  154, 5828},
-        {  157, 6183},{  161, 6520},{  167, 6854},{  176, 7181},
-        {  184, 7488},{  189, 7791},{  194, 8091},{  198, 8385}
+        {   35,   -4},{   37, 1336},{   62, 2996},{   78, 4612},
+        {   85, 6160},{   94, 7649},{  102, 9083},{  105,10470},
+        {  104,11834},{  110,13173},{  127,14479},{  149,15774},
+        {  180,17007},{  214,18226},{  254,19371},{  324,20402},
+        {  424,21240},{  529,21984},{  674,22403},{  885,22633},
+        { 1137,22657},{ 1367,22521},{ 1559,22622},{ 1779,22669}
       }
     }
   },
@@ -368,61 +368,61 @@
     {
       /*Y'  qi=5  INTRA*/
       {
-        {  195,  -61},{  247, 1591},{  319, 3349},{  443, 4760},
-        {  600, 5698},{  751, 6454},{  901, 7161},{ 1051, 7851},
-        { 1197, 8526},{ 1349, 9190},{ 1503, 9860},{ 1661,10491},
-        { 1820,11089},{ 1970,11684},{ 2106,12296},{ 2241,12910},
-        { 2381,13489},{ 2518,14102},{ 2651,14694},{ 2779,15243},
-        { 2903,15804},{ 3033,16352},{ 3164,16905},{ 3279,17578}
+        {   93,  -90},{  160, 1624},{  243, 3374},{  356, 4805},
+        {  466, 5954},{  552, 7035},{  646, 8015},{  751, 8919},
+        {  859, 9725},{  988,10462},{ 1134,11144},{ 1310,11682},
+        { 1471,12189},{ 1604,12704},{ 1719,13288},{ 1839,13929},
+        { 1971,14506},{ 2102,15071},{ 2255,15521},{ 2418,15870},
+        { 2587,16261},{ 2749,16671},{ 2928,17064},{ 3140,17518}
       },
       /*Y'  qi=5  INTER*/
       {
-        {  134,  -96},{  101, 1355},{  141, 2890},{  176, 4464},
-        {  204, 5918},{  232, 7225},{  263, 8463},{  304, 9661},
-        {  357,10829},{  425,11946},{  506,13015},{  597,14074},
-        {  690,15134},{  791,16186},{  902,17203},{ 1020,18179},
-        { 1143,19128},{ 1277,20023},{ 1419,20864},{ 1565,21660},
-        { 1721,22387},{ 1886,23034},{ 2060,23581},{ 2246,24016}
+        {   40,  -48},{   48, 1329},{   69, 2896},{  103, 4503},
+        {  124, 6112},{  138, 7625},{  150, 9024},{  161,10357},
+        {  170,11659},{  182,12938},{  199,14177},{  218,15374},
+        {  242,16519},{  269,17631},{  297,18739},{  330,19829},
+        {  372,20891},{  424,21916},{  493,22889},{  584,23784},
+        {  694,24596},{  824,25310},{  982,25896},{ 1164,26379}
       }
     },
     {
       /*Cb  qi=5  INTRA*/
       {
-        {   10,    2},{   82,  366},{  138,  743},{  159, 1187},
-        {  170, 1670},{  182, 2176},{  194, 2696},{  202, 3204},
-        {  214, 3654},{  232, 4063},{  244, 4461},{  259, 4852},
-        {  280, 5222},{  298, 5537},{  315, 5819},{  334, 6104},
-        {  358, 6389},{  381, 6667},{  410, 6915},{  427, 7190},
-        {  439, 7468},{  465, 7673},{  504, 7867},{  560, 8096}
+        {   17,  -43},{  108, 1675},{  175, 3438},{  244, 5024},
+        {  324, 6392},{  420, 7484},{  541, 8497},{  701, 9296},
+        {  788,10158},{  833,11089},{  940,11683},{ 1028,12204},
+        { 1139,12971},{ 1232,13835},{ 1368,14152},{ 1503,14548},
+        { 1613,15592},{ 1799,15910},{ 1917,16262},{ 2008,17036},
+        { 2086,17470},{ 2182,17508},{ 2317,17931},{ 2451,18378}
       },
       /*Cb  qi=5  INTER*/
       {
-        {  117,  -83},{  115,  289},{  114,  658},{  111, 1042},
-        {  110, 1446},{  116, 1859},{  124, 2276},{  130, 2698},
-        {  135, 3119},{  138, 3539},{  141, 3945},{  144, 4332},
-        {  148, 4703},{  153, 5066},{  158, 5416},{  161, 5746},
-        {  164, 6072},{  168, 6394},{  173, 6716},{  181, 7039},
-        {  190, 7344},{  195, 7652},{  198, 7975},{  200, 8302}
+        {   44,  -87},{   37, 1356},{   60, 3031},{   79, 4622},
+        {   90, 6117},{   93, 7576},{   96, 9024},{   96,10445},
+        {  102,11819},{  116,13132},{  130,14402},{  149,15608},
+        {  169,16720},{  188,17758},{  200,18822},{  213,19967},
+        {  241,21101},{  285,22191},{  362,23152},{  488,23889},
+        {  633,24528},{  854,24645},{ 1129,24624},{ 1404,24534}
       }
     },
     {
       /*Cr  qi=5  INTRA*/
       {
-        {    6,    4},{   77,  374},{  130,  764},{  152, 1231},
-        {  163, 1719},{  175, 2224},{  186, 2725},{  197, 3186},
-        {  211, 3622},{  222, 4010},{  245, 4368},{  270, 4742},
-        {  286, 5102},{  306, 5436},{  320, 5785},{  334, 6101},
-        {  363, 6386},{  389, 6662},{  413, 6914},{  439, 7148},
-        {  461, 7419},{  478, 7627},{  495, 7800},{  531, 8092}
+        {   10,  -62},{  102, 1690},{  161, 3459},{  237, 4993},
+        {  350, 6251},{  462, 7344},{  580, 8378},{  669, 9344},
+        {  706,10352},{  815,11227},{  958,11825},{ 1131,12420},
+        { 1281,12798},{ 1365,13210},{ 1524,13589},{ 1851,13703},
+        { 2089,14057},{ 2126,14353},{ 2148,14818},{ 2216,14894},
+        { 2256,15629},{ 2387,16282},{ 2503,16421},{ 2593,16869}
       },
       /*Cr  qi=5  INTER*/
       {
-        {  121,   19},{  112,  336},{  111,  657},{  114, 1037},
-        {  115, 1451},{  120, 1861},{  125, 2272},{  128, 2692},
-        {  131, 3112},{  133, 3526},{  136, 3933},{  140, 4329},
-        {  143, 4707},{  147, 5072},{  151, 5432},{  157, 5789},
-        {  162, 6128},{  167, 6459},{  175, 6800},{  183, 7115},
-        {  191, 7402},{  199, 7692},{  207, 7984},{  216, 8259}
+        {   30,   -1},{   36, 1350},{   62, 3017},{   76, 4624},
+        {   83, 6157},{   92, 7628},{  100, 9046},{  104,10424},
+        {  105,11766},{  113,13077},{  132,14369},{  159,15655},
+        {  194,16877},{  230,18054},{  298,19101},{  378,20078},
+        {  486,20878},{  672,21332},{  828,21950},{  971,22826},
+        { 1270,22635},{ 1483,22876},{ 1728,22894},{ 1945,23169}
       }
     }
   },
@@ -430,61 +430,61 @@
     {
       /*Y'  qi=6  INTRA*/
       {
-        {  195,  -62},{  255, 1587},{  337, 3305},{  476, 4655},
-        {  647, 5547},{  812, 6263},{  976, 6937},{ 1139, 7601},
-        { 1295, 8257},{ 1455, 8903},{ 1622, 9551},{ 1794,10157},
-        { 1963,10732},{ 2123,11297},{ 2269,11892},{ 2412,12506},
-        { 2558,13078},{ 2706,13650},{ 2850,14213},{ 2985,14755},
-        { 3118,15295},{ 3256,15813},{ 3395,16340},{ 3519,17010}
+        {   96,  -89},{  164, 1618},{  256, 3322},{  381, 4697},
+        {  498, 5820},{  590, 6889},{  690, 7851},{  800, 8727},
+        {  913, 9513},{ 1048,10235},{ 1201,10884},{ 1389,11391},
+        { 1558,11890},{ 1695,12397},{ 1817,12951},{ 1947,13576},
+        { 2084,14163},{ 2226,14702},{ 2393,15130},{ 2560,15467},
+        { 2737,15829},{ 2905,16242},{ 3088,16650},{ 3301,17122}
       },
       /*Y'  qi=6  INTER*/
       {
-        {  155, -118},{  107, 1348},{  147, 2882},{  185, 4440},
-        {  217, 5866},{  250, 7139},{  287, 8355},{  338, 9537},
-        {  405,10677},{  488,11763},{  587,12810},{  693,13850},
-        {  804,14888},{  924,15904},{ 1051,16883},{ 1185,17824},
-        { 1327,18720},{ 1478,19567},{ 1637,20351},{ 1807,21058},
-        { 1984,21690},{ 2171,22235},{ 2367,22697},{ 2568,23093}
+        {   40,  -35},{   47, 1330},{   74, 2879},{  109, 4487},
+        {  130, 6090},{  145, 7580},{  159, 8954},{  170,10274},
+        {  181,11563},{  195,12829},{  214,14057},{  237,15234},
+        {  264,16370},{  294,17480},{  327,18577},{  368,19642},
+        {  421,20670},{  485,21662},{  569,22597},{  674,23445},
+        {  810,24163},{  975,24758},{ 1164,25238},{ 1361,25696}
       }
     },
     {
       /*Cb  qi=6  INTRA*/
       {
-        {   11,    2},{   85,  366},{  142,  743},{  163, 1187},
-        {  176, 1669},{  189, 2174},{  200, 2691},{  208, 3192},
-        {  222, 3634},{  242, 4036},{  256, 4424},{  274, 4795},
-        {  296, 5134},{  314, 5423},{  337, 5693},{  359, 5975},
-        {  383, 6243},{  411, 6488},{  442, 6706},{  462, 6983},
-        {  483, 7250},{  512, 7449},{  549, 7636},{  605, 7799}
+        {   20,  -43},{  110, 1674},{  181, 3425},{  255, 4986},
+        {  345, 6311},{  443, 7389},{  567, 8363},{  729, 9123},
+        {  833, 9908},{  891,10850},{  984,11531},{ 1079,12018},
+        { 1182,12855},{ 1266,13748},{ 1407,14038},{ 1537,14513},
+        { 1638,15556},{ 1813,16004},{ 1948,16348},{ 2078,17001},
+        { 2184,17458},{ 2308,17377},{ 2461,17290},{ 2605,17786}
       },
       /*Cb  qi=6  INTER*/
       {
-        {  106,   -3},{  111,  332},{  117,  668},{  113, 1039},
-        {  114, 1442},{  120, 1856},{  128, 2272},{  134, 2691},
-        {  138, 3111},{  142, 3528},{  145, 3926},{  149, 4308},
-        {  155, 4677},{  159, 5029},{  164, 5367},{  168, 5692},
-        {  173, 6010},{  179, 6326},{  186, 6642},{  191, 6964},
-        {  201, 7275},{  210, 7581},{  216, 7898},{  224, 8221}
+        {   51, -103},{   42, 1369},{   67, 3030},{   86, 4616},
+        {   94, 6104},{   99, 7550},{  101, 8994},{  102,10404},
+        {  108,11754},{  125,13035},{  150,14268},{  174,15438},
+        {  202,16506},{  215,17563},{  225,18648},{  250,19765},
+        {  293,20863},{  358,21856},{  436,22828},{  581,23477},
+        {  787,23899},{ 1122,23891},{ 1566,23040},{ 2021,22281}
       }
     },
     {
       /*Cr  qi=6  INTRA*/
       {
-        {    7,    4},{   79,  374},{  133,  764},{  156, 1232},
-        {  168, 1722},{  180, 2227},{  193, 2729},{  206, 3189},
-        {  220, 3615},{  231, 3988},{  255, 4338},{  282, 4701},
-        {  300, 5039},{  323, 5340},{  343, 5665},{  363, 5968},
-        {  396, 6231},{  422, 6494},{  448, 6724},{  477, 6936},
-        {  496, 7206},{  517, 7409},{  533, 7591},{  555, 7913}
+        {   11,  -62},{  103, 1689},{  167, 3446},{  250, 4959},
+        {  367, 6189},{  482, 7264},{  605, 8265},{  697, 9216},
+        {  731,10261},{  849,11096},{  999,11655},{ 1197,12181},
+        { 1379,12401},{ 1450,12833},{ 1579,13287},{ 1929,13388},
+        { 2250,13482},{ 2320,13589},{ 2254,14353},{ 2284,14997},
+        { 2405,15463},{ 2503,16042},{ 2623,16168},{ 2708,16678}
       },
       /*Cr  qi=6  INTER*/
       {
-        {  100,   31},{  109,  342},{  115,  660},{  116, 1039},
-        {  118, 1448},{  123, 1858},{  128, 2274},{  131, 2692},
-        {  134, 3109},{  136, 3523},{  139, 3926},{  143, 4312},
-        {  148, 4681},{  154, 5040},{  157, 5391},{  163, 5737},
-        {  171, 6069},{  178, 6396},{  185, 6720},{  195, 7027},
-        {  205, 7320},{  214, 7610},{  227, 7896},{  249, 8152}
+        {   26,  -57},{   42, 1363},{   69, 3013},{   83, 4618},
+        {   89, 6149},{   98, 7612},{  108, 9017},{  111,10378},
+        {  114,11690},{  129,12956},{  152,14226},{  189,15473},
+        {  237,16640},{  274,17786},{  350,18839},{  473,19646},
+        {  612,20301},{  776,20818},{  982,21244},{ 1248,21545},
+        { 1517,21491},{ 1757,21704},{ 2020,21835},{ 2265,22039}
       }
     }
   },
@@ -492,61 +492,61 @@
     {
       /*Y'  qi=7  INTRA*/
       {
-        {  195,  -62},{  258, 1583},{  344, 3282},{  493, 4607},
-        {  674, 5472},{  849, 6160},{ 1025, 6812},{ 1196, 7460},
-        { 1360, 8101},{ 1528, 8730},{ 1700, 9356},{ 1879, 9940},
-        { 2057,10499},{ 2225,11041},{ 2383,11606},{ 2536,12196},
-        { 2691,12742},{ 2848,13295},{ 2999,13847},{ 3140,14366},
-        { 3279,14887},{ 3421,15386},{ 3569,15879},{ 3712,16474}
+        {  101,  -89},{  169, 1616},{  266, 3294},{  396, 4638},
+        {  519, 5736},{  619, 6782},{  726, 7723},{  846, 8567},
+        {  968, 9327},{ 1109,10029},{ 1266,10660},{ 1459,11148},
+        { 1635,11615},{ 1787,12082},{ 1923,12610},{ 2059,13205},
+        { 2209,13743},{ 2363,14278},{ 2538,14704},{ 2723,14996},
+        { 2910,15310},{ 3090,15670},{ 3279,16043},{ 3499,16460}
       },
       /*Y'  qi=7  INTER*/
       {
-        {  152, -129},{  108, 1347},{  149, 2880},{  189, 4422},
-        {  225, 5823},{  262, 7073},{  306, 8274},{  367, 9438},
-        {  446,10551},{  544,11615},{  658,12639},{  775,13657},
-        {  900,14670},{ 1039,15647},{ 1183,16590},{ 1331,17495},
-        { 1488,18347},{ 1654,19138},{ 1831,19864},{ 2017,20508},
-        { 2212,21055},{ 2413,21536},{ 2621,21925},{ 2816,22241}
+        {   46,   -5},{   48, 1338},{   75, 2886},{  110, 4489},
+        {  132, 6070},{  148, 7540},{  162, 8906},{  174,10214},
+        {  186,11495},{  202,12750},{  223,13963},{  250,15123},
+        {  280,16244},{  316,17333},{  357,18400},{  406,19449},
+        {  467,20466},{  544,21429},{  647,22304},{  777,23070},
+        {  937,23716},{ 1128,24239},{ 1344,24640},{ 1572,25006}
       }
     },
     {
       /*Cb  qi=7  INTRA*/
       {
-        {   11,    2},{   84,  366},{  142,  744},{  164, 1187},
-        {  176, 1669},{  190, 2174},{  203, 2685},{  211, 3177},
-        {  225, 3621},{  243, 4022},{  261, 4396},{  282, 4755},
-        {  306, 5085},{  326, 5361},{  350, 5609},{  373, 5886},
-        {  401, 6149},{  432, 6382},{  467, 6582},{  494, 6836},
-        {  519, 7096},{  544, 7299},{  585, 7473},{  649, 7631}
+        {   22,  -43},{  115, 1672},{  186, 3408},{  266, 4940},
+        {  361, 6236},{  464, 7295},{  592, 8227},{  755, 8929},
+        {  871, 9693},{  932,10646},{ 1027,11313},{ 1137,11751},
+        { 1232,12580},{ 1337,13443},{ 1515,13611},{ 1629,14057},
+        { 1760,14969},{ 1971,15326},{ 2079,15673},{ 2197,16291},
+        { 2318,16755},{ 2428,16767},{ 2592,16953},{ 2755,17175}
       },
       /*Cb  qi=7  INTER*/
       {
-        {  127,   25},{  118,  340},{  112,  666},{  110, 1040},
-        {  112, 1443},{  120, 1856},{  128, 2272},{  134, 2693},
-        {  138, 3115},{  142, 3527},{  146, 3923},{  150, 4300},
-        {  155, 4661},{  160, 5005},{  166, 5335},{  171, 5654},
-        {  177, 5966},{  183, 6284},{  191, 6595},{  200, 6899},
-        {  208, 7205},{  215, 7523},{  222, 7835},{  235, 8121}
+        {   67,  -91},{   41, 1373},{   67, 3033},{   87, 4608},
+        {   95, 6096},{   98, 7540},{  101, 8966},{  103,10366},
+        {  113,11701},{  130,12968},{  157,14175},{  187,15308},
+        {  207,16392},{  222,17428},{  249,18478},{  276,19596},
+        {  321,20670},{  406,21653},{  531,22452},{  717,22914},
+        {  978,23064},{ 1300,22875},{ 1669,22754},{ 2031,22574}
       }
     },
     {
       /*Cr  qi=7  INTRA*/
       {
-        {    6,    4},{   79,  374},{  134,  764},{  157, 1232},
-        {  169, 1722},{  181, 2226},{  194, 2728},{  208, 3187},
-        {  223, 3603},{  236, 3961},{  262, 4303},{  287, 4666},
-        {  307, 4995},{  334, 5282},{  356, 5584},{  381, 5861},
-        {  417, 6120},{  445, 6378},{  475, 6575},{  508, 6775},
-        {  525, 7062},{  543, 7278},{  563, 7464},{  589, 7756}
+        {   11,  -62},{  106, 1686},{  172, 3431},{  259, 4918},
+        {  380, 6124},{  500, 7181},{  627, 8177},{  727, 9089},
+        {  776,10071},{  908,10822},{ 1069,11360},{ 1288,11802},
+        { 1465,12026},{ 1521,12519},{ 1669,12821},{ 2054,12724},
+        { 2414,12657},{ 2535,12497},{ 2478,13141},{ 2474,13580},
+        { 2496,14544},{ 2600,15370},{ 2709,15545},{ 2761,16191}
       },
       /*Cr  qi=7  INTER*/
       {
-        {   95,   24},{  110,  344},{  115,  664},{  115, 1037},
-        {  117, 1448},{  123, 1859},{  128, 2275},{  131, 2692},
-        {  133, 3106},{  136, 3514},{  140, 3914},{  145, 4300},
-        {  150, 4664},{  153, 5019},{  159, 5362},{  166, 5698},
-        {  174, 6029},{  183, 6347},{  192, 6658},{  201, 6965},
-        {  211, 7258},{  224, 7537},{  236, 7813},{  248, 8078}
+        {   32,  -78},{   42, 1379},{   69, 3025},{   83, 4618},
+        {   89, 6141},{   99, 7590},{  106, 8973},{  110,10319},
+        {  114,11629},{  129,12904},{  159,14176},{  200,15396},
+        {  251,16523},{  324,17571},{  417,18495},{  549,19206},
+        {  734,19787},{  923,20355},{ 1164,20626},{ 1455,20761},
+        { 1746,20772},{ 1992,20653},{ 2267,20445},{ 2532,20477}
       }
     }
   },
@@ -554,61 +554,61 @@
     {
       /*Y'  qi=8  INTRA*/
       {
-        {  202,  -62},{  263, 1579},{  357, 3241},{  521, 4514},
-        {  716, 5338},{  906, 5995},{ 1096, 6622},{ 1280, 7252},
-        { 1455, 7877},{ 1631, 8495},{ 1813, 9102},{ 2001, 9668},
-        { 2190,10201},{ 2369,10718},{ 2535,11268},{ 2700,11835},
-        { 2866,12361},{ 3028,12883},{ 3186,13411},{ 3337,13913},
-        { 3481,14398},{ 3632,14869},{ 3787,15334},{ 3929,15913}
+        {  103,  -85},{  173, 1606},{  279, 3247},{  417, 4557},
+        {  547, 5630},{  655, 6648},{  767, 7571},{  894, 8398},
+        { 1025, 9121},{ 1176, 9787},{ 1344,10391},{ 1544,10862},
+        { 1730,11300},{ 1898,11698},{ 2043,12214},{ 2184,12832},
+        { 2342,13345},{ 2506,13838},{ 2687,14248},{ 2875,14555},
+        { 3070,14860},{ 3260,15180},{ 3459,15519},{ 3692,15912}
       },
       /*Y'  qi=8  INTER*/
       {
-        {  154, -112},{  111, 1348},{  153, 2875},{  197, 4392},
-        {  237, 5760},{  279, 6990},{  333, 8171},{  407, 9316},
-        {  504,10404},{  620,11437},{  749,12441},{  885,13438},
-        { 1030,14416},{ 1185,15361},{ 1348,16259},{ 1517,17111},
-        { 1693,17906},{ 1881,18625},{ 2080,19269},{ 2288,19822},
-        { 2505,20266},{ 2731,20604},{ 2960,20837},{ 3186,20985}
+        {   45, -124},{   47, 1339},{   78, 2903},{  113, 4496},
+        {  135, 6055},{  152, 7496},{  167, 8839},{  179,10139},
+        {  193,11414},{  212,12657},{  236,13852},{  267,14993},
+        {  301,16100},{  342,17176},{  391,18228},{  452,19255},
+        {  528,20232},{  627,21132},{  754,21932},{  914,22610},
+        { 1112,23133},{ 1334,23548},{ 1588,23836},{ 1867,24005}
       }
     },
     {
       /*Cb  qi=8  INTRA*/
       {
-        {   11,    2},{   89,  366},{  149,  744},{  170, 1188},
-        {  183, 1670},{  198, 2174},{  212, 2683},{  222, 3172},
-        {  236, 3608},{  255, 3998},{  274, 4361},{  297, 4701},
-        {  321, 5016},{  349, 5283},{  378, 5520},{  402, 5782},
-        {  434, 6024},{  469, 6246},{  506, 6441},{  539, 6686},
-        {  565, 6933},{  590, 7116},{  629, 7281},{  700, 7370}
+        {   23,  -43},{  118, 1670},{  192, 3391},{  284, 4886},
+        {  394, 6135},{  501, 7174},{  632, 8078},{  801, 8746},
+        {  932, 9449},{  996,10370},{ 1094,11012},{ 1238,11391},
+        { 1340,12220},{ 1432,13152},{ 1589,13412},{ 1703,13720},
+        { 1910,14322},{ 2153,14432},{ 2270,14649},{ 2442,15157},
+        { 2517,15729},{ 2583,15707},{ 2801,15770},{ 3035,15743}
       },
       /*Cb  qi=8  INTER*/
       {
-        {  105,   -1},{  111,  332},{  114,  667},{  111, 1044},
-        {  114, 1444},{  121, 1854},{  129, 2272},{  136, 2692},
-        {  141, 3109},{  145, 3516},{  150, 3907},{  154, 4281},
-        {  160, 4633},{  166, 4966},{  172, 5286},{  179, 5604},
-        {  184, 5918},{  191, 6225},{  200, 6531},{  213, 6833},
-        {  225, 7134},{  233, 7441},{  246, 7743},{  255, 8048}
+        {   33, -120},{   38, 1397},{   67, 3056},{   85, 4622},
+        {   94, 6089},{   99, 7520},{  102, 8941},{  106,10322},
+        {  118,11635},{  136,12882},{  167,14043},{  200,15137},
+        {  224,16206},{  246,17270},{  269,18364},{  304,19451},
+        {  366,20470},{  473,21333},{  657,21881},{  901,22244},
+        { 1197,22421},{ 1568,22181},{ 1981,21765},{ 2364,21476}
       }
     },
     {
       /*Cr  qi=8  INTRA*/
       {
-        {    6,    4},{   82,  374},{  140,  765},{  165, 1233},
-        {  178, 1723},{  189, 2227},{  201, 2727},{  215, 3180},
-        {  233, 3587},{  251, 3933},{  277, 4269},{  303, 4622},
-        {  324, 4932},{  354, 5201},{  380, 5490},{  410, 5751},
-        {  449, 5994},{  477, 6241},{  510, 6435},{  543, 6641},
-        {  563, 6909},{  587, 7106},{  612, 7289},{  653, 7563}
+        {   12,  -62},{  113, 1684},{  183, 3407},{  277, 4853},
+        {  407, 6023},{  531, 7073},{  663, 8042},{  774, 8933},
+        {  840, 9851},{  980,10523},{ 1140,11077},{ 1370,11447},
+        { 1549,11632},{ 1605,12154},{ 1770,12458},{ 2233,12167},
+        { 2613,12045},{ 2732,11761},{ 2701,12148},{ 2619,13574},
+        { 2716,14534},{ 2813,15411},{ 2980,15521},{ 3102,16078}
       },
       /*Cr  qi=8  INTER*/
       {
-        {  108,   12},{  109,  332},{  112,  659},{  116, 1040},
-        {  119, 1445},{  124, 1857},{  130, 2274},{  133, 2692},
-        {  135, 3107},{  138, 3512},{  143, 3902},{  147, 4281},
-        {  153, 4641},{  160, 4985},{  167, 5326},{  175, 5660},
-        {  184, 5981},{  194, 6283},{  204, 6586},{  217, 6884},
-        {  230, 7168},{  241, 7452},{  257, 7723},{  263, 7987}
+        {   26,  -88},{   41, 1395},{   69, 3045},{   82, 4626},
+        {   88, 6132},{   99, 7573},{  107, 8946},{  111,10258},
+        {  120,11543},{  138,12822},{  174,14055},{  235,15204},
+        {  306,16267},{  388,17262},{  488,18149},{  634,18846},
+        {  859,19259},{ 1124,19442},{ 1417,19504},{ 1629,19852},
+        { 1939,19633},{ 2236,19430},{ 2556,19217},{ 2845,19164}
       }
     }
   },
@@ -616,61 +616,61 @@
     {
       /*Y'  qi=9  INTRA*/
       {
-        {  202,  -61},{  265, 1574},{  366, 3211},{  542, 4451},
-        {  750, 5241},{  954, 5870},{ 1157, 6482},{ 1354, 7089},
-        { 1539, 7692},{ 1726, 8292},{ 1921, 8872},{ 2119, 9416},
-        { 2316, 9924},{ 2505,10409},{ 2681,10938},{ 2854,11483},
-        { 3029,11982},{ 3204,12489},{ 3369,12999},{ 3526,13466},
-        { 3677,13926},{ 3839,14359},{ 4002,14798},{ 4149,15376}
+        {  112,  -86},{  178, 1600},{  293, 3197},{  442, 4468},
+        {  578, 5523},{  695, 6513},{  815, 7413},{  946, 8228},
+        { 1083, 8934},{ 1242, 9570},{ 1416,10161},{ 1620,10634},
+        { 1817,11057},{ 2003,11434},{ 2153,11948},{ 2297,12555},
+        { 2473,13038},{ 2647,13505},{ 2833,13903},{ 3035,14175},
+        { 3243,14440},{ 3444,14760},{ 3645,15092},{ 3876,15520}
       },
       /*Y'  qi=9  INTER*/
       {
-        {  149, -122},{  112, 1350},{  155, 2869},{  203, 4369},
-        {  249, 5707},{  298, 6914},{  362, 8081},{  452, 9202},
-        {  566,10263},{  703,11262},{  851,12236},{ 1004,13206},
-        { 1166,14153},{ 1339,15058},{ 1516,15916},{ 1703,16713},
-        { 1903,17437},{ 2110,18100},{ 2328,18668},{ 2559,19128},
-        { 2795,19487},{ 3038,19759},{ 3280,19974},{ 3523,20082}
+        {   42,  -94},{   47, 1335},{   80, 2899},{  115, 4489},
+        {  137, 6036},{  155, 7459},{  170, 8790},{  183,10079},
+        {  199,11343},{  221,12572},{  249,13749},{  284,14876},
+        {  325,15962},{  375,17016},{  434,18043},{  510,19025},
+        {  604,19957},{  726,20794},{  884,21502},{ 1074,22090},
+        { 1302,22533},{ 1565,22833},{ 1854,22997},{ 2179,23014}
       }
     },
     {
       /*Cb  qi=9  INTRA*/
       {
-        {   11,    2},{   90,  366},{  150,  744},{  172, 1189},
-        {  184, 1670},{  199, 2172},{  215, 2679},{  226, 3164},
-        {  241, 3594},{  263, 3971},{  283, 4324},{  307, 4654},
-        {  335, 4948},{  367, 5195},{  401, 5419},{  426, 5676},
-        {  457, 5908},{  498, 6104},{  539, 6299},{  566, 6555},
-        {  597, 6797},{  627, 6970},{  669, 7125},{  728, 7283}
+        {   24,  -43},{  122, 1669},{  200, 3382},{  298, 4845},
+        {  414, 6044},{  524, 7060},{  660, 7945},{  829, 8612},
+        {  964, 9304},{ 1054,10140},{ 1157,10787},{ 1273,11288},
+        { 1404,12034},{ 1526,12817},{ 1669,13115},{ 1787,13512},
+        { 1991,14147},{ 2221,14370},{ 2331,14781},{ 2504,15307},
+        { 2627,15754},{ 2719,15891},{ 2919,15724},{ 3152,16066}
       },
       /*Cb  qi=9  INTER*/
       {
-        {   85,  -46},{  106,  314},{  119,  666},{  113, 1040},
-        {  114, 1444},{  121, 1856},{  129, 2270},{  136, 2688},
-        {  142, 3104},{  146, 3507},{  150, 3888},{  157, 4253},
-        {  164, 4600},{  171, 4931},{  177, 5249},{  185, 5561},
-        {  193, 5868},{  203, 6171},{  214, 6475},{  225, 6771},
-        {  239, 7068},{  252, 7368},{  263, 7665},{  279, 7962}
+        {   33, -120},{   40, 1403},{   69, 3054},{   87, 4613},
+        {   96, 6074},{  101, 7497},{  105, 8910},{  110,10281},
+        {  123,11586},{  147,12817},{  182,13961},{  221,15030},
+        {  252,16062},{  275,17097},{  310,18151},{  358,19220},
+        {  445,20163},{  601,20850},{  780,21497},{ 1027,21841},
+        { 1368,21747},{ 1843,20928},{ 2229,20380},{ 2637,19801}
       }
     },
     {
       /*Cr  qi=9  INTRA*/
       {
-        {    7,    4},{   84,  375},{  142,  765},{  167, 1234},
-        {  179, 1723},{  190, 2226},{  203, 2725},{  218, 3173},
-        {  238, 3571},{  257, 3910},{  288, 4231},{  317, 4564},
-        {  337, 4866},{  370, 5125},{  403, 5393},{  433, 5642},
-        {  475, 5866},{  509, 6100},{  539, 6298},{  575, 6487},
-        {  598, 6754},{  621, 6972},{  649, 7145},{  701, 7424}
+        {   14,  -62},{  116, 1683},{  193, 3391},{  294, 4811},
+        {  429, 5951},{  556, 6979},{  685, 7965},{  795, 8851},
+        {  868, 9749},{ 1011,10425},{ 1184,10931},{ 1434,11205},
+        { 1635,11284},{ 1737,11660},{ 1921,11989},{ 2325,11842},
+        { 2681,11803},{ 2740,11648},{ 2682,12074},{ 2661,13056},
+        { 2772,13794},{ 2853,14451},{ 2993,14606},{ 3069,15262}
       },
       /*Cr  qi=9  INTER*/
       {
-        {  101,    8},{  107,  332},{  112,  661},{  115, 1041},
-        {  118, 1447},{  124, 1858},{  130, 2273},{  133, 2690},
-        {  136, 3103},{  139, 3505},{  143, 3891},{  149, 4255},
-        {  156, 4608},{  163, 4954},{  170, 5287},{  179, 5614},
-        {  192, 5924},{  206, 6222},{  218, 6518},{  232, 6816},
-        {  245, 7097},{  261, 7357},{  277, 7627},{  292, 7894}
+        {   21, -102},{   43, 1399},{   71, 3047},{   84, 4621},
+        {   90, 6121},{  101, 7552},{  111, 8914},{  117,10218},
+        {  126,11494},{  146,12754},{  187,13973},{  248,15124},
+        {  321,16189},{  430,17082},{  560,17851},{  733,18462},
+        {  968,18875},{ 1272,18998},{ 1555,19170},{ 1863,19105},
+        { 2134,18947},{ 2422,18959},{ 2749,18779},{ 3051,18720}
       }
     }
   },
@@ -678,61 +678,61 @@
     {
       /*Y'  qi=10  INTRA*/
       {
-        {  211,  -60},{  276, 1567},{  389, 3154},{  582, 4321},
-        {  807, 5059},{ 1028, 5665},{ 1246, 6262},{ 1453, 6863},
-        { 1647, 7465},{ 1847, 8054},{ 2051, 8619},{ 2260, 9143},
-        { 2468, 9638},{ 2664,10121},{ 2851,10632},{ 3038,11142},
-        { 3221,11626},{ 3403,12114},{ 3578,12597},{ 3743,13052},
-        { 3898,13494},{ 4061,13913},{ 4233,14311},{ 4398,14832}
+        {  112,  -87},{  181, 1597},{  303, 3169},{  458, 4413},
+        {  602, 5448},{  729, 6402},{  856, 7272},{  994, 8066},
+        { 1139, 8749},{ 1309, 9355},{ 1492, 9925},{ 1704,10382},
+        { 1913,10774},{ 2103,11128},{ 2270,11604},{ 2439,12168},
+        { 2625,12609},{ 2815,13031},{ 3017,13413},{ 3219,13681},
+        { 3436,13934},{ 3651,14215},{ 3862,14514},{ 4101,14861}
       },
       /*Y'  qi=10  INTER*/
       {
-        {  154,  -91},{  118, 1343},{  164, 2856},{  218, 4328},
-        {  271, 5636},{  329, 6826},{  407, 7972},{  515, 9068},
-        {  654,10092},{  810,11068},{  974,12028},{ 1150,12966},
-        { 1334,13880},{ 1522,14752},{ 1722,15561},{ 1930,16300},
-        { 2151,16969},{ 2385,17544},{ 2624,18031},{ 2874,18417},
-        { 3134,18699},{ 3390,18914},{ 3649,19031},{ 3901,19135}
+        {   39,  -89},{   48, 1328},{   84, 2884},{  120, 4469},
+        {  143, 5995},{  162, 7401},{  178, 8719},{  193, 9997},
+        {  211,11250},{  236,12464},{  269,13623},{  311,14729},
+        {  360,15793},{  418,16828},{  492,17823},{  587,18758},
+        {  706,19626},{  862,20371},{ 1057,20978},{ 1290,21452},
+        { 1560,21768},{ 1867,21934},{ 2197,21992},{ 2532,21975}
       }
     },
     {
       /*Cb  qi=10  INTRA*/
       {
-        {   11,    2},{   93,  367},{  157,  745},{  181, 1190},
-        {  192, 1672},{  207, 2173},{  223, 2675},{  235, 3152},
-        {  251, 3574},{  277, 3934},{  303, 4264},{  331, 4574},
-        {  365, 4844},{  399, 5073},{  433, 5289},{  464, 5539},
-        {  499, 5759},{  542, 5931},{  585, 6126},{  610, 6389},
-        {  642, 6628},{  678, 6799},{  726, 6954},{  805, 7071}
+        {   24,  -44},{  124, 1667},{  209, 3365},{  317, 4782},
+        {  436, 5944},{  549, 6960},{  698, 7819},{  872, 8453},
+        { 1005, 9096},{ 1119, 9842},{ 1243,10468},{ 1384,10905},
+        { 1529,11622},{ 1642,12469},{ 1791,12766},{ 1942,13050},
+        { 2168,13550},{ 2397,13739},{ 2515,14163},{ 2682,14664},
+        { 2790,15069},{ 2877,15250},{ 3093,15224},{ 3308,15226}
       },
       /*Cb  qi=10  INTER*/
       {
-        {  119,  -59},{  117,  269},{  115,  608},{  116, 1014},
-        {  118, 1437},{  127, 1851},{  135, 2263},{  143, 2676},
-        {  149, 3086},{  153, 3482},{  158, 3856},{  165, 4215},
-        {  173, 4557},{  182, 4882},{  190, 5191},{  199, 5495},
-        {  209, 5800},{  221, 6099},{  234, 6396},{  248, 6690},
-        {  265, 6978},{  283, 7270},{  297, 7575},{  313, 7874}
+        {   47, -121},{   44, 1400},{   73, 3047},{   91, 4597},
+        {   99, 6054},{  105, 7477},{  111, 8872},{  119,10217},
+        {  133,11498},{  162,12692},{  204,13806},{  247,14858},
+        {  274,15896},{  298,16942},{  357,17942},{  434,18956},
+        {  543,19828},{  734,20427},{  968,20905},{ 1341,20745},
+        { 1814,20243},{ 2248,19707},{ 2668,19395},{ 3099,19014}
       }
     },
     {
       /*Cr  qi=10  INTRA*/
       {
-        {    7,    4},{   87,  377},{  147,  768},{  173, 1236},
-        {  187, 1726},{  198, 2230},{  212, 2725},{  230, 3165},
-        {  251, 3545},{  275, 3865},{  307, 4163},{  340, 4477},
-        {  367, 4758},{  403, 5010},{  436, 5277},{  470, 5513},
-        {  513, 5723},{  550, 5945},{  586, 6137},{  622, 6318},
-        {  648, 6579},{  674, 6780},{  702, 6944},{  729, 7237}
+        {   16,  -63},{  119, 1681},{  202, 3367},{  310, 4747},
+        {  456, 5854},{  588, 6864},{  727, 7824},{  853, 8681},
+        {  932, 9535},{ 1095,10076},{ 1281,10525},{ 1516,10897},
+        { 1715,10981},{ 1911,11128},{ 2099,11449},{ 2456,11488},
+        { 2788,11626},{ 2816,11392},{ 2780,11628},{ 2788,12091},
+        { 2866,13293},{ 2976,13891},{ 3136,14213},{ 3226,14902}
       },
       /*Cr  qi=10  INTER*/
       {
-        {  109,   19},{  114,  326},{  118,  646},{  120, 1035},
-        {  123, 1442},{  129, 1853},{  134, 2268},{  139, 2685},
-        {  141, 3094},{  145, 3489},{  151, 3869},{  157, 4230},
-        {  165, 4572},{  174, 4904},{  184, 5229},{  195, 5542},
-        {  209, 5845},{  224, 6140},{  240, 6428},{  257, 6709},
-        {  274, 6982},{  290, 7254},{  305, 7523},{  321, 7785}
+        {   37, -129},{   46, 1406},{   75, 3041},{   87, 4610},
+        {   94, 6102},{  107, 7526},{  117, 8870},{  124,10155},
+        {  137,11415},{  167,12646},{  213,13856},{  293,14935},
+        {  394,15879},{  507,16749},{  628,17592},{  846,18033},
+        { 1140,18065},{ 1445,18331},{ 1751,18320},{ 2077,18270},
+        { 2497,17968},{ 2796,17749},{ 3062,17422},{ 3379,17287}
       }
     }
   },
@@ -740,61 +740,61 @@
     {
       /*Y'  qi=11  INTRA*/
       {
-        {  216,  -62},{  278, 1563},{  399, 3133},{  605, 4265},
-        {  843, 4969},{ 1078, 5554},{ 1309, 6137},{ 1529, 6718},
-        { 1735, 7304},{ 1946, 7872},{ 2162, 8411},{ 2379, 8919},
-        { 2597, 9388},{ 2806, 9841},{ 3005,10329},{ 3199,10821},
-        { 3391,11282},{ 3578,11758},{ 3760,12221},{ 3934,12634},
-        { 4089,13051},{ 4253,13447},{ 4430,13818},{ 4598,14334}
+        {  119,  -83},{  188, 1582},{  320, 3112},{  485, 4327},
+        {  639, 5339},{  776, 6269},{  916, 7105},{ 1064, 7862},
+        { 1218, 8518},{ 1400, 9102},{ 1591, 9649},{ 1818,10058},
+        { 2040,10414},{ 2237,10774},{ 2414,11246},{ 2595,11795},
+        { 2792,12223},{ 2988,12628},{ 3198,12988},{ 3421,13217},
+        { 3637,13480},{ 3857,13743},{ 4091,13986},{ 4337,14328}
       },
       /*Y'  qi=11  INTER*/
       {
-        {  153,  -95},{  119, 1342},{  167, 2852},{  226, 4307},
-        {  286, 5589},{  353, 6756},{  447, 7881},{  576, 8947},
-        {  734, 9940},{  908,10890},{ 1092,11824},{ 1286,12735},
-        { 1488,13608},{ 1698,14431},{ 1917,15188},{ 2150,15866},
-        { 2393,16462},{ 2643,16965},{ 2909,17368},{ 3185,17655},
-        { 3461,17845},{ 3731,17991},{ 3991,18093},{ 4242,18199}
+        {   56,  -88},{   46, 1353},{   85, 2904},{  121, 4477},
+        {  145, 5975},{  165, 7355},{  182, 8660},{  199, 9926},
+        {  219,11168},{  248,12366},{  287,13502},{  336,14591},
+        {  394,15642},{  466,16647},{  559,17599},{  674,18492},
+        {  820,19288},{ 1010,19942},{ 1242,20453},{ 1517,20809},
+        { 1829,21026},{ 2169,21103},{ 2521,21071},{ 2875,21019}
       }
     },
     {
       /*Cb  qi=11  INTRA*/
       {
-        {   12,    2},{   94,  367},{  158,  745},{  182, 1191},
-        {  194, 1673},{  209, 2173},{  225, 2670},{  239, 3138},
-        {  257, 3553},{  285, 3907},{  314, 4228},{  345, 4525},
-        {  382, 4780},{  420, 5001},{  457, 5206},{  486, 5454},
-        {  520, 5672},{  570, 5837},{  612, 6036},{  640, 6292},
-        {  682, 6499},{  719, 6665},{  763, 6827},{  828, 6982}
+        {   27,  -44},{  128, 1664},{  217, 3344},{  334, 4719},
+        {  467, 5834},{  591, 6824},{  747, 7656},{  933, 8245},
+        { 1075, 8882},{ 1195, 9604},{ 1351,10103},{ 1485,10577},
+        { 1631,11332},{ 1797,11984},{ 1953,12237},{ 2088,12618},
+        { 2299,13189},{ 2545,13284},{ 2683,13727},{ 2860,14313},
+        { 3031,14462},{ 3124,14660},{ 3320,14743},{ 3504,14869}
       },
       /*Cb  qi=11  INTER*/
       {
-        {   98,  -50},{  111,  274},{  116,  608},{  115, 1015},
-        {  119, 1438},{  127, 1850},{  135, 2262},{  143, 2673},
-        {  150, 3077},{  155, 3468},{  161, 3838},{  168, 4190},
-        {  177, 4524},{  187, 4846},{  197, 5154},{  208, 5456},
-        {  219, 5751},{  233, 6043},{  248, 6336},{  264, 6626},
-        {  282, 6918},{  301, 7210},{  325, 7492},{  344, 7781}
+        {   37, -155},{   42, 1419},{   72, 3066},{   89, 4607},
+        {   97, 6044},{  105, 7453},{  113, 8836},{  123,10169},
+        {  142,11430},{  177,12593},{  225,13659},{  271,14669},
+        {  308,15689},{  342,16721},{  402,17737},{  506,18706},
+        {  655,19499},{  908,19861},{ 1200,20117},{ 1535,20139},
+        { 1997,19615},{ 2458,18840},{ 2905,17885},{ 3353,17074}
       }
     },
     {
       /*Cr  qi=11  INTRA*/
       {
-        {    7,    4},{   88,  377},{  148,  768},{  174, 1237},
-        {  188, 1727},{  200, 2229},{  215, 2722},{  233, 3153},
-        {  256, 3527},{  281, 3839},{  316, 4124},{  355, 4410},
-        {  382, 4684},{  419, 4947},{  458, 5194},{  495, 5407},
-        {  539, 5611},{  576, 5833},{  615, 6028},{  655, 6195},
-        {  687, 6432},{  717, 6634},{  740, 6813},{  771, 7114}
+        {   20,  -62},{  125, 1678},{  212, 3344},{  331, 4694},
+        {  479, 5776},{  613, 6765},{  759, 7705},{  893, 8538},
+        {  993, 9342},{ 1184, 9812},{ 1371,10251},{ 1578,10615},
+        { 1784,10720},{ 2006,10850},{ 2174,11196},{ 2556,11265},
+        { 2938,11288},{ 2950,11091},{ 2887,11405},{ 2939,12208},
+        { 3024,12915},{ 3220,13300},{ 3407,13466},{ 3534,14026}
       },
       /*Cr  qi=11  INTER*/
       {
-        {  101,   10},{  110,  322},{  118,  647},{  120, 1035},
-        {  123, 1442},{  129, 1853},{  134, 2266},{  138, 2681},
-        {  142, 3087},{  146, 3477},{  152, 3852},{  161, 4209},
-        {  169, 4550},{  178, 4878},{  189, 5193},{  203, 5499},
-        {  220, 5797},{  236, 6090},{  253, 6378},{  274, 6648},
-        {  293, 6915},{  310, 7190},{  333, 7445},{  359, 7698}
+        {   26, -137},{   45, 1421},{   74, 3058},{   86, 4613},
+        {   94, 6089},{  107, 7496},{  119, 8824},{  129,10098},
+        {  145,11350},{  180,12569},{  240,13723},{  328,14768},
+        {  452,15658},{  590,16477},{  755,17153},{ 1020,17461},
+        { 1286,17738},{ 1565,18046},{ 1875,18191},{ 2207,18103},
+        { 2533,18118},{ 2867,18047},{ 3177,17957},{ 3489,17998}
       }
     }
   },
@@ -802,61 +802,61 @@
     {
       /*Y'  qi=12  INTRA*/
       {
-        {  219,  -60},{  289, 1553},{  423, 3075},{  646, 4142},
-        {  901, 4805},{ 1151, 5375},{ 1393, 5949},{ 1625, 6529},
-        { 1842, 7107},{ 2065, 7669},{ 2291, 8201},{ 2516, 8694},
-        { 2740, 9156},{ 2957, 9602},{ 3164,10078},{ 3365,10563},
-        { 3563,11006},{ 3757,11456},{ 3944,11910},{ 4118,12322},
-        { 4275,12736},{ 4442,13112},{ 4625,13472},{ 4793,13992}
+        {  118,  -82},{  196, 1575},{  339, 3065},{  515, 4240},
+        {  678, 5219},{  826, 6118},{  978, 6925},{ 1137, 7651},
+        { 1305, 8280},{ 1506, 8822},{ 1715, 9334},{ 1955, 9716},
+        { 2191,10057},{ 2400,10412},{ 2592,10853},{ 2795,11346},
+        { 3006,11750},{ 3213,12135},{ 3442,12464},{ 3673,12670},
+        { 3903,12903},{ 4137,13170},{ 4381,13404},{ 4640,13698}
       },
       /*Y'  qi=12  INTER*/
       {
-        {  147,  -51},{  125, 1342},{  177, 2838},{  240, 4266},
-        {  306, 5525},{  384, 6683},{  496, 7791},{  645, 8834},
-        {  823, 9805},{ 1016,10735},{ 1218,11647},{ 1427,12540},
-        { 1644,13390},{ 1871,14180},{ 2108,14902},{ 2358,15533},
-        { 2617,16070},{ 2889,16513},{ 3174,16848},{ 3467,17059},
-        { 3758,17206},{ 4034,17335},{ 4295,17431},{ 4544,17551}
+        {   49,  -74},{   47, 1351},{   88, 2898},{  124, 4461},
+        {  148, 5940},{  170, 7303},{  188, 8595},{  206, 9856},
+        {  229,11085},{  264,12260},{  311,13374},{  370,14438},
+        {  441,15455},{  528,16428},{  640,17344},{  784,18171},
+        {  968,18873},{ 1203,19416},{ 1486,19791},{ 1809,20022},
+        { 2164,20115},{ 2541,20079},{ 2911,19995},{ 3270,19907}
       }
     },
     {
       /*Cb  qi=12  INTRA*/
       {
-        {   12,    2},{   96,  367},{  159,  746},{  183, 1192},
-        {  198, 1673},{  215, 2171},{  234, 2662},{  249, 3116},
-        {  270, 3514},{  301, 3850},{  334, 4147},{  369, 4426},
-        {  410, 4680},{  447, 4905},{  485, 5106},{  522, 5341},
-        {  558, 5549},{  608, 5710},{  654, 5904},{  687, 6143},
-        {  733, 6345},{  782, 6502},{  825, 6658},{  890, 6833}
+        {   27,  -44},{  134, 1661},{  227, 3321},{  355, 4650},
+        {  494, 5732},{  623, 6703},{  786, 7511},{  979, 8065},
+        { 1130, 8685},{ 1278, 9328},{ 1454, 9753},{ 1586,10240},
+        { 1760,10939},{ 1985,11461},{ 2141,11694},{ 2254,12132},
+        { 2471,12758},{ 2715,12903},{ 2828,13282},{ 3007,13818},
+        { 3222,13998},{ 3304,14230},{ 3464,14284},{ 3784,14491}
       },
       /*Cb  qi=12  INTER*/
       {
-        {  122,   46},{  114,  328},{  113,  631},{  117, 1026},
-        {  124, 1443},{  133, 1856},{  143, 2268},{  151, 2677},
-        {  157, 3074},{  164, 3454},{  173, 3814},{  181, 4155},
-        {  192, 4480},{  203, 4793},{  214, 5095},{  227, 5390},
-        {  242, 5683},{  258, 5973},{  275, 6262},{  293, 6550},
-        {  316, 6839},{  340, 7127},{  366, 7406},{  390, 7698}
+        {   45, -142},{   45, 1420},{   74, 3060},{   90, 4593},
+        {   99, 6024},{  108, 7420},{  117, 8789},{  129,10107},
+        {  154,11351},{  193,12504},{  250,13550},{  303,14517},
+        {  337,15540},{  379,16590},{  468,17536},{  594,18403},
+        {  824,18936},{ 1123,19171},{ 1546,19030},{ 2055,18518},
+        { 2461,18102},{ 2882,17588},{ 3274,17153},{ 3692,16662}
       }
     },
     {
       /*Cr  qi=12  INTRA*/
       {
-        {    8,    4},{   92,  378},{  152,  770},{  178, 1238},
-        {  192, 1728},{  204, 2228},{  220, 2715},{  243, 3132},
-        {  267, 3492},{  293, 3795},{  335, 4067},{  379, 4327},
-        {  412, 4578},{  449, 4833},{  488, 5084},{  529, 5298},
-        {  579, 5484},{  619, 5686},{  656, 5886},{  697, 6070},
-        {  733, 6298},{  757, 6487},{  779, 6668},{  802, 6957}
+        {   22,  -62},{  131, 1676},{  225, 3315},{  354, 4631},
+        {  508, 5695},{  647, 6660},{  796, 7552},{  939, 8347},
+        { 1065, 9108},{ 1275, 9533},{ 1457, 9941},{ 1647,10348},
+        { 1869,10430},{ 2079,10489},{ 2251,10877},{ 2702,10936},
+        { 3065,10951},{ 3016,10785},{ 3012,10879},{ 3074,11112},
+        { 3214,12232},{ 3434,12627},{ 3598,12990},{ 3745,13550}
       },
       /*Cr  qi=12  INTER*/
       {
-        {  101,   45},{  112,  351},{  119,  665},{  122, 1044},
-        {  127, 1450},{  133, 1861},{  140, 2273},{  145, 2681},
-        {  150, 3082},{  156, 3464},{  163, 3828},{  172, 4176},
-        {  182, 4506},{  194, 4823},{  208, 5134},{  225, 5435},
-        {  242, 5728},{  259, 6015},{  281, 6293},{  305, 6561},
-        {  327, 6822},{  352, 7080},{  375, 7345},{  396, 7617}
+        {   30, -142},{   48, 1422},{   76, 3052},{   87, 4601},
+        {   95, 6068},{  110, 7466},{  123, 8775},{  134,10032},
+        {  154,11264},{  195,12464},{  274,13585},{  385,14562},
+        {  527,15394},{  701,16107},{  918,16666},{ 1199,16947},
+        { 1519,17005},{ 1880,17098},{ 2181,17083},{ 2578,16824},
+        { 2983,16660},{ 3282,16311},{ 3533,16181},{ 3863,16052}
       }
     }
   },
@@ -864,61 +864,61 @@
     {
       /*Y'  qi=13  INTRA*/
       {
-        {  220,  -58},{  290, 1551},{  428, 3059},{  657, 4111},
-        {  917, 4766},{ 1172, 5334},{ 1419, 5906},{ 1656, 6481},
-        { 1877, 7054},{ 2104, 7607},{ 2334, 8134},{ 2564, 8620},
-        { 2791, 9071},{ 3010, 9511},{ 3221, 9978},{ 3425,10450},
-        { 3625,10896},{ 3821,11350},{ 4011,11779},{ 4189,12178},
-        { 4349,12587},{ 4519,12957},{ 4702,13304},{ 4869,13828}
+        {  122,  -85},{  201, 1572},{  349, 3040},{  533, 4191},
+        {  704, 5150},{  862, 6023},{ 1018, 6812},{ 1181, 7526},
+        { 1360, 8131},{ 1568, 8659},{ 1789, 9140},{ 2042, 9486},
+        { 2288, 9818},{ 2508,10162},{ 2713,10582},{ 2925,11063},
+        { 3151,11443},{ 3372,11794},{ 3607,12099},{ 3849,12278},
+        { 4092,12471},{ 4346,12690},{ 4603,12891},{ 4866,13134}
       },
       /*Y'  qi=13  INTER*/
       {
-        {  158,  -46},{  126, 1342},{  179, 2835},{  244, 4255},
-        {  313, 5504},{  397, 6654},{  516, 7754},{  674, 8786},
-        {  861, 9745},{ 1061,10667},{ 1271,11568},{ 1489,12446},
-        { 1712,13280},{ 1944,14059},{ 2189,14760},{ 2450,15360},
-        { 2717,15880},{ 2998,16278},{ 3293,16571},{ 3591,16787},
-        { 3886,16908},{ 4162,17014},{ 4426,17124},{ 4684,17257}
+        {   46,  -70},{   49, 1335},{   91, 2883},{  128, 4446},
+        {  154, 5908},{  177, 7251},{  195, 8533},{  215, 9784},
+        {  243,10996},{  284,12149},{  339,13243},{  408,14281},
+        {  494,15274},{  601,16210},{  739,17065},{  916,17814},
+        { 1145,18406},{ 1426,18834},{ 1756,19099},{ 2126,19212},
+        { 2518,19213},{ 2907,19143},{ 3275,19027},{ 3615,18903}
       }
     },
     {
       /*Cb  qi=13  INTRA*/
       {
-        {   12,    2},{   97,  367},{  160,  746},{  183, 1192},
-        {  198, 1673},{  216, 2170},{  235, 2659},{  251, 3110},
-        {  273, 3502},{  305, 3834},{  340, 4127},{  377, 4398},
-        {  418, 4648},{  459, 4863},{  499, 5058},{  534, 5301},
-        {  571, 5508},{  619, 5675},{  666, 5868},{  702, 6098},
-        {  749, 6301},{  794, 6459},{  835, 6617},{  889, 6808}
+        {   27,  -45},{  136, 1660},{  239, 3308},{  379, 4600},
+        {  522, 5649},{  656, 6591},{  834, 7369},{ 1039, 7902},
+        { 1217, 8475},{ 1359, 9107},{ 1524, 9518},{ 1676, 9952},
+        { 1860,10663},{ 2096,11161},{ 2253,11401},{ 2356,11884},
+        { 2600,12444},{ 2883,12469},{ 3014,12722},{ 3224,13006},
+        { 3444,13132},{ 3556,13515},{ 3742,13566},{ 3939,13683}
       },
       /*Cb  qi=13  INTER*/
       {
-        {  125,   40},{  122,  323},{  117,  631},{  116, 1028},
-        {  123, 1443},{  133, 1855},{  143, 2265},{  151, 2671},
-        {  158, 3067},{  166, 3443},{  174, 3800},{  183, 4141},
-        {  195, 4464},{  207, 4772},{  219, 5072},{  231, 5369},
-        {  246, 5659},{  264, 5947},{  284, 6238},{  305, 6524},
-        {  329, 6806},{  356, 7089},{  384, 7370},{  420, 7654}
+        {   46, -165},{   47, 1416},{   77, 3052},{   93, 4578},
+        {  103, 5999},{  112, 7383},{  122, 8743},{  139,10041},
+        {  168,11266},{  212,12384},{  271,13386},{  333,14352},
+        {  382,15374},{  438,16411},{  542,17333},{  738,17987},
+        { 1029,18351},{ 1343,18619},{ 1775,18379},{ 2234,18053},
+        { 2690,17578},{ 3069,17126},{ 3603,16896},{ 4059,16550}
       }
     },
     {
       /*Cr  qi=13  INTRA*/
       {
-        {    9,    4},{   92,  378},{  153,  770},{  179, 1238},
-        {  193, 1728},{  205, 2227},{  222, 2713},{  244, 3129},
-        {  270, 3481},{  298, 3775},{  340, 4045},{  385, 4302},
-        {  418, 4549},{  457, 4804},{  498, 5051},{  540, 5264},
-        {  590, 5451},{  634, 5649},{  673, 5836},{  714, 6013},
-        {  754, 6238},{  779, 6441},{  802, 6623},{  825, 6951}
+        {   21,  -63},{  135, 1674},{  239, 3283},{  376, 4564},
+        {  532, 5611},{  670, 6577},{  835, 7436},{  991, 8190},
+        { 1150, 8870},{ 1380, 9219},{ 1553, 9646},{ 1742,10078},
+        { 1972,10078},{ 2177,10166},{ 2354,10593},{ 2821,10607},
+        { 3175,10596},{ 3110,10485},{ 3080,10737},{ 3228,11344},
+        { 3388,11966},{ 3653,12292},{ 3816,12393},{ 3993,12846}
       },
       /*Cr  qi=13  INTER*/
       {
-        {  104,   42},{  112,  351},{  121,  665},{  123, 1044},
-        {  127, 1449},{  134, 1857},{  140, 2271},{  145, 2681},
-        {  150, 3079},{  156, 3460},{  164, 3820},{  172, 4161},
-        {  183, 4489},{  198, 4807},{  211, 5116},{  227, 5414},
-        {  247, 5705},{  267, 5988},{  293, 6262},{  319, 6527},
-        {  344, 6784},{  366, 7048},{  386, 7314},{  407, 7582}
+        {   30, -136},{   52, 1419},{   79, 3043},{   90, 4589},
+        {   99, 6050},{  116, 7429},{  130, 8725},{  144, 9966},
+        {  168,11182},{  222,12359},{  314,13441},{  456,14304},
+        {  625,15039},{  824,15658},{ 1103,16102},{ 1381,16536},
+        { 1667,16834},{ 2054,16575},{ 2414,16311},{ 2835,15907},
+        { 3163,15713},{ 3514,15461},{ 3834,15132},{ 4189,14886}
       }
     }
   },
@@ -926,61 +926,61 @@
     {
       /*Y'  qi=14  INTRA*/
       {
-        {  223,  -58},{  296, 1546},{  445, 3027},{  688, 4036},
-        {  964, 4657},{ 1233, 5209},{ 1492, 5770},{ 1739, 6332},
-        { 1975, 6889},{ 2214, 7428},{ 2450, 7942},{ 2687, 8412},
-        { 2923, 8854},{ 3148, 9282},{ 3366, 9733},{ 3577,10194},
-        { 3780,10617},{ 3981,11049},{ 4180,11462},{ 4362,11843},
-        { 4523,12241},{ 4696,12592},{ 4884,12905},{ 5064,13397}
+        {  128,  -84},{  205, 1564},{  361, 3007},{  552, 4135},
+        {  728, 5082},{  892, 5941},{ 1057, 6706},{ 1227, 7403},
+        { 1410, 8004},{ 1627, 8517},{ 1857, 8987},{ 2116, 9332},
+        { 2367, 9657},{ 2592, 9996},{ 2804,10399},{ 3030,10852},
+        { 3264,11225},{ 3489,11573},{ 3732,11865},{ 3976,12043},
+        { 4226,12217},{ 4483,12437},{ 4733,12655},{ 4991,12936}
       },
       /*Y'  qi=14  INTER*/
       {
-        {  160,  -56},{  127, 1345},{  184, 2829},{  253, 4229},
-        {  328, 5456},{  424, 6594},{  563, 7675},{  741, 8681},
-        {  945, 9617},{ 1162,10518},{ 1389,11395},{ 1625,12241},
-        { 1865,13044},{ 2115,13779},{ 2381,14425},{ 2662,14964},
-        { 2957,15398},{ 3262,15730},{ 3572,15966},{ 3878,16119},
-        { 4176,16208},{ 4454,16307},{ 4713,16404},{ 4957,16495}
+        {   53,  -67},{   52, 1337},{   95, 2882},{  132, 4426},
+        {  159, 5874},{  183, 7204},{  204, 8477},{  226, 9717},
+        {  260,10914},{  308,12049},{  371,13122},{  452,14135},
+        {  552,15098},{  679,15996},{  844,16797},{ 1056,17468},
+        { 1321,17980},{ 1647,18308},{ 2020,18466},{ 2423,18499},
+        { 2837,18434},{ 3236,18330},{ 3601,18216},{ 3939,18091}
       }
     },
     {
       /*Cb  qi=14  INTRA*/
       {
-        {   12,    2},{  104,  367},{  170,  746},{  192, 1193},
-        {  207, 1674},{  226, 2166},{  246, 2647},{  266, 3086},
-        {  292, 3466},{  327, 3787},{  364, 4069},{  403, 4332},
-        {  449, 4572},{  493, 4792},{  533, 4985},{  570, 5211},
-        {  611, 5414},{  664, 5571},{  715, 5749},{  754, 5962},
-        {  801, 6166},{  845, 6335},{  890, 6485},{  956, 6676}
+        {   28,  -46},{  143, 1655},{  256, 3280},{  402, 4545},
+        {  550, 5572},{  691, 6501},{  874, 7252},{ 1078, 7784},
+        { 1261, 8363},{ 1426, 8917},{ 1597, 9338},{ 1735, 9831},
+        { 1928,10510},{ 2204,10924},{ 2357,11188},{ 2468,11698},
+        { 2751,12157},{ 3037,12162},{ 3133,12476},{ 3328,12885},
+        { 3616,13007},{ 3740,13290},{ 3945,13271},{ 4130,13331}
       },
       /*Cb  qi=14  INTER*/
       {
-        {  113,   29},{  123,  351},{  123,  678},{  116, 1049},
-        {  123, 1450},{  134, 1860},{  145, 2269},{  153, 2675},
-        {  161, 3064},{  169, 3435},{  179, 3788},{  190, 4121},
-        {  201, 4438},{  213, 4746},{  229, 5042},{  245, 5332},
-        {  262, 5622},{  280, 5906},{  301, 6190},{  328, 6468},
-        {  358, 6747},{  390, 7024},{  424, 7293},{  471, 7544}
+        {   44, -139},{   48, 1423},{   79, 3049},{   95, 4568},
+        {  105, 5984},{  117, 7360},{  130, 8703},{  151, 9979},
+        {  188,11172},{  243,12254},{  314,13199},{  379,14151},
+        {  438,15159},{  510,16175},{  641,17059},{  875,17659},
+        { 1256,17772},{ 1669,17652},{ 2077,17631},{ 2570,17072},
+        { 3012,16572},{ 3364,16066},{ 3733,15834},{ 4129,15373}
       }
     },
     {
       /*Cr  qi=14  INTRA*/
       {
-        {    9,    4},{   97,  378},{  161,  770},{  188, 1239},
-        {  201, 1728},{  215, 2223},{  234, 2702},{  258, 3107},
-        {  287, 3448},{  316, 3738},{  363, 3990},{  415, 4225},
-        {  449, 4471},{  490, 4730},{  533, 4970},{  580, 5161},
-        {  633, 5339},{  679, 5532},{  724, 5707},{  763, 5884},
-        {  799, 6105},{  832, 6290},{  858, 6483},{  895, 6766}
+        {   21,  -63},{  143, 1670},{  254, 3251},{  397, 4499},
+        {  560, 5537},{  706, 6493},{  869, 7354},{ 1041, 8085},
+        { 1215, 8709},{ 1451, 9034},{ 1630, 9451},{ 1819, 9863},
+        { 2065, 9870},{ 2284, 9897},{ 2441,10341},{ 2884,10435},
+        { 3309,10353},{ 3276,10236},{ 3253,10425},{ 3421,10937},
+        { 3606,11401},{ 3894,11700},{ 3994,12108},{ 4179,12551}
       },
       /*Cr  qi=14  INTER*/
       {
-        {  109,   26},{  112,  347},{  119,  673},{  122, 1052},
-        {  126, 1456},{  134, 1867},{  140, 2276},{  146, 2681},
-        {  152, 3076},{  158, 3452},{  167, 3808},{  178, 4144},
-        {  190, 4467},{  205, 4780},{  222, 5081},{  240, 5376},
-        {  261, 5663},{  285, 5943},{  314, 6206},{  342, 6461},
-        {  368, 6718},{  396, 6975},{  428, 7226},{  450, 7496}
+        {   32, -130},{   52, 1428},{   80, 3044},{   92, 4578},
+        {  102, 6029},{  118, 7397},{  137, 8678},{  154, 9906},
+        {  183,11117},{  251,12244},{  366,13248},{  524,14097},
+        {  717,14810},{  923,15450},{ 1227,15729},{ 1572,15902},
+        { 1978,15841},{ 2410,15814},{ 2777,15818},{ 3139,15847},
+        { 3538,15843},{ 3927,15781},{ 4294,15697},{ 4677,15691}
       }
     }
   },
@@ -988,61 +988,61 @@
     {
       /*Y'  qi=15  INTRA*/
       {
-        {  226,  -57},{  299, 1544},{  459, 3001},{  715, 3958},
-        { 1000, 4550},{ 1277, 5097},{ 1548, 5655},{ 1808, 6212},
-        { 2056, 6756},{ 2303, 7287},{ 2547, 7787},{ 2796, 8234},
-        { 3038, 8664},{ 3268, 9082},{ 3493, 9518},{ 3715, 9963},
-        { 3924,10374},{ 4129,10784},{ 4333,11183},{ 4519,11557},
-        { 4686,11930},{ 4862,12255},{ 5054,12557},{ 5234,13032}
+        {  123,  -79},{  211, 1555},{  373, 2973},{  573, 4079},
+        {  759, 5003},{  930, 5845},{ 1105, 6589},{ 1286, 7257},
+        { 1478, 7841},{ 1706, 8334},{ 1951, 8779},{ 2223, 9105},
+        { 2489, 9400},{ 2725, 9719},{ 2948,10118},{ 3189,10541},
+        { 3443,10847},{ 3688,11150},{ 3939,11413},{ 4192,11565},
+        { 4459,11741},{ 4734,11926},{ 4994,12109},{ 5278,12372}
       },
       /*Y'  qi=15  INTER*/
       {
-        {  154,  -48},{  127, 1344},{  188, 2822},{  263, 4200},
-        {  348, 5406},{  460, 6528},{  619, 7586},{  819, 8563},
-        { 1041, 9475},{ 1276,10357},{ 1519,11214},{ 1773,12029},
-        { 2033,12795},{ 2306,13483},{ 2598,14062},{ 2901,14552},
-        { 3214,14922},{ 3540,15165},{ 3864,15343},{ 4175,15468},
-        { 4471,15564},{ 4744,15643},{ 5003,15710},{ 5249,15824}
+        {   56,  -98},{   49, 1342},{   96, 2884},{  133, 4419},
+        {  161, 5849},{  185, 7167},{  207, 8429},{  233, 9659},
+        {  272,10840},{  329,11951},{  404,12995},{  499,13981},
+        {  620,14906},{  774,15747},{  971,16475},{ 1223,17064},
+        { 1538,17466},{ 1908,17691},{ 2312,17787},{ 2735,17769},
+        { 3157,17678},{ 3552,17558},{ 3909,17427},{ 4236,17286}
       }
     },
     {
       /*Cb  qi=15  INTRA*/
       {
-        {   12,    2},{  104,  368},{  170,  747},{  193, 1193},
-        {  209, 1675},{  229, 2163},{  249, 2636},{  271, 3067},
-        {  300, 3439},{  338, 3752},{  376, 4028},{  419, 4281},
-        {  466, 4518},{  513, 4734},{  558, 4919},{  595, 5139},
-        {  638, 5337},{  694, 5492},{  745, 5675},{  785, 5896},
-        {  832, 6088},{  886, 6230},{  936, 6372},{  976, 6588}
+        {   29,  -46},{  148, 1652},{  262, 3264},{  414, 4503},
+        {  568, 5504},{  719, 6404},{  910, 7136},{ 1126, 7632},
+        { 1337, 8122},{ 1508, 8656},{ 1685, 9060},{ 1856, 9463},
+        { 2073,10099},{ 2348,10554},{ 2514,10792},{ 2628,11275},
+        { 2915,11667},{ 3206,11516},{ 3338,11833},{ 3512,12243},
+        { 3741,12255},{ 3944,12358},{ 4160,12343},{ 4384,12313}
       },
       /*Cb  qi=15  INTER*/
       {
-        {  121,   33},{  119,  353},{  121,  680},{  118, 1049},
-        {  124, 1449},{  134, 1858},{  145, 2266},{  155, 2665},
-        {  163, 3050},{  173, 3414},{  184, 3762},{  196, 4092},
-        {  210, 4404},{  225, 4705},{  240, 4999},{  258, 5288},
-        {  279, 5570},{  302, 5854},{  327, 6131},{  359, 6400},
-        {  395, 6671},{  433, 6939},{  471, 7211},{  513, 7470}
+        {   36, -144},{   47, 1427},{   78, 3053},{   94, 4564},
+        {  105, 5972},{  119, 7338},{  136, 8662},{  162, 9925},
+        {  204,11101},{  266,12143},{  344,13067},{  418,13998},
+        {  485,14991},{  587,15955},{  769,16735},{ 1053,17214},
+        { 1460,17226},{ 1946,16936},{ 2413,16791},{ 2915,15992},
+        { 3330,15480},{ 3658,15014},{ 3981,14539},{ 4350,13983}
       }
     },
     {
       /*Cr  qi=15  INTRA*/
       {
-        {    9,    4},{   97,  378},{  162,  771},{  190, 1239},
-        {  204, 1728},{  217, 2221},{  237, 2694},{  263, 3092},
-        {  293, 3424},{  325, 3700},{  375, 3943},{  429, 4178},
-        {  468, 4415},{  514, 4658},{  558, 4899},{  605, 5089},
-        {  661, 5251},{  709, 5439},{  754, 5617},{  801, 5786},
-        {  837, 6002},{  865, 6194},{  898, 6373},{  945, 6631}
+        {   22,  -62},{  148, 1666},{  263, 3230},{  411, 4458},
+        {  582, 5474},{  734, 6404},{  905, 7239},{ 1096, 7929},
+        { 1286, 8507},{ 1515, 8813},{ 1709, 9206},{ 1907, 9610},
+        { 2181, 9492},{ 2400, 9551},{ 2543,10081},{ 3021,10080},
+        { 3445,10056},{ 3345,10089},{ 3274,10245},{ 3353,10355},
+        { 3685,11000},{ 3971,11375},{ 4088,11670},{ 4291,12057}
       },
       /*Cr  qi=15  INTER*/
       {
-        {  106,   29},{  113,  349},{  118,  674},{  120, 1051},
-        {  126, 1455},{  134, 1865},{  141, 2272},{  148, 2673},
-        {  154, 3063},{  162, 3435},{  172, 3784},{  185, 4114},
-        {  198, 4435},{  214, 4741},{  233, 5038},{  254, 5329},
-        {  279, 5609},{  308, 5881},{  338, 6141},{  371, 6393},
-        {  402, 6644},{  432, 6902},{  461, 7161},{  496, 7408}
+        {   29, -143},{   50, 1436},{   80, 3047},{   91, 4577},
+        {  102, 6017},{  121, 7370},{  141, 8633},{  164, 9836},
+        {  202,11010},{  284,12107},{  415,13090},{  597,13868},
+        {  832,14452},{ 1122,14932},{ 1468,15082},{ 1827,15085},
+        { 2250,14939},{ 2607,14779},{ 3067,14624},{ 3451,14475},
+        { 3911,14272},{ 4297,14101},{ 4569,14136},{ 4959,14007}
       }
     }
   },
@@ -1050,61 +1050,61 @@
     {
       /*Y'  qi=16  INTRA*/
       {
-        {  232,  -56},{  313, 1533},{  489, 2937},{  765, 3835},
-        { 1068, 4395},{ 1362, 4930},{ 1648, 5481},{ 1920, 6032},
-        { 2179, 6572},{ 2438, 7090},{ 2695, 7574},{ 2952, 8010},
-        { 3202, 8436},{ 3438, 8846},{ 3670, 9268},{ 3896, 9693},
-        { 4113,10081},{ 4327,10486},{ 4534,10874},{ 4723,11217},
-        { 4895,11581},{ 5074,11899},{ 5265,12170},{ 5445,12625}
+        {  125,  -73},{  221, 1541},{  399, 2915},{  614, 3979},
+        {  816, 4862},{ 1002, 5667},{ 1189, 6389},{ 1387, 7022},
+        { 1597, 7573},{ 1838, 8055},{ 2095, 8483},{ 2380, 8789},
+        { 2660, 9068},{ 2910, 9371},{ 3142, 9758},{ 3395,10149},
+        { 3667,10423},{ 3916,10728},{ 4180,10981},{ 4447,11099},
+        { 4722,11224},{ 5010,11370},{ 5282,11547},{ 5620,11749}
       },
       /*Y'  qi=16  INTER*/
       {
-        {  162,  -30},{  137, 1342},{  199, 2812},{  280, 4165},
-        {  377, 5351},{  507, 6457},{  689, 7493},{  911, 8445},
-        { 1155, 9337},{ 1410,10199},{ 1674,11030},{ 1949,11816},
-        { 2234,12539},{ 2533,13169},{ 2849,13692},{ 3179,14093},
-        { 3516,14389},{ 3857,14578},{ 4187,14712},{ 4497,14825},
-        { 4790,14903},{ 5063,14976},{ 5319,15031},{ 5554,15061}
+        {   58, -121},{   51, 1353},{   99, 2878},{  137, 4397},
+        {  166, 5806},{  192, 7105},{  216, 8359},{  246, 9578},
+        {  294,10739},{  364,11824},{  453,12843},{  566,13798},
+        {  712,14669},{  899,15444},{ 1142,16086},{ 1455,16536},
+        { 1833,16804},{ 2255,16916},{ 2700,16905},{ 3142,16827},
+        { 3558,16724},{ 3938,16600},{ 4286,16488},{ 4632,16398}
       }
     },
     {
       /*Cb  qi=16  INTRA*/
       {
-        {   12,    2},{  106,  368},{  177,  747},{  202, 1193},
-        {  218, 1673},{  241, 2156},{  264, 2615},{  290, 3025},
-        {  323, 3378},{  363, 3680},{  405, 3945},{  452, 4190},
-        {  504, 4423},{  552, 4635},{  597, 4811},{  639, 5016},
-        {  685, 5223},{  741, 5381},{  799, 5544},{  844, 5748},
-        {  896, 5933},{  951, 6073},{ 1000, 6210},{ 1063, 6406}
+        {   34,  -45},{  156, 1645},{  283, 3229},{  445, 4436},
+        {  608, 5413},{  769, 6291},{  970, 6988},{ 1204, 7434},
+        { 1443, 7867},{ 1626, 8368},{ 1825, 8692},{ 2009, 9055},
+        { 2236, 9689},{ 2514,10117},{ 2688,10274},{ 2823,10727},
+        { 3118,11058},{ 3393,10847},{ 3485,11013},{ 3650,11233},
+        { 3918,11185},{ 4161,11219},{ 4409,11389},{ 4656,11514}
       },
       /*Cb  qi=16  INTER*/
       {
-        {  128,   36},{  122,  358},{  120,  682},{  123, 1047},
-        {  131, 1448},{  142, 1856},{  152, 2259},{  163, 2652},
-        {  173, 3032},{  183, 3392},{  195, 3734},{  210, 4054},
-        {  226, 4359},{  241, 4656},{  260, 4945},{  282, 5230},
-        {  307, 5509},{  336, 5783},{  365, 6061},{  403, 6327},
-        {  445, 6597},{  489, 6861},{  541, 7111},{  599, 7351}
+        {   36, -146},{   48, 1438},{   79, 3052},{   95, 4554},
+        {  107, 5947},{  123, 7295},{  144, 8602},{  175, 9845},
+        {  227,10977},{  303,11978},{  391,12894},{  465,13838},
+        {  549,14797},{  701,15670},{  937,16355},{ 1289,16592},
+        { 1771,16423},{ 2278,16008},{ 2775,15580},{ 3249,15532},
+        { 3705,15337},{ 3999,14817},{ 4310,14664},{ 4706,14398}
       }
     },
     {
       /*Cr  qi=16  INTRA*/
       {
-        {    9,    4},{  103,  377},{  171,  769},{  199, 1238},
-        {  215, 1727},{  231, 2215},{  252, 2678},{  282, 3064},
-        {  315, 3380},{  351, 3643},{  405, 3870},{  462, 4086},
-        {  505, 4314},{  555, 4547},{  602, 4779},{  652, 4969},
-        {  712, 5128},{  764, 5301},{  808, 5474},{  856, 5632},
-        {  903, 5841},{  932, 6038},{  963, 6208},{ 1017, 6419}
+        {   26,  -62},{  153, 1664},{  277, 3200},{  441, 4386},
+        {  619, 5371},{  785, 6259},{  975, 7051},{ 1176, 7706},
+        { 1385, 8243},{ 1631, 8496},{ 1827, 8865},{ 2037, 9271},
+        { 2301, 9160},{ 2569, 9126},{ 2827, 9410},{ 3227, 9527},
+        { 3552, 9793},{ 3440, 9939},{ 3374,10097},{ 3588,10343},
+        { 3919,10687},{ 4200,11041},{ 4353,11209},{ 4597,11513}
       },
       /*Cr  qi=16  INTER*/
       {
-        {  116,   29},{  119,  346},{  123,  675},{  126, 1054},
-        {  132, 1456},{  141, 1863},{  149, 2266},{  155, 2664},
-        {  161, 3048},{  170, 3413},{  181, 3757},{  195, 4081},
-        {  213, 4392},{  232, 4693},{  255, 4987},{  280, 5271},
-        {  310, 5539},{  342, 5801},{  377, 6057},{  414, 6307},
-        {  451, 6557},{  486, 6812},{  522, 7064},{  546, 7331}
+        {   21, -154},{   52, 1442},{   80, 3048},{   91, 4566},
+        {  104, 5991},{  126, 7323},{  148, 8560},{  175, 9745},
+        {  224,10910},{  325,11974},{  495,12843},{  717,13519},
+        {  983,14058},{ 1298,14490},{ 1656,14562},{ 2107,14489},
+        { 2502,14682},{ 2926,14351},{ 3386,14016},{ 3753,13983},
+        { 4205,13905},{ 4568,13727},{ 4998,13533},{ 5416,13401}
       }
     }
   },
@@ -1112,61 +1112,61 @@
     {
       /*Y'  qi=17  INTRA*/
       {
-        {  233,  -55},{  316, 1530},{  499, 2918},{  787, 3793},
-        { 1101, 4337},{ 1405, 4866},{ 1700, 5409},{ 1982, 5949},
-        { 2251, 6477},{ 2517, 6988},{ 2781, 7461},{ 3045, 7883},
-        { 3301, 8297},{ 3542, 8696},{ 3776, 9105},{ 4006, 9518},
-        { 4226, 9896},{ 4443,10285},{ 4651,10660},{ 4842,11001},
-        { 5019,11341},{ 5196,11634},{ 5382,11912},{ 5561,12352}
+        {  123,  -75},{  224, 1535},{  411, 2885},{  635, 3913},
+        {  845, 4773},{ 1039, 5564},{ 1233, 6270},{ 1442, 6892},
+        { 1662, 7434},{ 1911, 7899},{ 2179, 8309},{ 2472, 8611},
+        { 2756, 8895},{ 3010, 9192},{ 3256, 9555},{ 3521, 9932},
+        { 3795,10206},{ 4056,10487},{ 4332,10696},{ 4601,10806},
+        { 4884,10932},{ 5181,11055},{ 5463,11192},{ 5804,11367}
       },
       /*Y'  qi=17  INTER*/
       {
-        {  165,  -32},{  137, 1342},{  202, 2804},{  288, 4145},
-        {  394, 5319},{  539, 6410},{  738, 7427},{  977, 8359},
-        { 1236, 9232},{ 1505,10078},{ 1785,10891},{ 2075,11651},
-        { 2376,12344},{ 2696,12932},{ 3032,13397},{ 3378,13745},
-        { 3728,13983},{ 4078,14103},{ 4411,14175},{ 4714,14249},
-        { 4995,14284},{ 5260,14316},{ 5510,14338},{ 5739,14362}
+        {   56, -117},{   56, 1332},{  105, 2865},{  145, 4377},
+        {  179, 5765},{  207, 7049},{  233, 8295},{  269, 9502},
+        {  324,10645},{  403,11711},{  504,12707},{  637,13623},
+        {  809,14450},{ 1037,15145},{ 1335,15672},{ 1706,16010},
+        { 2137,16161},{ 2603,16170},{ 3075,16087},{ 3519,15985},
+        { 3920,15883},{ 4293,15765},{ 4638,15655},{ 4950,15569}
       }
     },
     {
       /*Cb  qi=17  INTRA*/
       {
-        {   13,    2},{  106,  368},{  177,  747},{  202, 1193},
-        {  219, 1671},{  240, 2149},{  266, 2603},{  294, 3007},
-        {  328, 3355},{  372, 3648},{  417, 3906},{  465, 4153},
-        {  519, 4380},{  572, 4578},{  619, 4758},{  660, 4971},
-        {  703, 5177},{  761, 5326},{  822, 5480},{  872, 5676},
-        {  929, 5850},{  981, 5994},{ 1029, 6134},{ 1102, 6293}
+        {   33,  -46},{  160, 1641},{  296, 3197},{  469, 4375},
+        {  635, 5342},{  805, 6188},{ 1015, 6867},{ 1257, 7303},
+        { 1501, 7730},{ 1687, 8244},{ 1897, 8564},{ 2095, 8891},
+        { 2344, 9469},{ 2628, 9865},{ 2788,10114},{ 2926,10606},
+        { 3211,10923},{ 3448,10859},{ 3599,11005},{ 3858,11118},
+        { 4098,11177},{ 4295,11274},{ 4486,11348},{ 4699,11388}
       },
       /*Cb  qi=17  INTER*/
       {
-        {  125,   41},{  122,  359},{  123,  681},{  122, 1048},
-        {  130, 1447},{  143, 1855},{  154, 2258},{  164, 2648},
-        {  175, 3024},{  186, 3381},{  199, 3716},{  215, 4032},
-        {  232, 4336},{  251, 4632},{  272, 4919},{  296, 5199},
-        {  323, 5473},{  354, 5743},{  392, 6008},{  434, 6272},
-        {  480, 6538},{  532, 6788},{  588, 7031},{  647, 7270}
+        {   46, -146},{   56, 1429},{   87, 3040},{  102, 4536},
+        {  116, 5923},{  136, 7255},{  162, 8541},{  202, 9754},
+        {  260,10861},{  347,11826},{  442,12731},{  526,13678},
+        {  638,14611},{  833,15369},{ 1126,15888},{ 1569,15939},
+        { 2101,15590},{ 2600,15124},{ 3101,14686},{ 3466,14645},
+        { 3895,14460},{ 4242,14170},{ 4461,14046},{ 4787,13841}
       }
     },
     {
       /*Cr  qi=17  INTRA*/
       {
-        {   10,    4},{  103,  377},{  170,  769},{  197, 1235},
-        {  213, 1722},{  231, 2208},{  254, 2665},{  284, 3046},
-        {  321, 3359},{  357, 3621},{  412, 3845},{  472, 4054},
-        {  517, 4273},{  571, 4503},{  623, 4729},{  677, 4907},
-        {  736, 5059},{  782, 5235},{  831, 5407},{  887, 5563},
-        {  933, 5764},{  958, 5960},{  993, 6138},{ 1046, 6366}
+        {   28,  -62},{  159, 1658},{  294, 3172},{  464, 4335},
+        {  648, 5301},{  821, 6166},{ 1018, 6935},{ 1232, 7567},
+        { 1449, 8081},{ 1690, 8361},{ 1890, 8725},{ 2110, 9085},
+        { 2371, 8952},{ 2652, 8884},{ 2960, 9128},{ 3358, 9243},
+        { 3620, 9572},{ 3497, 9731},{ 3428, 9783},{ 3738,10073},
+        { 4030,10310},{ 4251,10688},{ 4479,10818},{ 4733,11096}
       },
       /*Cr  qi=17  INTER*/
       {
-        {  123,   35},{  121,  351},{  123,  677},{  126, 1053},
-        {  132, 1453},{  141, 1860},{  149, 2263},{  156, 2659},
-        {  163, 3042},{  171, 3404},{  184, 3742},{  201, 4063},
-        {  219, 4370},{  241, 4666},{  266, 4956},{  296, 5237},
-        {  329, 5501},{  367, 5755},{  408, 6004},{  449, 6253},
-        {  488, 6496},{  528, 6740},{  569, 6988},{  622, 7226}
+        {   36, -137},{   60, 1437},{   87, 3037},{   99, 4550},
+        {  115, 5963},{  141, 7275},{  169, 8492},{  201, 9670},
+        {  264,10801},{  393,11801},{  579,12648},{  837,13241},
+        { 1130,13719},{ 1458,14048},{ 1884,13998},{ 2368,13760},
+        { 2753,13593},{ 3184,13373},{ 3483,13119},{ 3899,12929},
+        { 4295,12736},{ 4663,12688},{ 4980,12582},{ 5359,12409}
       }
     }
   },
@@ -1174,61 +1174,61 @@
     {
       /*Y'  qi=18  INTRA*/
       {
-        {  238,  -52},{  327, 1520},{  530, 2862},{  842, 3685},
-        { 1175, 4203},{ 1496, 4717},{ 1805, 5250},{ 2102, 5779},
-        { 2386, 6290},{ 2665, 6786},{ 2940, 7252},{ 3216, 7659},
-        { 3486, 8051},{ 3736, 8442},{ 3979, 8836},{ 4218, 9226},
-        { 4448, 9582},{ 4677, 9959},{ 4898,10317},{ 5100,10629},
-        { 5285,10954},{ 5472,11246},{ 5669,11509},{ 5869,11928}
+        {  134,  -72},{  231, 1527},{  427, 2852},{  662, 3851},
+        {  883, 4680},{ 1087, 5453},{ 1292, 6144},{ 1516, 6743},
+        { 1749, 7267},{ 2013, 7709},{ 2298, 8091},{ 2599, 8378},
+        { 2896, 8641},{ 3167, 8932},{ 3422, 9279},{ 3704, 9621},
+        { 3993, 9874},{ 4267,10131},{ 4550,10332},{ 4828,10421},
+        { 5128,10510},{ 5432,10629},{ 5725,10762},{ 6076,10952}
       },
       /*Y'  qi=18  INTER*/
       {
-        {  153,    1},{  142, 1345},{  213, 2786},{  310, 4098},
-        {  434, 5252},{  607, 6320},{  836, 7303},{ 1103, 8203},
-        { 1386, 9050},{ 1682, 9865},{ 1986,10646},{ 2301,11365},
-        { 2632,11993},{ 2981,12511},{ 3346,12905},{ 3719,13173},
-        { 4089,13332},{ 4442,13453},{ 4770,13568},{ 5079,13650},
-        { 5368,13726},{ 5638,13791},{ 5896,13846},{ 6153,13905}
+        {   58, -132},{   57, 1333},{  108, 2856},{  149, 4355},
+        {  184, 5729},{  214, 7002},{  243, 8240},{  284, 9436},
+        {  348,10561},{  440,11602},{  561,12559},{  716,13434},
+        {  920,14203},{ 1191,14819},{ 1543,15244},{ 1968,15473},
+        { 2442,15538},{ 2929,15501},{ 3400,15412},{ 3839,15299},
+        { 4240,15178},{ 4601,15068},{ 4932,14985},{ 5241,14893}
       }
     },
     {
       /*Cb  qi=18  INTRA*/
       {
-        {   13,    2},{  109,  368},{  182,  748},{  210, 1194},
-        {  229, 1670},{  253, 2142},{  283, 2579},{  313, 2964},
-        {  351, 3296},{  401, 3574},{  450, 3819},{  502, 4058},
-        {  557, 4279},{  613, 4468},{  665, 4640},{  713, 4843},
-        {  762, 5046},{  819, 5207},{  882, 5363},{  934, 5553},
-        {  984, 5722},{ 1036, 5870},{ 1091, 6015},{ 1157, 6210}
+        {   38,  -47},{  168, 1633},{  316, 3162},{  501, 4311},
+        {  675, 5260},{  852, 6102},{ 1072, 6748},{ 1323, 7162},
+        { 1593, 7549},{ 1791, 8038},{ 1991, 8370},{ 2193, 8673},
+        { 2465, 9212},{ 2763, 9597},{ 2937, 9826},{ 3108,10237},
+        { 3403,10516},{ 3649,10348},{ 3805,10427},{ 4031,10591},
+        { 4269,10478},{ 4492,10544},{ 4746,10690},{ 5005,10828}
       },
       /*Cb  qi=18  INTER*/
       {
-        {  118,   18},{  125,  348},{  124,  675},{  125, 1048},
-        {  134, 1448},{  147, 1853},{  159, 2250},{  171, 2632},
-        {  183, 3000},{  196, 3349},{  212, 3676},{  230, 3987},
-        {  250, 4286},{  273, 4575},{  299, 4855},{  327, 5131},
-        {  358, 5404},{  396, 5669},{  443, 5927},{  495, 6185},
-        {  548, 6439},{  611, 6683},{  679, 6919},{  738, 7153}
+        {   46, -155},{   57, 1433},{   87, 3033},{  103, 4517},
+        {  119, 5895},{  141, 7218},{  172, 8488},{  220, 9685},
+        {  288,10764},{  385,11707},{  492,12579},{  588,13509},
+        {  729,14388},{  977,15046},{ 1338,15428},{ 1843,15326},
+        { 2445,14713},{ 3018,14035},{ 3382,13781},{ 3804,13582},
+        { 4110,13653},{ 4549,13679},{ 4913,13539},{ 5305,13472}
       }
     },
     {
       /*Cr  qi=18  INTRA*/
       {
-        {   10,    4},{  107,  378},{  177,  771},{  207, 1239},
-        {  225, 1726},{  244, 2203},{  269, 2642},{  304, 2999},
-        {  345, 3293},{  384, 3546},{  443, 3763},{  507, 3970},
-        {  558, 4187},{  615, 4402},{  665, 4620},{  723, 4798},
-        {  788, 4946},{  840, 5114},{  887, 5287},{  939, 5445},
-        {  990, 5643},{ 1022, 5827},{ 1060, 5985},{ 1119, 6156}
+        {   36,  -61},{  169, 1649},{  314, 3135},{  492, 4268},
+        {  686, 5214},{  869, 6060},{ 1080, 6781},{ 1322, 7343},
+        { 1570, 7825},{ 1812, 8098},{ 1995, 8488},{ 2255, 8794},
+        { 2525, 8681},{ 2732, 8683},{ 3017, 8854},{ 3516, 8825},
+        { 3787, 9234},{ 3604, 9563},{ 3622, 9521},{ 3759, 9678},
+        { 4199,10068},{ 4547,10218},{ 4741,10312},{ 5023,10526}
       },
       /*Cr  qi=18  INTER*/
       {
-        {  124,   32},{  126,  349},{  128,  673},{  129, 1053},
-        {  136, 1453},{  145, 1855},{  154, 2254},{  162, 2645},
-        {  170, 3021},{  181, 3374},{  196, 3704},{  215, 4018},
-        {  237, 4321},{  263, 4612},{  293, 4891},{  327, 5166},
-        {  369, 5421},{  412, 5665},{  459, 5906},{  510, 6145},
-        {  556, 6387},{  598, 6631},{  644, 6874},{  701, 7114}
+        {   33, -146},{   62, 1437},{   88, 3031},{  100, 4533},
+        {  118, 5934},{  147, 7232},{  176, 8439},{  214, 9602},
+        {  291,10708},{  441,11660},{  678,12384},{  976,12896},
+        { 1304,13295},{ 1714,13391},{ 2184,13271},{ 2579,13357},
+        { 3007,13493},{ 3328,13309},{ 3773,12694},{ 4154,12632},
+        { 4466,12609},{ 4817,12664},{ 5198,12505},{ 5571,12386}
       }
     }
   },
@@ -1236,61 +1236,61 @@
     {
       /*Y'  qi=19  INTRA*/
       {
-        {  237,  -50},{  328, 1517},{  539, 2842},{  861, 3645},
-        { 1202, 4152},{ 1528, 4664},{ 1844, 5192},{ 2148, 5714},
-        { 2438, 6223},{ 2725, 6708},{ 3005, 7168},{ 3282, 7567},
-        { 3559, 7946},{ 3815, 8328},{ 4061, 8710},{ 4305, 9095},
-        { 4538, 9445},{ 4773, 9806},{ 4995,10149},{ 5197,10447},
-        { 5384,10763},{ 5574,11052},{ 5776,11301},{ 5989,11701}
+        {  136,  -67},{  247, 1508},{  458, 2794},{  701, 3774},
+        {  936, 4579},{ 1155, 5318},{ 1379, 5973},{ 1623, 6540},
+        { 1876, 7041},{ 2160, 7456},{ 2459, 7815},{ 2773, 8080},
+        { 3083, 8323},{ 3366, 8596},{ 3627, 8933},{ 3909, 9267},
+        { 4213, 9494},{ 4497, 9734},{ 4784, 9921},{ 5053,10013},
+        { 5357,10089},{ 5666,10200},{ 5963,10317},{ 6350,10414}
       },
       /*Y'  qi=19  INTER*/
       {
-        {  154,   -8},{  143, 1345},{  217, 2777},{  320, 4078},
-        {  455, 5221},{  643, 6274},{  889, 7241},{ 1171, 8125},
-        { 1470, 8956},{ 1778, 9756},{ 2094,10516},{ 2426,11207},
-        { 2774,11805},{ 3138,12287},{ 3519,12633},{ 3901,12868},
-        { 4276,13012},{ 4632,13119},{ 4964,13232},{ 5271,13321},
-        { 5558,13381},{ 5831,13433},{ 6084,13493},{ 6335,13585}
+        {   48, -121},{   60, 1335},{  110, 2852},{  152, 4335},
+        {  189, 5692},{  221, 6955},{  252, 8184},{  300, 9363},
+        {  375,10467},{  481,11483},{  619,12411},{  799,13246},
+        { 1039,13949},{ 1358,14481},{ 1759,14818},{ 2227,14966},
+        { 2737,14961},{ 3236,14886},{ 3700,14798},{ 4133,14682},
+        { 4524,14557},{ 4878,14450},{ 5209,14354},{ 5513,14288}
       }
     },
     {
       /*Cb  qi=19  INTRA*/
       {
-        {   14,    2},{  110,  368},{  184,  748},{  211, 1194},
-        {  229, 1670},{  255, 2137},{  286, 2566},{  319, 2943},
-        {  360, 3269},{  410, 3544},{  461, 3785},{  515, 4024},
-        {  572, 4239},{  631, 4420},{  686, 4593},{  736, 4798},
-        {  787, 5000},{  848, 5156},{  913, 5303},{  961, 5491},
-        { 1012, 5655},{ 1062, 5798},{ 1115, 5940},{ 1165, 6131}
+        {   36,  -40},{  176, 1624},{  332, 3122},{  525, 4243},
+        {  707, 5179},{  894, 6000},{ 1133, 6606},{ 1396, 6994},
+        { 1682, 7324},{ 1983, 7649},{ 2258, 7863},{ 2461, 8148},
+        { 2766, 8634},{ 3142, 8937},{ 3311, 9167},{ 3510, 9532},
+        { 3794, 9876},{ 3908, 9874},{ 4033, 9943},{ 4243,10134},
+        { 4444,10367},{ 4691,10481},{ 4992,10453},{ 5303,10383}
       },
       /*Cb  qi=19  INTER*/
       {
-        {  121,   28},{  129,  349},{  130,  674},{  127, 1047},
-        {  135, 1447},{  147, 1850},{  160, 2245},{  173, 2624},
-        {  186, 2987},{  202, 3331},{  218, 3655},{  237, 3965},
-        {  260, 4260},{  284, 4546},{  312, 4825},{  343, 5097},
-        {  377, 5369},{  420, 5633},{  471, 5887},{  526, 6143},
-        {  587, 6392},{  652, 6626},{  722, 6857},{  803, 7064}
+        {   43, -188},{   58, 1433},{   89, 3027},{  106, 4504},
+        {  123, 5870},{  148, 7179},{  183, 8439},{  238, 9606},
+        {  323,10643},{  432,11560},{  534,12448},{  659,13329},
+        {  846,14135},{ 1142,14676},{ 1584,14833},{ 2167,14565},
+        { 2791,13881},{ 3305,13256},{ 3721,12984},{ 4124,13288},
+        { 4424,12977},{ 4784,13167},{ 5126,13182},{ 5481,13199}
       }
     },
     {
       /*Cr  qi=19  INTRA*/
       {
-        {   10,    4},{  108,  378},{  178,  771},{  208, 1238},
-        {  226, 1724},{  246, 2198},{  272, 2630},{  309, 2980},
-        {  352, 3268},{  394, 3517},{  453, 3735},{  516, 3946},
-        {  569, 4156},{  628, 4365},{  684, 4580},{  743, 4753},
-        {  811, 4891},{  868, 5053},{  913, 5232},{  963, 5394},
-        { 1011, 5593},{ 1046, 5775},{ 1089, 5928},{ 1147, 6126}
+        {   39,  -55},{  175, 1641},{  331, 3102},{  521, 4201},
+        {  735, 5085},{  952, 5826},{ 1207, 6449},{ 1492, 6946},
+        { 1785, 7355},{ 2058, 7564},{ 2282, 7959},{ 2506, 8306},
+        { 2717, 8112},{ 2967, 8139},{ 3330, 8302},{ 3771, 8247},
+        { 4105, 8777},{ 4023, 9043},{ 3796, 8873},{ 3968, 9333},
+        { 4288, 9644},{ 4586, 9843},{ 4776,10056},{ 5003,10357}
       },
       /*Cr  qi=19  INTER*/
       {
-        {  116,   22},{  121,  344},{  126,  675},{  129, 1054},
-        {  135, 1453},{  146, 1854},{  155, 2249},{  164, 2636},
-        {  173, 3008},{  186, 3360},{  202, 3690},{  221, 4000},
-        {  246, 4296},{  276, 4581},{  308, 4859},{  342, 5130},
-        {  385, 5386},{  437, 5629},{  486, 5873},{  536, 6105},
-        {  588, 6337},{  633, 6586},{  683, 6829},{  731, 7071}
+        {   29, -149},{   61, 1441},{   88, 3027},{  103, 4516},
+        {  123, 5903},{  153, 7187},{  188, 8382},{  232, 9531},
+        {  324,10608},{  501,11508},{  775,12147},{ 1116,12538},
+        { 1504,12778},{ 1941,12934},{ 2371,12867},{ 2769,12868},
+        { 3146,12677},{ 3554,12624},{ 3947,12509},{ 4303,12603},
+        { 4749,12293},{ 5097,12373},{ 5385,12549},{ 5760,12517}
       }
     }
   },
@@ -1298,61 +1298,61 @@
     {
       /*Y'  qi=20  INTRA*/
       {
-        {  238,  -46},{  346, 1504},{  574, 2782},{  913, 3545},
-        { 1270, 4033},{ 1611, 4532},{ 1937, 5056},{ 2252, 5575},
-        { 2554, 6075},{ 2849, 6555},{ 3134, 7019},{ 3418, 7415},
-        { 3702, 7784},{ 3961, 8166},{ 4211, 8547},{ 4459, 8923},
-        { 4696, 9267},{ 4934, 9623},{ 5163, 9961},{ 5365,10254},
-        { 5553,10567},{ 5747,10850},{ 5952,11081},{ 6157,11446}
+        {  142,  -58},{  254, 1497},{  474, 2758},{  729, 3706},
+        {  977, 4485},{ 1213, 5196},{ 1454, 5821},{ 1714, 6373},
+        { 1982, 6856},{ 2278, 7261},{ 2587, 7616},{ 2912, 7862},
+        { 3232, 8095},{ 3528, 8349},{ 3812, 8653},{ 4121, 8950},
+        { 4439, 9154},{ 4733, 9378},{ 5031, 9554},{ 5309, 9638},
+        { 5618, 9694},{ 5943, 9778},{ 6263, 9880},{ 6681, 9935}
       },
       /*Y'  qi=20  INTER*/
       {
-        {  174,   -4},{  154, 1343},{  231, 2769},{  339, 4055},
-        {  482, 5187},{  682, 6232},{  942, 7187},{ 1238, 8061},
-        { 1552, 8883},{ 1877, 9670},{ 2211,10413},{ 2560,11075},
-        { 2926,11635},{ 3312,12073},{ 3707,12374},{ 4101,12561},
-        { 4478,12685},{ 4835,12788},{ 5166,12893},{ 5473,12984},
-        { 5760,13070},{ 6027,13118},{ 6286,13155},{ 6537,13181}
+        {   61, -101},{   62, 1350},{  114, 2847},{  157, 4312},
+        {  196, 5649},{  231, 6903},{  269, 8123},{  328, 9282},
+        {  422,10352},{  551,11325},{  718,12200},{  940,12960},
+        { 1244,13559},{ 1641,13954},{ 2121,14150},{ 2648,14189},
+        { 3180,14129},{ 3677,14035},{ 4132,13939},{ 4552,13835},
+        { 4933,13734},{ 5285,13644},{ 5610,13552},{ 5925,13485}
       }
     },
     {
       /*Cb  qi=20  INTRA*/
       {
-        {   14,    2},{  116,  369},{  193,  749},{  221, 1195},
-        {  241, 1667},{  270, 2125},{  304, 2538},{  342, 2898},
-        {  388, 3211},{  442, 3475},{  501, 3706},{  558, 3933},
-        {  615, 4146},{  676, 4326},{  735, 4494},{  786, 4697},
-        {  839, 4894},{  903, 5047},{  968, 5187},{ 1017, 5370},
-        { 1068, 5536},{ 1119, 5685},{ 1174, 5843},{ 1229, 6021}
+        {   39,  -42},{  181, 1622},{  344, 3105},{  547, 4195},
+        {  737, 5109},{  935, 5900},{ 1191, 6457},{ 1466, 6823},
+        { 1758, 7121},{ 2025, 7475},{ 2265, 7776},{ 2451, 8132},
+        { 2736, 8628},{ 3087, 8926},{ 3276, 9119},{ 3514, 9434},
+        { 3838, 9706},{ 4053, 9620},{ 4231, 9631},{ 4470, 9761},
+        { 4732, 9658},{ 4999, 9582},{ 5231, 9660},{ 5470, 9742}
       },
       /*Cb  qi=20  INTER*/
       {
-        {  112,  -47},{  121,  279},{  130,  627},{  135, 1036},
-        {  145, 1443},{  158, 1843},{  172, 2228},{  185, 2604},
-        {  197, 2967},{  212, 3310},{  230, 3632},{  251, 3934},
-        {  274, 4227},{  298, 4515},{  329, 4790},{  365, 5059},
-        {  405, 5325},{  450, 5585},{  505, 5839},{  569, 6088},
-        {  636, 6330},{  706, 6566},{  778, 6791},{  861, 6988}
+        {   42, -139},{   59, 1444},{   90, 3028},{  108, 4489},
+        {  128, 5838},{  160, 7129},{  206, 8366},{  272, 9511},
+        {  372,10509},{  494,11381},{  616,12248},{  763,13111},
+        { 1005,13820},{ 1407,14178},{ 1975,14097},{ 2585,13691},
+        { 3155,13051},{ 3619,12659},{ 4032,12534},{ 4289,12293},
+        { 4644,12284},{ 5069,12420},{ 5329,12610},{ 5665,12631}
       }
     },
     {
       /*Cr  qi=20  INTRA*/
       {
-        {   13,    5},{  114,  382},{  186,  776},{  217, 1241},
-        {  237, 1720},{  261, 2184},{  293, 2599},{  332, 2929},
-        {  379, 3205},{  427, 3446},{  488, 3661},{  551, 3869},
-        {  611, 4064},{  676, 4260},{  733, 4474},{  796, 4652},
-        {  865, 4785},{  923, 4935},{  975, 5112},{ 1028, 5275},
-        { 1081, 5459},{ 1121, 5645},{ 1159, 5809},{ 1209, 5986}
+        {   40,  -55},{  181, 1640},{  346, 3079},{  542, 4157},
+        {  756, 5038},{  976, 5784},{ 1235, 6397},{ 1527, 6847},
+        { 1830, 7242},{ 2091, 7499},{ 2325, 7835},{ 2602, 8067},
+        { 2822, 7938},{ 3087, 7975},{ 3452, 8142},{ 3820, 8166},
+        { 4226, 8582},{ 4259, 8806},{ 3989, 8784},{ 4112, 9063},
+        { 4478, 9322},{ 4826, 9627},{ 4998, 9787},{ 5229,10055}
       },
       /*Cr  qi=20  INTER*/
       {
-        {  121,  -76},{  128,  287},{  134,  657},{  137, 1050},
-        {  146, 1448},{  156, 1845},{  166, 2238},{  173, 2625},
-        {  183, 2995},{  197, 3339},{  213, 3665},{  235, 3972},
-        {  262, 4265},{  292, 4548},{  326, 4822},{  367, 5084},
-        {  416, 5335},{  470, 5576},{  523, 5816},{  572, 6058},
-        {  624, 6297},{  679, 6532},{  731, 6774},{  763, 7042}
+        {   30, -145},{   63, 1450},{   89, 3029},{  104, 4505},
+        {  129, 5875},{  167, 7129},{  208, 8303},{  266, 9429},
+        {  381,10464},{  600,11281},{  919,11838},{ 1306,12186},
+        { 1740,12312},{ 2254,12156},{ 2754,12132},{ 3221,12012},
+        { 3530,12067},{ 3886,12087},{ 4312,11951},{ 4649,11944},
+        { 5035,12020},{ 5368,11937},{ 5750,11937},{ 6126,11914}
       }
     }
   },
@@ -1360,61 +1360,61 @@
     {
       /*Y'  qi=21  INTRA*/
       {
-        {  237,  -44},{  351, 1498},{  598, 2744},{  961, 3472},
-        { 1338, 3941},{ 1701, 4422},{ 2052, 4923},{ 2388, 5418},
-        { 2709, 5897},{ 3020, 6358},{ 3322, 6800},{ 3621, 7175},
-        { 3916, 7517},{ 4189, 7870},{ 4447, 8230},{ 4702, 8585},
-        { 4950, 8904},{ 5201, 9230},{ 5435, 9534},{ 5638, 9809},
-        { 5833,10099},{ 6036,10352},{ 6246,10577},{ 6466,10934}
+        {  146,  -57},{  258, 1493},{  484, 2738},{  754, 3656},
+        { 1016, 4405},{ 1265, 5091},{ 1519, 5704},{ 1789, 6243},
+        { 2072, 6701},{ 2388, 7082},{ 2712, 7419},{ 3050, 7646},
+        { 3390, 7850},{ 3697, 8088},{ 3989, 8378},{ 4317, 8656},
+        { 4648, 8844},{ 4953, 9041},{ 5260, 9195},{ 5548, 9272},
+        { 5865, 9325},{ 6182, 9392},{ 6509, 9472},{ 6946, 9482}
       },
       /*Y'  qi=21  INTER*/
       {
-        {  176,  -12},{  156, 1344},{  241, 2750},{  368, 4008},
-        {  544, 5109},{  788, 6113},{ 1091, 7023},{ 1424, 7855},
-        { 1773, 8639},{ 2134, 9383},{ 2508,10068},{ 2898,10662},
-        { 3307,11127},{ 3734,11447},{ 4161,11651},{ 4567,11785},
-        { 4947,11882},{ 5301,11975},{ 5630,12064},{ 5938,12127},
-        { 6226,12185},{ 6496,12236},{ 6752,12268},{ 7005,12319}
+        {   55,  -92},{   65, 1347},{  117, 2842},{  161, 4295},
+        {  202, 5619},{  239, 6862},{  283, 8066},{  355, 9201},
+        {  466,10241},{  619,11175},{  820,11997},{ 1090,12681},
+        { 1448,13191},{ 1905,13492},{ 2438,13602},{ 2994,13584},
+        { 3529,13500},{ 4021,13396},{ 4473,13293},{ 4883,13197},
+        { 5256,13112},{ 5607,13028},{ 5931,12952},{ 6231,12895}
       }
     },
     {
       /*Cb  qi=21  INTRA*/
       {
-        {   14,    2},{  117,  369},{  194,  749},{  223, 1194},
-        {  245, 1662},{  277, 2109},{  315, 2508},{  359, 2854},
-        {  409, 3159},{  468, 3415},{  529, 3636},{  591, 3858},
-        {  654, 4063},{  721, 4232},{  785, 4396},{  839, 4597},
-        {  899, 4782},{  966, 4919},{ 1032, 5062},{ 1087, 5242},
-        { 1144, 5401},{ 1195, 5546},{ 1256, 5695},{ 1326, 5879}
+        {   43,  -47},{  185, 1616},{  360, 3074},{  571, 4142},
+        {  774, 5033},{  988, 5791},{ 1263, 6311},{ 1546, 6644},
+        { 1838, 6968},{ 2110, 7347},{ 2379, 7590},{ 2586, 7887},
+        { 2868, 8373},{ 3230, 8665},{ 3437, 8836},{ 3667, 9170},
+        { 3983, 9427},{ 4175, 9349},{ 4332, 9410},{ 4601, 9465},
+        { 4945, 9281},{ 5210, 9076},{ 5420, 9207},{ 5619, 9307}
       },
       /*Cb  qi=21  INTER*/
       {
-        {   99,  -47},{  117,  279},{  131,  628},{  136, 1036},
-        {  146, 1442},{  160, 1838},{  175, 2218},{  190, 2585},
-        {  206, 2939},{  225, 3275},{  246, 3589},{  271, 3884},
-        {  300, 4168},{  332, 4449},{  371, 4719},{  416, 4978},
-        {  466, 5233},{  525, 5486},{  594, 5729},{  668, 5967},
-        {  747, 6196},{  831, 6412},{  915, 6622},{ 1007, 6824}
+        {   35, -144},{   60, 1445},{   91, 3018},{  110, 4470},
+        {  133, 5811},{  170, 7086},{  223, 8300},{  305, 9413},
+        {  421,10374},{  549,11237},{  689,12084},{  873,12898},
+        { 1189,13496},{ 1692,13612},{ 2288,13374},{ 2939,12919},
+        { 3540,12358},{ 3964,12087},{ 4259,12099},{ 4567,12007},
+        { 4997,12110},{ 5322,11981},{ 5749,11986},{ 6121,11961}
       }
     },
     {
       /*Cr  qi=21  INTRA*/
       {
-        {   14,    5},{  115,  382},{  187,  776},{  220, 1240},
-        {  242, 1714},{  268, 2165},{  304, 2563},{  347, 2880},
-        {  401, 3144},{  452, 3382},{  516, 3596},{  588, 3792},
-        {  649, 3986},{  717, 4174},{  783, 4371},{  849, 4539},
-        {  923, 4661},{  991, 4805},{ 1046, 4977},{ 1104, 5132},
-        { 1161, 5319},{ 1200, 5499},{ 1230, 5671},{ 1279, 5866}
+        {   36,  -59},{  187, 1632},{  361, 3048},{  570, 4094},
+        {  793, 4957},{ 1011, 5708},{ 1275, 6305},{ 1577, 6718},
+        { 1865, 7145},{ 2109, 7434},{ 2367, 7688},{ 2699, 7810},
+        { 2916, 7782},{ 3099, 7956},{ 3411, 8129},{ 3861, 8072},
+        { 4171, 8513},{ 4148, 8721},{ 4139, 8579},{ 4243, 8711},
+        { 4741, 8915},{ 5125, 9063},{ 5359, 9164},{ 5655, 9335}
       },
       /*Cr  qi=21  INTER*/
       {
-        {  120,  -74},{  126,  287},{  132,  657},{  138, 1050},
-        {  146, 1447},{  158, 1841},{  169, 2229},{  178, 2608},
-        {  191, 2969},{  207, 3307},{  228, 3623},{  256, 3919},
-        {  289, 4204},{  327, 4481},{  372, 4745},{  420, 4998},
-        {  477, 5237},{  542, 5468},{  610, 5694},{  672, 5924},
-        {  730, 6162},{  791, 6397},{  850, 6632},{  911, 6874}
+        {   29, -140},{   63, 1451},{   90, 3020},{  107, 4486},
+        {  134, 5842},{  176, 7081},{  225, 8233},{  293, 9342},
+        {  433,10332},{  702,11053},{ 1079,11500},{ 1510,11747},
+        { 1981,11773},{ 2454,11701},{ 2922,11677},{ 3376,11585},
+        { 3812,11562},{ 4213,11499},{ 4467,11339},{ 4823,11358},
+        { 5232,11348},{ 5619,11352},{ 5918,11322},{ 6295,11279}
       }
     }
   },
@@ -1422,61 +1422,61 @@
     {
       /*Y'  qi=22  INTRA*/
       {
-        {  238,  -42},{  353, 1495},{  607, 2723},{  979, 3433},
-        { 1364, 3893},{ 1735, 4369},{ 2095, 4863},{ 2439, 5351},
-        { 2769, 5823},{ 3090, 6274},{ 3398, 6709},{ 3702, 7071},
-        { 4004, 7395},{ 4281, 7734},{ 4546, 8080},{ 4810, 8425},
-        { 5060, 8736},{ 5313, 9050},{ 5554, 9334},{ 5763, 9596},
-        { 5961, 9882},{ 6165,10130},{ 6376,10341},{ 6592,10685}
+        {  147,  -48},{  269, 1477},{  509, 2690},{  792, 3582},
+        { 1071, 4301},{ 1337, 4962},{ 1610, 5550},{ 1903, 6058},
+        { 2208, 6490},{ 2546, 6844},{ 2888, 7158},{ 3235, 7376},
+        { 3584, 7565},{ 3904, 7783},{ 4213, 8049},{ 4559, 8313},
+        { 4905, 8482},{ 5222, 8655},{ 5541, 8789},{ 5833, 8853},
+        { 6165, 8894},{ 6502, 8955},{ 6833, 9019},{ 7273, 9049}
       },
       /*Y'  qi=22  INTER*/
       {
-        {  173,  -13},{  157, 1344},{  247, 2741},{  385, 3983},
-        {  580, 5068},{  846, 6052},{ 1167, 6942},{ 1518, 7754},
-        { 1886, 8517},{ 2267, 9239},{ 2661, 9895},{ 3075,10444},
-        { 3511,10854},{ 3958,11122},{ 4394,11285},{ 4803,11401},
-        { 5184,11500},{ 5538,11587},{ 5867,11669},{ 6176,11748},
-        { 6462,11803},{ 6730,11834},{ 6987,11870},{ 7217,11864}
+        {   66,  -97},{   67, 1345},{  120, 2836},{  166, 4274},
+        {  210, 5581},{  250, 6811},{  301, 7998},{  387, 9111},
+        {  519,10116},{  700,11004},{  939,11769},{ 1262,12375},
+        { 1694,12774},{ 2217,12969},{ 2789,13010},{ 3360,12953},
+        { 3895,12853},{ 4380,12737},{ 4817,12636},{ 5222,12546},
+        { 5599,12459},{ 5936,12399},{ 6254,12328},{ 6571,12266}
       }
     },
     {
       /*Cb  qi=22  INTRA*/
       {
-        {   15,    2},{  117,  369},{  194,  750},{  224, 1194},
-        {  247, 1660},{  280, 2104},{  320, 2500},{  366, 2844},
-        {  417, 3145},{  478, 3397},{  542, 3615},{  606, 3833},
-        {  671, 4032},{  739, 4198},{  803, 4362},{  862, 4554},
-        {  930, 4723},{  999, 4863},{ 1063, 5005},{ 1119, 5182},
-        { 1179, 5342},{ 1233, 5479},{ 1289, 5627},{ 1349, 5821}
+        {   43,  -42},{  198, 1605},{  387, 3027},{  612, 4071},
+        {  825, 4936},{ 1054, 5663},{ 1353, 6150},{ 1667, 6408},
+        { 1987, 6658},{ 2307, 7018},{ 2606, 7287},{ 2805, 7601},
+        { 3116, 8059},{ 3488, 8307},{ 3667, 8498},{ 3944, 8832},
+        { 4282, 9073},{ 4419, 8976},{ 4597, 9011},{ 4864, 9208},
+        { 5201, 9051},{ 5520, 8819},{ 5745, 8971},{ 5962, 9134}
       },
       /*Cb  qi=22  INTER*/
       {
-        {  111,  -49},{  122,  279},{  129,  629},{  136, 1037},
-        {  147, 1442},{  161, 1837},{  177, 2215},{  193, 2577},
-        {  211, 2927},{  232, 3257},{  257, 3564},{  285, 3855},
-        {  316, 4140},{  350, 4416},{  395, 4680},{  447, 4936},
-        {  502, 5187},{  569, 5432},{  643, 5673},{  724, 5902},
-        {  812, 6125},{  899, 6338},{  983, 6541},{ 1068, 6732}
+        {   34, -140},{   62, 1444},{   93, 3009},{  113, 4451},
+        {  139, 5780},{  181, 7039},{  245, 8228},{  344, 9301},
+        {  480,10215},{  631,11043},{  790,11878},{ 1019,12632},
+        { 1422,13072},{ 2025,13032},{ 2687,12710},{ 3322,11942},
+        { 3841,11396},{ 4151,11396},{ 4451,11349},{ 4944,11261},
+        { 5333,11449},{ 5652,11521},{ 6071,11686},{ 6464,11776}
       }
     },
     {
       /*Cr  qi=22  INTRA*/
       {
-        {   14,    5},{  115,  383},{  187,  776},{  220, 1240},
-        {  243, 1712},{  271, 2160},{  308, 2554},{  355, 2866},
-        {  411, 3122},{  464, 3356},{  530, 3571},{  603, 3768},
-        {  668, 3955},{  739, 4137},{  804, 4335},{  871, 4497},
-        {  951, 4609},{ 1024, 4744},{ 1078, 4916},{ 1136, 5073},
-        { 1190, 5258},{ 1228, 5443},{ 1268, 5608},{ 1333, 5773}
+        {   39,  -50},{  199, 1620},{  390, 3000},{  614, 4019},
+        {  853, 4838},{ 1099, 5529},{ 1399, 6075},{ 1725, 6455},
+        { 2054, 6803},{ 2351, 7030},{ 2601, 7333},{ 2851, 7562},
+        { 3047, 7519},{ 3364, 7523},{ 3790, 7670},{ 4174, 7705},
+        { 4603, 8099},{ 4656, 8176},{ 4411, 8025},{ 4541, 8393},
+        { 4835, 8686},{ 5158, 8954},{ 5407, 9110},{ 5638, 9403}
       },
       /*Cr  qi=22  INTER*/
       {
-        {  133,  -80},{  131,  286},{  133,  659},{  138, 1052},
-        {  147, 1447},{  158, 1838},{  170, 2223},{  181, 2598},
-        {  195, 2955},{  214, 3289},{  237, 3601},{  266, 3897},
-        {  303, 4178},{  345, 4448},{  396, 4705},{  455, 4949},
-        {  519, 5188},{  586, 5420},{  656, 5638},{  722, 5862},
-        {  788, 6095},{  850, 6331},{  914, 6560},{  984, 6793}
+        {   27, -140},{   66, 1451},{   92, 3011},{  110, 4466},
+        {  142, 5805},{  188, 7026},{  246, 8157},{  332, 9232},
+        {  506,10171},{  822,10819},{ 1264,11128},{ 1737,11313},
+        { 2211,11276},{ 2719,11153},{ 3189,11086},{ 3520,11026},
+        { 3889,11066},{ 4304,10999},{ 4638,10992},{ 4850,11205},
+        { 5199,11203},{ 5556,11171},{ 5896,11185},{ 6236,11199}
       }
     }
   },
@@ -1484,61 +1484,61 @@
     {
       /*Y'  qi=23  INTRA*/
       {
-        {  253,  -36},{  377, 1480},{  654, 2660},{ 1055, 3323},
-        { 1465, 3760},{ 1855, 4222},{ 2231, 4715},{ 2589, 5204},
-        { 2926, 5675},{ 3254, 6131},{ 3569, 6569},{ 3878, 6931},
-        { 4185, 7250},{ 4466, 7586},{ 4731, 7939},{ 4999, 8276},
-        { 5254, 8578},{ 5510, 8890},{ 5751, 9167},{ 5960, 9411},
-        { 6159, 9688},{ 6361, 9943},{ 6574,10148},{ 6796,10475}
+        {  139,  -44},{  276, 1465},{  530, 2648},{  829, 3513},
+        { 1122, 4210},{ 1399, 4859},{ 1680, 5442},{ 1980, 5944},
+        { 2297, 6370},{ 2643, 6721},{ 2995, 7030},{ 3352, 7228},
+        { 3707, 7403},{ 4041, 7608},{ 4366, 7849},{ 4711, 8095},
+        { 5065, 8250},{ 5394, 8416},{ 5715, 8549},{ 6014, 8604},
+        { 6354, 8631},{ 6697, 8681},{ 7024, 8744},{ 7457, 8763}
       },
       /*Y'  qi=23  INTER*/
       {
-        {  180,    4},{  170, 1341},{  267, 2726},{  417, 3953},
-        {  631, 5022},{  920, 5989},{ 1262, 6861},{ 1629, 7664},
-        { 2010, 8421},{ 2405, 9132},{ 2816, 9767},{ 3250,10280},
-        { 3703,10646},{ 4164,10869},{ 4606,11013},{ 5018,11125},
-        { 5396,11218},{ 5747,11308},{ 6079,11402},{ 6387,11475},
-        { 6671,11523},{ 6944,11562},{ 7201,11593},{ 7461,11641}
+        {   63,  -97},{   70, 1344},{  123, 2832},{  171, 4257},
+        {  217, 5551},{  262, 6770},{  322, 7941},{  424, 9025},
+        {  579, 9993},{  792,10833},{ 1079,11530},{ 1466,12041},
+        { 1968,12340},{ 2551,12449},{ 3154,12431},{ 3731,12350},
+        { 4252,12250},{ 4720,12139},{ 5156,12033},{ 5561,11956},
+        { 5932,11890},{ 6271,11811},{ 6579,11743},{ 6889,11713}
       }
     },
     {
       /*Cb  qi=23  INTRA*/
       {
-        {   15,    2},{  124,  369},{  206,  750},{  237, 1194},
-        {  263, 1655},{  299, 2086},{  344, 2463},{  396, 2789},
-        {  452, 3076},{  517, 3317},{  584, 3528},{  651, 3741},
-        {  718, 3936},{  789, 4096},{  859, 4259},{  917, 4457},
-        {  987, 4621},{ 1058, 4752},{ 1123, 4898},{ 1178, 5078},
-        { 1234, 5240},{ 1294, 5378},{ 1354, 5529},{ 1420, 5731}
+        {   44,  -42},{  203, 1599},{  404, 3002},{  636, 4026},
+        {  858, 4869},{ 1100, 5570},{ 1391, 6059},{ 1708, 6349},
+        { 2050, 6571},{ 2365, 6885},{ 2643, 7151},{ 2852, 7468},
+        { 3186, 7918},{ 3592, 8116},{ 3813, 8253},{ 4107, 8566},
+        { 4445, 8786},{ 4574, 8784},{ 4747, 8937},{ 5013, 9029},
+        { 5336, 8793},{ 5635, 8577},{ 5856, 8768},{ 6070, 8917}
       },
       /*Cb  qi=23  INTER*/
       {
-        {  112,   31},{  129,  334},{  143,  655},{  149, 1043},
-        {  161, 1442},{  175, 1834},{  192, 2207},{  210, 2561},
-        {  230, 2902},{  254, 3226},{  280, 3531},{  311, 3821},
-        {  346, 4100},{  386, 4369},{  433, 4630},{  488, 4885},
-        {  554, 5132},{  630, 5373},{  715, 5600},{  802, 5824},
-        {  892, 6046},{  988, 6253},{ 1082, 6450},{ 1193, 6625}
+        {   33, -137},{   63, 1445},{   95, 3003},{  117, 4435},
+        {  147, 5751},{  195, 6995},{  271, 8161},{  387, 9190},
+        {  541,10073},{  701,10896},{  889,11702},{ 1203,12320},
+        { 1718,12544},{ 2385,12392},{ 3037,11910},{ 3616,11293},
+        { 4098,10957},{ 4486,10784},{ 4770,10901},{ 5191,10802},
+        { 5631,10812},{ 6053,11050},{ 6455,11058},{ 6862,11121}
       }
     },
     {
       /*Cr  qi=23  INTRA*/
       {
-        {   15,    5},{  123,  385},{  199,  779},{  234, 1240},
-        {  261, 1705},{  293, 2136},{  335, 2511},{  386, 2807},
-        {  445, 3055},{  502, 3282},{  572, 3492},{  648, 3684},
-        {  717, 3865},{  788, 4041},{  858, 4225},{  932, 4378},
-        { 1014, 4492},{ 1081, 4636},{ 1134, 4814},{ 1196, 4969},
-        { 1252, 5145},{ 1292, 5331},{ 1333, 5503},{ 1397, 5678}
+        {   44,  -50},{  207, 1613},{  406, 2976},{  636, 3980},
+        {  886, 4779},{ 1146, 5438},{ 1459, 5962},{ 1795, 6335},
+        { 2133, 6680},{ 2434, 6890},{ 2716, 7131},{ 2988, 7305},
+        { 3177, 7253},{ 3490, 7264},{ 3931, 7438},{ 4301, 7442},
+        { 4668, 7882},{ 4742, 8057},{ 4594, 7765},{ 4802, 7951},
+        { 5136, 8174},{ 5546, 8418},{ 5707, 8617},{ 5968, 8844}
       },
       /*Cr  qi=23  INTER*/
       {
-        {  125,   56},{  136,  363},{  144,  681},{  149, 1054},
-        {  160, 1448},{  173, 1837},{  185, 2214},{  197, 2583},
-        {  213, 2932},{  234, 3260},{  260, 3568},{  293, 3858},
-        {  334, 4135},{  384, 4397},{  439, 4650},{  503, 4892},
-        {  575, 5123},{  647, 5354},{  722, 5575},{  789, 5803},
-        {  856, 6034},{  929, 6255},{  996, 6480},{ 1055, 6709}
+        {   30, -143},{   68, 1451},{   94, 3006},{  113, 4449},
+        {  148, 5774},{  203, 6976},{  272, 8089},{  377, 9137},
+        {  587,10014},{  951,10585},{ 1426,10842},{ 1952,10876},
+        { 2511,10726},{ 2998,10640},{ 3413,10545},{ 3722,10571},
+        { 4167,10568},{ 4500,10510},{ 4877,10470},{ 5188,10531},
+        { 5586,10568},{ 5903,10510},{ 6208,10478},{ 6559,10466}
       }
     }
   },
@@ -1546,61 +1546,61 @@
     {
       /*Y'  qi=24  INTRA*/
       {
-        {  253,  -35},{  378, 1475},{  664, 2631},{ 1075, 3275},
-        { 1491, 3706},{ 1887, 4161},{ 2272, 4648},{ 2639, 5129},
-        { 2986, 5586},{ 3323, 6027},{ 3646, 6447},{ 3961, 6790},
-        { 4274, 7098},{ 4561, 7420},{ 4831, 7758},{ 5102, 8088},
-        { 5359, 8380},{ 5621, 8674},{ 5868, 8931},{ 6081, 9163},
-        { 6285, 9420},{ 6492, 9646},{ 6707, 9844},{ 6924,10173}
+        {  139,  -42},{  289, 1451},{  556, 2604},{  866, 3440},
+        { 1173, 4110},{ 1471, 4730},{ 1777, 5287},{ 2102, 5772},
+        { 2437, 6185},{ 2797, 6525},{ 3156, 6826},{ 3526, 7020},
+        { 3903, 7165},{ 4251, 7343},{ 4592, 7577},{ 4952, 7804},
+        { 5310, 7944},{ 5644, 8092},{ 5980, 8201},{ 6291, 8239},
+        { 6628, 8270},{ 6969, 8324},{ 7298, 8385},{ 7728, 8421}
       },
       /*Y'  qi=24  INTER*/
       {
-        {  181,   -8},{  170, 1343},{  273, 2711},{  435, 3924},
-        {  671, 4977},{  985, 5925},{ 1351, 6776},{ 1743, 7553},
-        { 2152, 8282},{ 2574, 8957},{ 3013, 9547},{ 3476,10000},
-        { 3957,10294},{ 4433,10470},{ 4879,10590},{ 5288,10697},
-        { 5669,10785},{ 6020,10862},{ 6348,10939},{ 6657,11004},
-        { 6940,11052},{ 7213,11094},{ 7471,11125},{ 7718,11154}
+        {   67,  -79},{   77, 1333},{  131, 2816},{  183, 4223},
+        {  233, 5502},{  283, 6710},{  357, 7861},{  482, 8911},
+        {  666, 9833},{  924,10609},{ 1283,11206},{ 1766,11588},
+        { 2362,11750},{ 3002,11760},{ 3620,11695},{ 4185,11595},
+        { 4694,11492},{ 5158,11400},{ 5582,11322},{ 5969,11248},
+        { 6332,11183},{ 6673,11118},{ 6990,11061},{ 7306,11048}
       }
     },
     {
       /*Cb  qi=24  INTRA*/
       {
-        {   15,    2},{  125,  370},{  206,  751},{  238, 1194},
-        {  265, 1652},{  303, 2078},{  351, 2450},{  405, 2769},
-        {  464, 3052},{  532, 3288},{  602, 3495},{  669, 3705},
-        {  740, 3893},{  814, 4052},{  887, 4214},{  949, 4405},
-        { 1018, 4571},{ 1091, 4702},{ 1157, 4837},{ 1214, 5014},
-        { 1272, 5182},{ 1334, 5315},{ 1397, 5446},{ 1458, 5652}
+        {   47,  -43},{  212, 1591},{  421, 2973},{  662, 3977},
+        {  895, 4796},{ 1151, 5470},{ 1480, 5906},{ 1817, 6127},
+        { 2168, 6311},{ 2519, 6642},{ 2837, 6889},{ 3068, 7168},
+        { 3444, 7594},{ 3875, 7795},{ 4041, 7988},{ 4344, 8257},
+        { 4733, 8428},{ 4797, 8435},{ 4896, 8665},{ 5148, 8846},
+        { 5469, 8539},{ 5793, 8301},{ 6021, 8566},{ 6249, 8830}
       },
       /*Cb  qi=24  INTER*/
       {
-        {  119,   22},{  130,  330},{  140,  655},{  148, 1043},
-        {  161, 1441},{  177, 1830},{  195, 2198},{  215, 2550},
-        {  238, 2887},{  264, 3205},{  293, 3505},{  326, 3792},
-        {  365, 4068},{  409, 4335},{  463, 4594},{  525, 4842},
-        {  597, 5083},{  682, 5314},{  773, 5540},{  869, 5760},
-        {  969, 5967},{ 1068, 6161},{ 1162, 6351},{ 1253, 6526}
+        {   38, -165},{   70, 1441},{  102, 2985},{  127, 4402},
+        {  163, 5699},{  222, 6915},{  315, 8049},{  453, 9043},
+        {  626, 9891},{  824,10663},{ 1067,11417},{ 1499,11868},
+        { 2145,11835},{ 2876,11513},{ 3471,11006},{ 3990,10456},
+        { 4460,10250},{ 4802,10198},{ 5158,10098},{ 5556, 9965},
+        { 6029,10119},{ 6419,10285},{ 6815,10443},{ 7228,10535}
       }
     },
     {
       /*Cr  qi=24  INTRA*/
       {
-        {   16,    5},{  123,  386},{  199,  779},{  235, 1240},
-        {  263, 1702},{  297, 2128},{  342, 2494},{  395, 2788},
-        {  457, 3033},{  516, 3256},{  589, 3469},{  670, 3659},
-        {  739, 3836},{  812, 4004},{  884, 4181},{  959, 4332},
-        { 1043, 4439},{ 1117, 4575},{ 1174, 4750},{ 1231, 4907},
-        { 1293, 5074},{ 1338, 5252},{ 1378, 5430},{ 1447, 5581}
+        {   42,  -47},{  214, 1604},{  424, 2942},{  665, 3923},
+        {  926, 4696},{ 1205, 5329},{ 1535, 5834},{ 1882, 6184},
+        { 2248, 6482},{ 2557, 6697},{ 2829, 6963},{ 3093, 7139},
+        { 3279, 7085},{ 3577, 7155},{ 4052, 7326},{ 4451, 7291},
+        { 4802, 7768},{ 4832, 7946},{ 4692, 7560},{ 4940, 7890},
+        { 5326, 8143},{ 5649, 8344},{ 5877, 8484},{ 6160, 8707}
       },
       /*Cr  qi=24  INTER*/
       {
-        {  125,   54},{  134,  362},{  142,  681},{  149, 1055},
-        {  160, 1447},{  174, 1832},{  188, 2207},{  201, 2571},
-        {  219, 2917},{  242, 3241},{  271, 3543},{  308, 3829},
-        {  353, 4102},{  409, 4361},{  472, 4605},{  544, 4837},
-        {  621, 5067},{  698, 5293},{  774, 5514},{  848, 5734},
-        {  920, 5960},{  994, 6186},{ 1075, 6396},{ 1159, 6607}
+        {   32, -136},{   74, 1449},{  101, 2990},{  124, 4419},
+        {  167, 5718},{  232, 6893},{  314, 7988},{  444, 8998},
+        {  708, 9781},{ 1149,10212},{ 1716,10318},{ 2318,10181},
+        { 2849,10007},{ 3313, 9944},{ 3806, 9776},{ 4229, 9793},
+        { 4567, 9922},{ 4952,10008},{ 5190,10021},{ 5505, 9830},
+        { 5859, 9829},{ 6255, 9827},{ 6596, 9762},{ 6950, 9745}
       }
     }
   },
@@ -1608,61 +1608,61 @@
     {
       /*Y'  qi=25  INTRA*/
       {
-        {  252,  -34},{  385, 1472},{  689, 2607},{ 1120, 3223},
-        { 1552, 3638},{ 1965, 4082},{ 2365, 4554},{ 2747, 5020},
-        { 3107, 5473},{ 3455, 5907},{ 3786, 6317},{ 4107, 6654},
-        { 4430, 6947},{ 4727, 7252},{ 5007, 7579},{ 5285, 7897},
-        { 5549, 8175},{ 5814, 8451},{ 6064, 8698},{ 6280, 8925},
-        { 6489, 9174},{ 6702, 9384},{ 6917, 9573},{ 7130, 9898}
+        {  137,  -36},{  304, 1435},{  587, 2558},{  915, 3370},
+        { 1244, 4010},{ 1564, 4602},{ 1889, 5145},{ 2239, 5604},
+        { 2605, 5983},{ 2983, 6300},{ 3362, 6575},{ 3744, 6750},
+        { 4133, 6876},{ 4495, 7038},{ 4846, 7253},{ 5223, 7451},
+        { 5595, 7573},{ 5942, 7709},{ 6277, 7824},{ 6588, 7863},
+        { 6926, 7878},{ 7269, 7917},{ 7602, 7966},{ 8013, 7991}
       },
       /*Y'  qi=25  INTER*/
       {
-        {  180,   -4},{  172, 1342},{  284, 2698},{  466, 3892},
-        {  730, 4924},{ 1073, 5846},{ 1465, 6670},{ 1880, 7424},
-        { 2310, 8130},{ 2755, 8780},{ 3224, 9326},{ 3719, 9714},
-        { 4222, 9951},{ 4704,10101},{ 5150,10210},{ 5562,10303},
-        { 5942,10388},{ 6295,10474},{ 6627,10547},{ 6932,10598},
-        { 7226,10648},{ 7499,10679},{ 7744,10685},{ 7988,10712}
+        {   63,  -45},{   81, 1336},{  136, 2810},{  190, 4199},
+        {  243, 5463},{  300, 6657},{  388, 7786},{  541, 8797},
+        {  767, 9660},{ 1077,10365},{ 1514,10861},{ 2089,11124},
+        { 2747,11202},{ 3412,11169},{ 4027,11084},{ 4582,10983},
+        { 5079,10888},{ 5536,10796},{ 5959,10724},{ 6340,10664},
+        { 6698,10601},{ 7035,10535},{ 7347,10480},{ 7675,10446}
       }
     },
     {
       /*Cb  qi=25  INTRA*/
       {
-        {   16,    2},{  126,  370},{  207,  751},{  240, 1193},
-        {  269, 1647},{  309, 2066},{  360, 2429},{  419, 2740},
-        {  481, 3017},{  551, 3251},{  623, 3457},{  695, 3661},
-        {  768, 3847},{  845, 4005},{  922, 4160},{  984, 4345},
-        { 1056, 4508},{ 1136, 4632},{ 1201, 4768},{ 1253, 4941},
-        { 1316, 5099},{ 1376, 5243},{ 1440, 5383},{ 1518, 5588}
+        {   51,  -44},{  220, 1580},{  445, 2931},{  702, 3906},
+        {  954, 4690},{ 1235, 5318},{ 1566, 5734},{ 1895, 6002},
+        { 2250, 6227},{ 2622, 6455},{ 2948, 6658},{ 3202, 6942},
+        { 3598, 7299},{ 4055, 7442},{ 4255, 7608},{ 4571, 7883},
+        { 4962, 8018},{ 5048, 8056},{ 5194, 8318},{ 5479, 8515},
+        { 5780, 8216},{ 6083, 7879},{ 6362, 8111},{ 6642, 8343}
       },
       /*Cb  qi=25  INTER*/
       {
-        {  106,   20},{  127,  330},{  141,  655},{  149, 1043},
-        {  162, 1440},{  178, 1826},{  198, 2192},{  221, 2538},
-        {  248, 2868},{  277, 3182},{  309, 3479},{  346, 3765},
-        {  390, 4036},{  445, 4296},{  505, 4549},{  576, 4792},
-        {  659, 5024},{  751, 5251},{  850, 5468},{  950, 5682},
-        { 1055, 5881},{ 1163, 6063},{ 1263, 6249},{ 1370, 6427}
+        {   41, -160},{   73, 1441},{  106, 2973},{  133, 4375},
+        {  175, 5657},{  244, 6857},{  352, 7968},{  516, 8912},
+        {  720, 9713},{  922,10497},{ 1252,11133},{ 1820,11376},
+        { 2539,11216},{ 3254,10824},{ 3871,10282},{ 4366, 9800},
+        { 4642, 9817},{ 4959, 9785},{ 5394, 9789},{ 5901, 9599},
+        { 6354, 9756},{ 6795, 9914},{ 7256, 9903},{ 7713, 9957}
       }
     },
     {
       /*Cr  qi=25  INTRA*/
       {
-        {   16,    6},{  124,  386},{  201,  780},{  238, 1238},
-        {  267, 1695},{  304, 2111},{  353, 2468},{  411, 2753},
-        {  474, 2995},{  536, 3217},{  615, 3426},{  698, 3617},
-        {  767, 3790},{  841, 3955},{  918, 4126},{  999, 4268},
-        { 1082, 4375},{ 1154, 4514},{ 1213, 4687},{ 1275, 4831},
-        { 1337, 5000},{ 1379, 5182},{ 1422, 5353},{ 1489, 5502}
+        {   46,  -48},{  225, 1591},{  451, 2899},{  705, 3854},
+        {  971, 4609},{ 1258, 5220},{ 1599, 5709},{ 1948, 6064},
+        { 2306, 6385},{ 2624, 6595},{ 2923, 6817},{ 3205, 6973},
+        { 3433, 6944},{ 3715, 7043},{ 4135, 7177},{ 4615, 7029},
+        { 4885, 7528},{ 4914, 7766},{ 5034, 7390},{ 5123, 7379},
+        { 5580, 7621},{ 5956, 7843},{ 6275, 7862},{ 6589, 7995}
       },
       /*Cr  qi=25  INTER*/
       {
-        {  135,   50},{  138,  361},{  143,  681},{  149, 1054},
-        {  161, 1445},{  176, 1828},{  191, 2199},{  206, 2560},
-        {  226, 2903},{  253, 3223},{  287, 3520},{  330, 3799},
-        {  383, 4062},{  445, 4315},{  518, 4556},{  598, 4783},
-        {  683, 5002},{  765, 5224},{  841, 5446},{  919, 5670},
-        { 1000, 5886},{ 1081, 6094},{ 1164, 6305},{ 1233, 6523}
+        {   31, -138},{   77, 1447},{  105, 2978},{  130, 4394},
+        {  179, 5675},{  255, 6827},{  352, 7902},{  512, 8871},
+        {  832, 9566},{ 1338, 9901},{ 1963, 9906},{ 2568, 9720},
+        { 3122, 9547},{ 3611, 9514},{ 3982, 9582},{ 4398, 9681},
+        { 4784, 9826},{ 5127, 9870},{ 5530, 9802},{ 5926, 9797},
+        { 6338, 9777},{ 6682, 9749},{ 6848, 9695},{ 7200, 9708}
       }
     }
   },
@@ -1670,61 +1670,61 @@
     {
       /*Y'  qi=26  INTRA*/
       {
-        {  258,  -31},{  400, 1459},{  722, 2551},{ 1169, 3138},
-        { 1615, 3542},{ 2039, 3983},{ 2450, 4461},{ 2843, 4928},
-        { 3216, 5372},{ 3573, 5801},{ 3910, 6212},{ 4235, 6548},
-        { 4561, 6836},{ 4859, 7132},{ 5141, 7450},{ 5422, 7763},
-        { 5690, 8035},{ 5958, 8307},{ 6208, 8548},{ 6426, 8763},
-        { 6637, 8999},{ 6854, 9211},{ 7072, 9398},{ 7298, 9718}
+        {  131,  -15},{  324, 1411},{  646, 2454},{ 1016, 3161},
+        { 1373, 3711},{ 1718, 4237},{ 2083, 4726},{ 2481, 5138},
+        { 2889, 5485},{ 3305, 5775},{ 3721, 6029},{ 4136, 6199},
+        { 4553, 6322},{ 4950, 6459},{ 5333, 6626},{ 5725, 6787},
+        { 6092, 6900},{ 6450, 6994},{ 6792, 7069},{ 7092, 7111},
+        { 7422, 7116},{ 7744, 7133},{ 8055, 7164},{ 8437, 7181}
       },
       /*Y'  qi=26  INTER*/
       {
-        {  178,    4},{  177, 1342},{  304, 2683},{  507, 3858},
-        {  799, 4872},{ 1167, 5777},{ 1579, 6592},{ 2013, 7342},
-        { 2463, 8039},{ 2932, 8668},{ 3429, 9170},{ 3952, 9500},
-        { 4471, 9695},{ 4958, 9825},{ 5404, 9930},{ 5816,10028},
-        { 6194,10113},{ 6545,10187},{ 6878,10268},{ 7193,10333},
-        { 7482,10365},{ 7753,10399},{ 8004,10427},{ 8244,10452}
+        {   54,   -7},{  100, 1333},{  164, 2770},{  230, 4119},
+        {  281, 5378},{  330, 6589},{  432, 7703},{  610, 8679},
+        {  870, 9497},{ 1238,10127},{ 1749,10531},{ 2391,10707},
+        { 3088,10726},{ 3759,10665},{ 4368,10570},{ 4909,10469},
+        { 5395,10375},{ 5842,10303},{ 6249,10233},{ 6636,10170},
+        { 6995,10117},{ 7319,10073},{ 7620,10026},{ 7887, 9997}
       }
     },
     {
       /*Cb  qi=26  INTRA*/
       {
-        {   17,    2},{  134,  370},{  222,  751},{  258, 1192},
-        {  290, 1638},{  334, 2041},{  391, 2388},{  456, 2686},
-        {  523, 2953},{  595, 3181},{  672, 3382},{  749, 3580},
-        {  828, 3763},{  904, 3921},{  980, 4076},{ 1050, 4257},
-        { 1121, 4425},{ 1199, 4551},{ 1268, 4678},{ 1329, 4855},
-        { 1391, 5012},{ 1452, 5149},{ 1514, 5292},{ 1584, 5469}
+        {   57,  -50},{  254, 1570},{  521, 2858},{  805, 3781},
+        { 1088, 4498},{ 1407, 5057},{ 1759, 5450},{ 2098, 5741},
+        { 2450, 6006},{ 2825, 6215},{ 3158, 6386},{ 3435, 6633},
+        { 3835, 6950},{ 4293, 7093},{ 4562, 7225},{ 4884, 7437},
+        { 5266, 7557},{ 5367, 7594},{ 5510, 7800},{ 5836, 7950},
+        { 6127, 7800},{ 6386, 7619},{ 6555, 7837},{ 6761, 8009}
       },
       /*Cb  qi=26  INTER*/
       {
-        {  133,   54},{  140,  366},{  144,  683},{  151, 1052},
-        {  166, 1444},{  185, 1827},{  208, 2185},{  234, 2523},
-        {  264, 2845},{  300, 3152},{  337, 3446},{  381, 3724},
-        {  434, 3989},{  492, 4246},{  560, 4494},{  643, 4729},
-        {  735, 4957},{  831, 5185},{  938, 5397},{ 1051, 5595},
-        { 1164, 5787},{ 1272, 5969},{ 1372, 6157},{ 1465, 6357}
+        {   50, -123},{   98, 1439},{  135, 2913},{  184, 4246},
+        {  280, 5441},{  460, 6499},{  701, 7439},{  829, 8447},
+        {  864, 9478},{ 1066,10274},{ 1486,10797},{ 2130,10918},
+        { 2894,10603},{ 3607,10159},{ 4152, 9745},{ 4512, 9452},
+        { 4850, 9316},{ 5226, 9237},{ 5623, 9414},{ 5999, 9346},
+        { 6495, 9457},{ 6942, 9441},{ 7318, 9439},{ 7742, 9466}
       }
     },
     {
       /*Cr  qi=26  INTRA*/
       {
-        {   16,    5},{  134,  384},{  217,  779},{  257, 1235},
-        {  291, 1682},{  333, 2078},{  387, 2417},{  448, 2694},
-        {  514, 2933},{  581, 3153},{  661, 3358},{  749, 3542},
-        {  825, 3713},{  902, 3879},{  981, 4048},{ 1064, 4183},
-        { 1146, 4294},{ 1220, 4429},{ 1283, 4589},{ 1347, 4738},
-        { 1408, 4915},{ 1456, 5089},{ 1497, 5270},{ 1555, 5473}
+        {   50,  -46},{  265, 1579},{  523, 2841},{  801, 3733},
+        { 1118, 4385},{ 1469, 4882},{ 1859, 5290},{ 2244, 5612},
+        { 2652, 5867},{ 3015, 6049},{ 3358, 6278},{ 3614, 6473},
+        { 3722, 6521},{ 4121, 6504},{ 4696, 6592},{ 4998, 6632},
+        { 5595, 6936},{ 5723, 7019},{ 5241, 6891},{ 5455, 7067},
+        { 5822, 7256},{ 6228, 7499},{ 6519, 7631},{ 6813, 7830}
       },
       /*Cr  qi=26  INTER*/
       {
-        {  129,   55},{  138,  367},{  143,  688},{  150, 1061},
-        {  165, 1451},{  182, 1830},{  199, 2194},{  217, 2547},
-        {  242, 2882},{  273, 3193},{  313, 3485},{  363, 3759},
-        {  423, 4018},{  495, 4261},{  579, 4492},{  668, 4714},
-        {  756, 4936},{  840, 5157},{  923, 5378},{ 1009, 5598},
-        { 1094, 5809},{ 1177, 6020},{ 1264, 6230},{ 1360, 6432}
+        {   41, -101},{   99, 1443},{  134, 2920},{  185, 4262},
+        {  292, 5436},{  463, 6458},{  690, 7391},{  831, 8413},
+        { 1010, 9287},{ 1550, 9537},{ 2220, 9468},{ 2849, 9285},
+        { 3396, 9145},{ 3757, 9048},{ 4154, 8953},{ 4557, 8909},
+        { 5011, 8987},{ 5432, 9014},{ 5742, 8987},{ 6062, 8949},
+        { 6469, 8950},{ 6842, 9173},{ 7179, 9125},{ 7559, 9146}
       }
     }
   },
@@ -1732,61 +1732,61 @@
     {
       /*Y'  qi=27  INTRA*/
       {
-        {  258,  -32},{  403, 1460},{  736, 2556},{ 1195, 3138},
-        { 1656, 3527},{ 2097, 3946},{ 2524, 4400},{ 2933, 4849},
-        { 3318, 5281},{ 3685, 5701},{ 4034, 6100},{ 4369, 6424},
-        { 4700, 6697},{ 5003, 6982},{ 5293, 7287},{ 5580, 7583},
-        { 5851, 7847},{ 6125, 8107},{ 6381, 8335},{ 6601, 8542},
-        { 6812, 8767},{ 7031, 8964},{ 7251, 9143},{ 7460, 9436}
+        {  125,   -3},{  337, 1395},{  679, 2410},{ 1069, 3082},
+        { 1447, 3603},{ 1813, 4107},{ 2191, 4591},{ 2595, 5009},
+        { 3007, 5365},{ 3427, 5656},{ 3850, 5903},{ 4267, 6074},
+        { 4680, 6196},{ 5063, 6335},{ 5422, 6531},{ 5793, 6722},
+        { 6167, 6831},{ 6547, 6910},{ 6901, 6976},{ 7214, 7007},
+        { 7547, 7009},{ 7871, 7036},{ 8192, 7070},{ 8608, 7068}
       },
       /*Y'  qi=27  INTER*/
       {
-        {  174,    3},{  178, 1343},{  309, 2679},{  528, 3841},
-        {  842, 4835},{ 1234, 5715},{ 1668, 6506},{ 2125, 7231},
-        { 2600, 7901},{ 3099, 8488},{ 3628, 8935},{ 4175, 9209},
-        { 4704, 9366},{ 5193, 9480},{ 5640, 9581},{ 6049, 9669},
-        { 6428, 9746},{ 6780, 9819},{ 7111, 9881},{ 7420, 9936},
-        { 7714, 9980},{ 7987,10006},{ 8236,10015},{ 8487, 9990}
+        {   53,  -12},{  102, 1336},{  170, 2762},{  238, 4103},
+        {  289, 5358},{  347, 6555},{  473, 7637},{  681, 8572},
+        {  983, 9334},{ 1415, 9889},{ 2002,10205},{ 2697,10317},
+        { 3411,10302},{ 4081,10221},{ 4681,10120},{ 5212,10028},
+        { 5689, 9944},{ 6126, 9874},{ 6534, 9812},{ 6913, 9753},
+        { 7263, 9708},{ 7587, 9666},{ 7889, 9625},{ 8205, 9596}
       }
     },
     {
       /*Cb  qi=27  INTRA*/
       {
-        {   17,    2},{  135,  370},{  222,  752},{  258, 1192},
-        {  291, 1635},{  337, 2036},{  396, 2379},{  462, 2674},
-        {  530, 2937},{  605, 3163},{  682, 3361},{  762, 3552},
-        {  844, 3730},{  923, 3886},{ 1001, 4038},{ 1071, 4220},
-        { 1146, 4379},{ 1228, 4497},{ 1297, 4628},{ 1354, 4804},
-        { 1419, 4959},{ 1489, 5092},{ 1555, 5230},{ 1629, 5427}
+        {   60,  -50},{  258, 1567},{  533, 2836},{  827, 3737},
+        { 1125, 4432},{ 1451, 4982},{ 1812, 5364},{ 2157, 5644},
+        { 2521, 5911},{ 2926, 6095},{ 3264, 6269},{ 3543, 6501},
+        { 3980, 6778},{ 4446, 6897},{ 4696, 7033},{ 5038, 7261},
+        { 5409, 7391},{ 5521, 7419},{ 5768, 7561},{ 6020, 7796},
+        { 6234, 7648},{ 6501, 7429},{ 6718, 7666},{ 6930, 7910}
       },
       /*Cb  qi=27  INTER*/
       {
-        {  142,   56},{  141,  368},{  143,  683},{  151, 1052},
-        {  166, 1443},{  185, 1825},{  210, 2181},{  238, 2517},
-        {  270, 2838},{  307, 3141},{  348, 3429},{  395, 3704},
-        {  451, 3968},{  517, 4221},{  594, 4462},{  683, 4691},
-        {  778, 4916},{  882, 5135},{  996, 5338},{ 1114, 5528},
-        { 1228, 5719},{ 1335, 5903},{ 1444, 6078},{ 1552, 6260}
+        {   52,  -95},{   98, 1442},{  140, 2901},{  198, 4217},
+        {  316, 5387},{  526, 6414},{  760, 7374},{  821, 8443},
+        {  907, 9390},{ 1206,10078},{ 1724,10471},{ 2456,10454},
+        { 3224,10087},{ 3889, 9676},{ 4419, 9277},{ 4807, 8993},
+        { 5162, 8931},{ 5465, 8948},{ 5816, 9027},{ 6334, 8906},
+        { 6840, 8983},{ 7327, 8995},{ 7745, 9001},{ 8219, 8993}
       }
     },
     {
       /*Cr  qi=27  INTRA*/
       {
-        {   15,    5},{  133,  384},{  217,  778},{  257, 1235},
-        {  293, 1678},{  337, 2071},{  392, 2406},{  455, 2679},
-        {  523, 2915},{  594, 3127},{  678, 3328},{  765, 3510},
-        {  841, 3677},{  921, 3842},{ 1000, 4006},{ 1089, 4135},
-        { 1175, 4240},{ 1248, 4381},{ 1311, 4545},{ 1380, 4682},
-        { 1445, 4854},{ 1491, 5030},{ 1537, 5201},{ 1630, 5329}
+        {   52,  -47},{  269, 1576},{  535, 2821},{  824, 3694},
+        { 1140, 4342},{ 1475, 4862},{ 1844, 5299},{ 2204, 5644},
+        { 2598, 5918},{ 2958, 6107},{ 3272, 6342},{ 3574, 6455},
+        { 3807, 6452},{ 4106, 6582},{ 4531, 6707},{ 4880, 6661},
+        { 5288, 6984},{ 5428, 7127},{ 5345, 6982},{ 5553, 7096},
+        { 5950, 7237},{ 6415, 7440},{ 6702, 7503},{ 7037, 7651}
       },
       /*Cr  qi=27  INTER*/
       {
-        {  134,   53},{  139,  366},{  143,  688},{  151, 1060},
-        {  165, 1451},{  182, 1828},{  200, 2190},{  220, 2541},
-        {  245, 2874},{  279, 3183},{  323, 3469},{  379, 3740},
-        {  447, 3991},{  526, 4230},{  615, 4457},{  708, 4677},
-        {  803, 4892},{  896, 5105},{  983, 5317},{ 1063, 5536},
-        { 1149, 5753},{ 1240, 5957},{ 1334, 6155},{ 1436, 6345}
+        {   41,  -95},{   99, 1446},{  137, 2909},{  201, 4231},
+        {  327, 5377},{  525, 6374},{  746, 7326},{  827, 8404},
+        { 1104, 9136},{ 1737, 9266},{ 2436, 9129},{ 3108, 8838},
+        { 3629, 8674},{ 4013, 8682},{ 4410, 8756},{ 4777, 8770},
+        { 5164, 8825},{ 5595, 8726},{ 5930, 8822},{ 6344, 8810},
+        { 6668, 8780},{ 6973, 8829},{ 7265, 8850},{ 7624, 8864}
       }
     }
   },
@@ -1794,61 +1794,61 @@
     {
       /*Y'  qi=28  INTRA*/
       {
-        {  250,  -28},{  406, 1456},{  749, 2531},{ 1221, 3097},
-        { 1692, 3480},{ 2144, 3894},{ 2583, 4338},{ 3005, 4778},
-        { 3399, 5202},{ 3775, 5609},{ 4132, 5991},{ 4473, 6310},
-        { 4808, 6577},{ 5115, 6852},{ 5412, 7147},{ 5707, 7428},
-        { 5984, 7683},{ 6264, 7933},{ 6523, 8153},{ 6739, 8345},
-        { 6953, 8556},{ 7178, 8740},{ 7398, 8913},{ 7628, 9201}
+        {  118,    8},{  351, 1383},{  699, 2383},{ 1091, 3049},
+        { 1477, 3560},{ 1854, 4053},{ 2252, 4519},{ 2682, 4914},
+        { 3119, 5240},{ 3565, 5503},{ 4006, 5732},{ 4435, 5880},
+        { 4864, 5975},{ 5272, 6089},{ 5668, 6243},{ 6079, 6385},
+        { 6477, 6467},{ 6870, 6530},{ 7233, 6574},{ 7539, 6603},
+        { 7880, 6609},{ 8222, 6614},{ 8567, 6612},{ 9002, 6600}
       },
       /*Y'  qi=28  INTER*/
       {
-        {  188,    9},{  179, 1341},{  319, 2665},{  554, 3815},
-        {  890, 4796},{ 1302, 5661},{ 1760, 6433},{ 2243, 7138},
-        { 2741, 7788},{ 3264, 8342},{ 3817, 8740},{ 4379, 8977},
-        { 4914, 9110},{ 5401, 9211},{ 5844, 9304},{ 6249, 9392},
-        { 6627, 9472},{ 6979, 9540},{ 7310, 9602},{ 7619, 9648},
-        { 7907, 9685},{ 8177, 9708},{ 8427, 9706},{ 8667, 9672}
+        {   58,  -14},{  104, 1336},{  173, 2753},{  246, 4080},
+        {  304, 5323},{  376, 6502},{  525, 7554},{  767, 8443},
+        { 1126, 9137},{ 1637, 9602},{ 2305, 9825},{ 3053, 9864},
+        { 3779, 9813},{ 4434, 9730},{ 5017, 9634},{ 5538, 9546},
+        { 6011, 9477},{ 6443, 9419},{ 6844, 9367},{ 7216, 9316},
+        { 7559, 9275},{ 7883, 9232},{ 8173, 9188},{ 8462, 9135}
       }
     },
     {
       /*Cb  qi=28  INTRA*/
       {
-        {   18,    2},{  136,  370},{  224,  752},{  260, 1190},
-        {  295, 1630},{  344, 2024},{  407, 2360},{  476, 2651},
-        {  547, 2911},{  626, 3132},{  705, 3328},{  786, 3516},
-        {  874, 3689},{  952, 3845},{ 1031, 3997},{ 1111, 4173},
-        { 1188, 4330},{ 1265, 4450},{ 1335, 4580},{ 1399, 4745},
-        { 1469, 4892},{ 1537, 5027},{ 1603, 5166},{ 1658, 5359}
+        {   59,  -47},{  267, 1554},{  557, 2797},{  866, 3675},
+        { 1181, 4346},{ 1530, 4864},{ 1936, 5187},{ 2323, 5375},
+        { 2721, 5566},{ 3156, 5757},{ 3530, 5939},{ 3816, 6122},
+        { 4280, 6400},{ 4787, 6577},{ 5022, 6690},{ 5346, 6878},
+        { 5746, 7017},{ 5861, 7055},{ 6051, 7157},{ 6339, 7299},
+        { 6506, 7103},{ 6822, 6765},{ 7096, 7012},{ 7422, 7224}
       },
       /*Cb  qi=28  INTER*/
       {
-        {  129,   58},{  138,  367},{  143,  683},{  152, 1051},
-        {  168, 1441},{  188, 1819},{  214, 2172},{  245, 2504},
-        {  280, 2820},{  321, 3120},{  366, 3405},{  418, 3677},
-        {  482, 3935},{  555, 4181},{  637, 4421},{  729, 4651},
-        {  832, 4868},{  942, 5082},{ 1060, 5284},{ 1181, 5467},
-        { 1298, 5651},{ 1412, 5835},{ 1527, 6003},{ 1644, 6157}
+        {   47,  -96},{   99, 1442},{  143, 2892},{  207, 4194},
+        {  338, 5346},{  573, 6348},{  817, 7292},{  885, 8336},
+        { 1017, 9226},{ 1411, 9811},{ 2055,10064},{ 2850, 9901},
+        { 3588, 9510},{ 4206, 9105},{ 4686, 8796},{ 5046, 8603},
+        { 5435, 8655},{ 5761, 8648},{ 6177, 8636},{ 6533, 8626},
+        { 7045, 8818},{ 7559, 8936},{ 7806, 8934},{ 8218, 9016}
       }
     },
     {
       /*Cr  qi=28  INTRA*/
       {
-        {   17,    5},{  134,  384},{  217,  778},{  259, 1232},
-        {  297, 1672},{  344, 2057},{  403, 2387},{  467, 2658},
-        {  537, 2892},{  611, 3104},{  696, 3305},{  784, 3482},
-        {  865, 3638},{  950, 3796},{ 1035, 3961},{ 1122, 4093},
-        { 1210, 4192},{ 1288, 4326},{ 1355, 4481},{ 1427, 4613},
-        { 1489, 4791},{ 1534, 4970},{ 1585, 5132},{ 1675, 5267}
+        {   54,  -44},{  280, 1561},{  559, 2782},{  867, 3627},
+        { 1207, 4242},{ 1574, 4719},{ 1977, 5110},{ 2376, 5421},
+        { 2817, 5637},{ 3212, 5789},{ 3550, 6026},{ 3819, 6204},
+        { 4017, 6200},{ 4395, 6207},{ 4915, 6309},{ 5247, 6265},
+        { 5941, 6439},{ 6142, 6593},{ 5605, 6565},{ 5802, 6728},
+        { 6157, 6934},{ 6652, 7117},{ 6960, 7204},{ 7274, 7375}
       },
       /*Cr  qi=28  INTER*/
       {
-        {  132,   52},{  135,  365},{  141,  687},{  151, 1061},
-        {  167, 1449},{  185, 1823},{  204, 2181},{  226, 2528},
-        {  254, 2856},{  292, 3162},{  341, 3446},{  403, 3710},
-        {  479, 3958},{  565, 4193},{  658, 4416},{  757, 4630},
-        {  855, 4844},{  949, 5058},{ 1039, 5267},{ 1128, 5479},
-        { 1216, 5696},{ 1314, 5893},{ 1422, 6075},{ 1529, 6250}
+        {   39,  -94},{  100, 1445},{  141, 2899},{  210, 4207},
+        {  350, 5334},{  570, 6307},{  797, 7251},{  910, 8271},
+        { 1287, 8863},{ 2001, 8886},{ 2724, 8650},{ 3340, 8397},
+        { 3859, 8305},{ 4272, 8274},{ 4622, 8330},{ 5076, 8316},
+        { 5435, 8411},{ 5822, 8521},{ 6061, 8530},{ 6349, 8645},
+        { 6761, 8727},{ 7068, 8800},{ 7395, 8875},{ 7740, 8947}
       }
     }
   },
@@ -1856,61 +1856,61 @@
     {
       /*Y'  qi=29  INTRA*/
       {
-        {  256,  -19},{  440, 1432},{  823, 2441},{ 1332, 2962},
-        { 1823, 3333},{ 2290, 3743},{ 2744, 4191},{ 3179, 4635},
-        { 3581, 5067},{ 3964, 5474},{ 4330, 5853},{ 4674, 6173},
-        { 5012, 6435},{ 5323, 6703},{ 5626, 6990},{ 5926, 7263},
-        { 6200, 7506},{ 6482, 7745},{ 6745, 7958},{ 6964, 8149},
-        { 7177, 8350},{ 7401, 8529},{ 7623, 8694},{ 7865, 8975}
+        {  109,   23},{  365, 1369},{  734, 2336},{ 1157, 2961},
+        { 1570, 3437},{ 1982, 3900},{ 2419, 4335},{ 2879, 4707},
+        { 3341, 5015},{ 3803, 5265},{ 4258, 5478},{ 4700, 5609},
+        { 5142, 5692},{ 5548, 5804},{ 5933, 5957},{ 6330, 6104},
+        { 6703, 6210},{ 7072, 6304},{ 7427, 6366},{ 7736, 6391},
+        { 8083, 6381},{ 8429, 6375},{ 8764, 6386},{ 9196, 6370}
       },
       /*Y'  qi=29  INTER*/
       {
-        {  193,   -3},{  195, 1340},{  350, 2649},{  615, 3772},
-        {  987, 4730},{ 1432, 5577},{ 1915, 6337},{ 2421, 7033},
-        { 2948, 7660},{ 3506, 8171},{ 4092, 8506},{ 4674, 8689},
-        { 5209, 8810},{ 5690, 8915},{ 6126, 9009},{ 6531, 9093},
-        { 6905, 9159},{ 7250, 9232},{ 7582, 9297},{ 7894, 9345},
-        { 8183, 9382},{ 8451, 9400},{ 8704, 9415},{ 8946, 9404}
+        {   60,   -5},{  110, 1334},{  183, 2739},{  259, 4052},
+        {  320, 5282},{  411, 6435},{  593, 7448},{  886, 8277},
+        { 1320, 8888},{ 1928, 9250},{ 2678, 9381},{ 3459, 9372},
+        { 4181, 9303},{ 4823, 9213},{ 5394, 9123},{ 5907, 9048},
+        { 6370, 8980},{ 6796, 8920},{ 7190, 8877},{ 7561, 8838},
+        { 7902, 8796},{ 8226, 8762},{ 8527, 8725},{ 8799, 8684}
       }
     },
     {
       /*Cb  qi=29  INTRA*/
       {
-        {   18,    2},{  142,  371},{  235,  752},{  276, 1186},
-        {  315, 1612},{  372, 1987},{  444, 2305},{  520, 2578},
-        {  597, 2824},{  682, 3035},{  769, 3224},{  856, 3410},
-        {  948, 3581},{ 1033, 3730},{ 1117, 3883},{ 1196, 4059},
-        { 1276, 4212},{ 1357, 4332},{ 1419, 4467},{ 1481, 4636},
-        { 1561, 4780},{ 1629, 4919},{ 1689, 5071},{ 1748, 5260}
+        {   75,  -50},{  285, 1538},{  595, 2746},{  928, 3602},
+        { 1268, 4255},{ 1635, 4765},{ 2049, 5059},{ 2510, 5149},
+        { 3010, 5213},{ 3434, 5306},{ 3746, 5482},{ 4052, 5673},
+        { 4502, 5894},{ 4969, 6051},{ 5292, 6157},{ 5766, 6314},
+        { 6076, 6397},{ 6045, 6374},{ 6253, 6419},{ 6643, 6628},
+        { 7122, 6675},{ 7446, 6525},{ 7645, 6624},{ 7939, 6606}
       },
       /*Cb  qi=29  INTER*/
       {
-        {  146,   39},{  153,  353},{  156,  673},{  164, 1049},
-        {  181, 1437},{  203, 1810},{  230, 2155},{  264, 2480},
-        {  303, 2792},{  348, 3087},{  401, 3365},{  464, 3630},
-        {  537, 3883},{  621, 4125},{  714, 4357},{  817, 4578},
-        {  932, 4789},{ 1056, 4990},{ 1185, 5182},{ 1310, 5363},
-        { 1437, 5531},{ 1559, 5709},{ 1671, 5883},{ 1783, 6059}
+        {   57,  -95},{  103, 1440},{  153, 2872},{  230, 4152},
+        {  389, 5271},{  665, 6234},{  804, 7295},{  875, 8314},
+        { 1177, 9012},{ 1671, 9508},{ 2414, 9624},{ 3236, 9405},
+        { 3974, 8999},{ 4570, 8604},{ 5040, 8461},{ 5401, 8433},
+        { 5828, 8403},{ 6195, 8339},{ 6480, 8428},{ 6958, 8348},
+        { 7409, 8417},{ 7891, 8411},{ 8434, 8427},{ 8926, 8444}
       }
     },
     {
       /*Cr  qi=29  INTRA*/
       {
-        {   19,    6},{  142,  385},{  228,  779},{  273, 1227},
-        {  317, 1650},{  373, 2011},{  440, 2322},{  512, 2584},
-        {  588, 2809},{  668, 3013},{  760, 3207},{  851, 3380},
-        {  936, 3533},{ 1030, 3687},{ 1118, 3853},{ 1203, 3986},
-        { 1292, 4081},{ 1369, 4215},{ 1438, 4373},{ 1510, 4510},
-        { 1569, 4695},{ 1619, 4871},{ 1675, 5031},{ 1775, 5166}
+        {   64,  -39},{  298, 1545},{  606, 2735},{  944, 3560},
+        { 1298, 4152},{ 1671, 4592},{ 2086, 4958},{ 2468, 5267},
+        { 2889, 5496},{ 3309, 5679},{ 3649, 5957},{ 3986, 6081},
+        { 4272, 6112},{ 4614, 6261},{ 5089, 6304},{ 5479, 6129},
+        { 6178, 6286},{ 6233, 6453},{ 6490, 6603},{ 6728, 6779},
+        { 7032, 7009},{ 7461, 7146},{ 8041, 7245},{ 8402, 7417}
       },
       /*Cr  qi=29  INTER*/
       {
-        {  143,    2},{  149,  356},{  155,  684},{  163, 1059},
-        {  179, 1445},{  198, 1812},{  218, 2166},{  243, 2507},
-        {  276, 2828},{  320, 3126},{  380, 3401},{  453, 3659},
-        {  541, 3897},{  639, 4123},{  742, 4341},{  848, 4552},
-        {  953, 4763},{ 1051, 4973},{ 1143, 5186},{ 1243, 5395},
-        { 1350, 5596},{ 1453, 5785},{ 1569, 5957},{ 1706, 6124}
+        {   48,  -94},{  105, 1442},{  150, 2880},{  234, 4162},
+        {  403, 5255},{  664, 6195},{  779, 7262},{  919, 8225},
+        { 1514, 8550},{ 2285, 8478},{ 3009, 8244},{ 3648, 8041},
+        { 4151, 7969},{ 4481, 7934},{ 4911, 7914},{ 5311, 7788},
+        { 5648, 7846},{ 6084, 7742},{ 6353, 7887},{ 6673, 7839},
+        { 6962, 7823},{ 7198, 7771},{ 7394, 7774},{ 7712, 7754}
       }
     }
   },
@@ -1918,61 +1918,61 @@
     {
       /*Y'  qi=30  INTRA*/
       {
-        {  253,  -16},{  448, 1426},{  855, 2407},{ 1388, 2904},
-        { 1899, 3262},{ 2386, 3661},{ 2864, 4094},{ 3323, 4518},
-        { 3747, 4929},{ 4147, 5313},{ 4530, 5669},{ 4889, 5966},
-        { 5235, 6209},{ 5556, 6456},{ 5869, 6717},{ 6178, 6971},
-        { 6464, 7204},{ 6756, 7428},{ 7023, 7622},{ 7247, 7789},
-        { 7472, 7974},{ 7704, 8141},{ 7930, 8299},{ 8183, 8558}
+        {  121,   15},{  360, 1373},{  725, 2345},{ 1149, 2967},
+        { 1568, 3438},{ 1989, 3888},{ 2438, 4314},{ 2911, 4678},
+        { 3385, 4977},{ 3854, 5220},{ 4311, 5422},{ 4758, 5545},
+        { 5198, 5630},{ 5604, 5734},{ 5995, 5882},{ 6403, 6029},
+        { 6787, 6129},{ 7151, 6256},{ 7503, 6348},{ 7823, 6363},
+        { 8181, 6322},{ 8557, 6259},{ 8919, 6229},{ 9344, 6203}
       },
       /*Y'  qi=30  INTER*/
       {
-        {  189,   -4},{  197, 1340},{  370, 2631},{  669, 3731},
-        { 1081, 4662},{ 1564, 5480},{ 2087, 6209},{ 2633, 6870},
-        { 3209, 7445},{ 3821, 7868},{ 4445, 8110},{ 5032, 8243},
-        { 5559, 8348},{ 6032, 8446},{ 6463, 8534},{ 6858, 8610},
-        { 7222, 8671},{ 7566, 8730},{ 7891, 8790},{ 8196, 8839},
-        { 8483, 8875},{ 8752, 8881},{ 9009, 8882},{ 9238, 8898}
+        {   59,   -4},{  112, 1334},{  189, 2732},{  272, 4034},
+        {  342, 5249},{  453, 6376},{  672, 7344},{ 1023, 8108},
+        { 1541, 8632},{ 2238, 8907},{ 3043, 8977},{ 3833, 8939},
+        { 4542, 8862},{ 5168, 8781},{ 5721, 8707},{ 6218, 8646},
+        { 6671, 8593},{ 7094, 8543},{ 7491, 8504},{ 7853, 8469},
+        { 8183, 8435},{ 8498, 8404},{ 8796, 8374},{ 9057, 8352}
       }
     },
     {
       /*Cb  qi=30  INTRA*/
       {
-        {   18,    2},{  143,  371},{  238,  752},{  279, 1183},
-        {  321, 1603},{  383, 1969},{  461, 2281},{  542, 2550},
-        {  623, 2788},{  712, 2992},{  803, 3174},{  899, 3353},
-        {  997, 3516},{ 1087, 3662},{ 1176, 3808},{ 1259, 3975},
-        { 1340, 4129},{ 1422, 4243},{ 1496, 4370},{ 1560, 4541},
-        { 1631, 4696},{ 1699, 4839},{ 1767, 4981},{ 1831, 5182}
+        {   78,  -45},{  296, 1529},{  618, 2721},{  964, 3568},
+        { 1317, 4207},{ 1692, 4704},{ 2093, 5035},{ 2478, 5269},
+        { 2897, 5460},{ 3332, 5600},{ 3712, 5809},{ 4030, 6019},
+        { 4442, 6241},{ 4898, 6392},{ 5228, 6488},{ 5594, 6605},
+        { 5991, 6648},{ 6210, 6636},{ 6461, 6697},{ 6817, 6834},
+        { 7081, 6778},{ 7397, 6596},{ 7599, 6717},{ 7867, 6838}
       },
       /*Cb  qi=30  INTER*/
       {
-        {  157,   37},{  158,  352},{  158,  673},{  166, 1049},
-        {  184, 1435},{  208, 1803},{  239, 2141},{  276, 2460},
-        {  322, 2766},{  373, 3057},{  434, 3330},{  507, 3587},
-        {  591, 3833},{  685, 4069},{  788, 4294},{  903, 4507},
-        { 1027, 4714},{ 1162, 4905},{ 1301, 5087},{ 1440, 5262},
-        { 1568, 5430},{ 1689, 5598},{ 1817, 5759},{ 1938, 5957}
+        {   55,  -93},{  104, 1439},{  158, 2860},{  244, 4126},
+        {  424, 5225},{  726, 6166},{  964, 7113},{ 1068, 8076},
+        { 1360, 8802},{ 1966, 9179},{ 2800, 9163},{ 3622, 8897},
+        { 4303, 8492},{ 4842, 8195},{ 5299, 8063},{ 5675, 8026},
+        { 6129, 8109},{ 6561, 8101},{ 6812, 7958},{ 7426, 7977},
+        { 7947, 8084},{ 8524, 8156},{ 8856, 8105},{ 9346, 8136}
       }
     },
     {
       /*Cr  qi=30  INTRA*/
       {
-        {   19,    6},{  144,  385},{  230,  778},{  276, 1224},
-        {  323, 1641},{  386, 1992},{  459, 2296},{  534, 2554},
-        {  614, 2772},{  699, 2971},{  798, 3160},{  893, 3329},
-        {  982, 3476},{ 1083, 3624},{ 1176, 3782},{ 1264, 3908},
-        { 1354, 4002},{ 1432, 4135},{ 1505, 4282},{ 1582, 4410},
-        { 1648, 4591},{ 1695, 4771},{ 1756, 4922},{ 1850, 5020}
+        {   75,  -32},{  310, 1535},{  627, 2704},{  972, 3519},
+        { 1340, 4097},{ 1718, 4535},{ 2127, 4914},{ 2522, 5214},
+        { 2959, 5431},{ 3383, 5599},{ 3742, 5844},{ 4070, 5984},
+        { 4330, 6012},{ 4656, 6149},{ 5094, 6211},{ 5506, 6078},
+        { 6176, 6265},{ 6272, 6378},{ 6421, 6491},{ 6613, 6635},
+        { 6849, 6838},{ 7314, 6996},{ 7866, 7076},{ 8192, 7227}
       },
       /*Cr  qi=30  INTER*/
       {
-        {  141,    5},{  148,  354},{  155,  684},{  164, 1058},
-        {  181, 1441},{  202, 1804},{  225, 2154},{  252, 2491},
-        {  292, 2806},{  345, 3096},{  414, 3363},{  499, 3612},
-        {  596, 3844},{  705, 4066},{  819, 4279},{  933, 4480},
-        { 1043, 4687},{ 1147, 4899},{ 1246, 5108},{ 1354, 5308},
-        { 1472, 5496},{ 1592, 5676},{ 1726, 5831},{ 1859, 5990}
+        {   46,  -91},{  105, 1441},{  155, 2868},{  249, 4135},
+        {  437, 5208},{  722, 6128},{  926, 7100},{ 1123, 7986},
+        { 1752, 8256},{ 2589, 8080},{ 3330, 7876},{ 3923, 7718},
+        { 4440, 7611},{ 4805, 7547},{ 5159, 7607},{ 5471, 7596},
+        { 5993, 7677},{ 6361, 7649},{ 6651, 7656},{ 7100, 7698},
+        { 7408, 7678},{ 7846, 7724},{ 8152, 7728},{ 8520, 7746}
       }
     }
   },
@@ -1980,61 +1980,61 @@
     {
       /*Y'  qi=31  INTRA*/
       {
-        {  253,  -12},{  454, 1419},{  882, 2378},{ 1435, 2861},
-        { 1951, 3215},{ 2444, 3610},{ 2928, 4039},{ 3394, 4459},
-        { 3825, 4870},{ 4228, 5259},{ 4612, 5613},{ 4975, 5905},
-        { 5324, 6143},{ 5645, 6389},{ 5958, 6646},{ 6273, 6890},
-        { 6558, 7114},{ 6847, 7335},{ 7115, 7527},{ 7339, 7690},
-        { 7563, 7874},{ 7792, 8041},{ 8013, 8196},{ 8270, 8449}
+        {  114,   36},{  393, 1349},{  787, 2285},{ 1241, 2871},
+        { 1689, 3310},{ 2143, 3732},{ 2627, 4129},{ 3127, 4471},
+        { 3624, 4751},{ 4119, 4973},{ 4605, 5157},{ 5080, 5265},
+        { 5546, 5330},{ 5971, 5422},{ 6387, 5546},{ 6825, 5650},
+        { 7225, 5720},{ 7598, 5801},{ 7956, 5849},{ 8284, 5849},
+        { 8643, 5832},{ 8995, 5822},{ 9351, 5809},{ 9792, 5782}
       },
       /*Y'  qi=31  INTER*/
       {
-        {  189,   -3},{  199, 1339},{  393, 2612},{  727, 3689},
-        { 1177, 4597},{ 1690, 5399},{ 2238, 6117},{ 2810, 6766},
-        { 3413, 7317},{ 4050, 7703},{ 4686, 7916},{ 5273, 8037},
-        { 5792, 8136},{ 6260, 8234},{ 6684, 8325},{ 7074, 8394},
-        { 7435, 8456},{ 7775, 8517},{ 8103, 8572},{ 8410, 8617},
-        { 8694, 8644},{ 8960, 8658},{ 9224, 8670},{ 9489, 8694}
+        {   63,   -1},{  117, 1334},{  195, 2723},{  273, 4021},
+        {  347, 5225},{  477, 6329},{  725, 7268},{ 1116, 7992},
+        { 1691, 8460},{ 2453, 8671},{ 3296, 8699},{ 4096, 8635},
+        { 4805, 8541},{ 5430, 8451},{ 5982, 8374},{ 6478, 8314},
+        { 6930, 8255},{ 7351, 8206},{ 7747, 8174},{ 8110, 8139},
+        { 8447, 8099},{ 8763, 8066},{ 9062, 8027},{ 9344, 7996}
       }
     },
     {
       /*Cb  qi=31  INTRA*/
       {
-        {   19,    2},{  145,  371},{  240,  752},{  281, 1181},
-        {  326, 1595},{  392, 1954},{  472, 2257},{  556, 2517},
-        {  640, 2750},{  730, 2951},{  825, 3131},{  922, 3310},
-        { 1018, 3477},{ 1110, 3621},{ 1203, 3765},{ 1282, 3938},
-        { 1361, 4096},{ 1443, 4214},{ 1516, 4340},{ 1579, 4508},
-        { 1649, 4662},{ 1716, 4805},{ 1790, 4941},{ 1871, 5133}
+        {   75,  -43},{  304, 1519},{  641, 2680},{ 1006, 3486},
+        { 1383, 4091},{ 1786, 4567},{ 2218, 4880},{ 2652, 5076},
+        { 3112, 5228},{ 3565, 5319},{ 3928, 5476},{ 4237, 5646},
+        { 4711, 5836},{ 5183, 5980},{ 5489, 6078},{ 5955, 6197},
+        { 6312, 6246},{ 6360, 6258},{ 6635, 6271},{ 7036, 6396},
+        { 7359, 6396},{ 7704, 6282},{ 7807, 6415},{ 7952, 6550}
       },
       /*Cb  qi=31  INTER*/
       {
-        {  148,   37},{  152,  352},{  157,  674},{  167, 1048},
-        {  186, 1432},{  212, 1795},{  248, 2128},{  291, 2442},
-        {  341, 2742},{  404, 3025},{  474, 3292},{  555, 3546},
-        {  651, 3784},{  757, 4013},{  867, 4235},{  993, 4441},
-        { 1130, 4636},{ 1274, 4823},{ 1422, 4995},{ 1566, 5160},
-        { 1703, 5323},{ 1829, 5493},{ 1954, 5663},{ 2101, 5780}
+        {   63,  -92},{  108, 1435},{  167, 2842},{  268, 4089},
+        {  481, 5161},{  766, 6130},{  892, 7169},{ 1082, 8033},
+        { 1506, 8633},{ 2195, 8929},{ 3069, 8840},{ 3874, 8529},
+        { 4521, 8164},{ 5023, 7914},{ 5413, 7873},{ 5873, 7789},
+        { 6307, 7714},{ 6571, 7815},{ 7025, 7789},{ 7499, 7623},
+        { 8077, 7689},{ 8535, 7741},{ 8779, 7707},{ 9168, 7709}
       }
     },
     {
       /*Cr  qi=31  INTRA*/
       {
-        {   19,    6},{  145,  386},{  232,  778},{  278, 1221},
-        {  328, 1631},{  396, 1972},{  472, 2268},{  547, 2521},
-        {  628, 2738},{  715, 2936},{  817, 3120},{  913, 3291},
-        { 1005, 3442},{ 1105, 3591},{ 1198, 3747},{ 1286, 3870},
-        { 1378, 3961},{ 1461, 4092},{ 1532, 4244},{ 1605, 4377},
-        { 1668, 4560},{ 1717, 4737},{ 1780, 4885},{ 1882, 4986}
+        {   71,  -31},{  319, 1524},{  658, 2673},{ 1029, 3445},
+        { 1416, 3988},{ 1817, 4399},{ 2251, 4771},{ 2666, 5070},
+        { 3119, 5281},{ 3567, 5453},{ 3933, 5697},{ 4282, 5833},
+        { 4541, 5900},{ 4913, 6008},{ 5373, 5981},{ 5738, 5805},
+        { 6432, 6023},{ 6504, 6188},{ 6617, 6328},{ 6797, 6479},
+        { 7072, 6631},{ 7537, 6768},{ 8112, 6813},{ 8441, 6960}
       },
       /*Cr  qi=31  INTER*/
       {
-        {  138,    6},{  148,  354},{  155,  684},{  165, 1057},
-        {  184, 1437},{  207, 1796},{  233, 2141},{  266, 2472},
-        {  312, 2780},{  372, 3065},{  451, 3327},{  549, 3567},
-        {  660, 3794},{  779, 4006},{  906, 4208},{ 1025, 4411},
-        { 1139, 4617},{ 1250, 4823},{ 1360, 5024},{ 1475, 5221},
-        { 1601, 5400},{ 1739, 5557},{ 1880, 5707},{ 2019, 5854}
+        {   51,  -88},{  110, 1437},{  163, 2850},{  274, 4097},
+        {  493, 5143},{  761, 6089},{  866, 7140},{ 1174, 7895},
+        { 1915, 8036},{ 2754, 7842},{ 3482, 7589},{ 4091, 7418},
+        { 4586, 7311},{ 4907, 7279},{ 5271, 7447},{ 5602, 7603},
+        { 6001, 7684},{ 6339, 7676},{ 6631, 7668},{ 6936, 7765},
+        { 7467, 7669},{ 7957, 7704},{ 8190, 7805},{ 8561, 7851}
       }
     }
   },
@@ -2042,61 +2042,61 @@
     {
       /*Y'  qi=32  INTRA*/
       {
-        {  250,  -10},{  458, 1417},{  901, 2366},{ 1469, 2839},
-        { 2000, 3182},{ 2507, 3559},{ 3007, 3966},{ 3487, 4369},
-        { 3932, 4765},{ 4348, 5136},{ 4742, 5472},{ 5113, 5743},
-        { 5471, 5971},{ 5798, 6206},{ 6118, 6451},{ 6437, 6686},
-        { 6729, 6903},{ 7024, 7119},{ 7295, 7300},{ 7521, 7455},
-        { 7744, 7627},{ 7976, 7778},{ 8202, 7925},{ 8472, 8175}
+        {  114,   44},{  404, 1342},{  814, 2254},{ 1293, 2812},
+        { 1767, 3225},{ 2239, 3633},{ 2739, 4022},{ 3264, 4348},
+        { 3786, 4612},{ 4304, 4816},{ 4815, 4980},{ 5306, 5077},
+        { 5782, 5131},{ 6225, 5211},{ 6668, 5312},{ 7127, 5396},
+        { 7551, 5454},{ 7956, 5504},{ 8332, 5531},{ 8659, 5541},
+        { 8996, 5542},{ 9343, 5543},{ 9695, 5551},{10125, 5556}
       },
       /*Y'  qi=32  INTER*/
       {
-        {  192,   11},{  200, 1338},{  399, 2605},{  747, 3673},
-        { 1215, 4570},{ 1751, 5350},{ 2329, 6039},{ 2936, 6653},
-        { 3576, 7153},{ 4241, 7479},{ 4887, 7649},{ 5471, 7752},
-        { 5987, 7842},{ 6451, 7932},{ 6874, 8009},{ 7261, 8068},
-        { 7624, 8122},{ 7965, 8176},{ 8292, 8225},{ 8597, 8261},
-        { 8882, 8291},{ 9155, 8301},{ 9410, 8303},{ 9639, 8288}
+        {   67,   -6},{  118, 1332},{  201, 2710},{  289, 3988},
+        {  377, 5174},{  535, 6248},{  839, 7127},{ 1324, 7759},
+        { 2026, 8110},{ 2894, 8217},{ 3775, 8184},{ 4566, 8102},
+        { 5253, 8015},{ 5855, 7940},{ 6392, 7874},{ 6882, 7818},
+        { 7335, 7767},{ 7757, 7728},{ 8153, 7697},{ 8511, 7666},
+        { 8847, 7638},{ 9182, 7610},{ 9490, 7589},{ 9743, 7571}
       }
     },
     {
       /*Cb  qi=32  INTRA*/
       {
-        {   19,    2},{  145,  371},{  239,  752},{  283, 1180},
-        {  329, 1593},{  398, 1950},{  483, 2252},{  569, 2511},
-        {  656, 2741},{  754, 2936},{  853, 3107},{  952, 3283},
-        { 1055, 3443},{ 1155, 3579},{ 1250, 3715},{ 1331, 3881},
-        { 1414, 4035},{ 1498, 4155},{ 1569, 4289},{ 1634, 4460},
-        { 1705, 4613},{ 1776, 4746},{ 1850, 4878},{ 1921, 5076}
+        {   71,  -34},{  315, 1501},{  669, 2638},{ 1057, 3423},
+        { 1454, 4002},{ 1876, 4457},{ 2334, 4719},{ 2840, 4799},
+        { 3386, 4865},{ 3841, 4950},{ 4189, 5112},{ 4535, 5321},
+        { 5030, 5501},{ 5488, 5623},{ 5781, 5721},{ 6333, 5768},
+        { 6660, 5847},{ 6524, 5869},{ 6732, 5889},{ 7259, 6089},
+        { 7709, 6154},{ 7919, 6025},{ 8163, 6171},{ 8369, 6293}
       },
       /*Cb  qi=32  INTER*/
       {
-        {  137,   30},{  147,  350},{  157,  674},{  168, 1048},
-        {  186, 1431},{  214, 1792},{  250, 2124},{  295, 2436},
-        {  350, 2733},{  413, 3013},{  487, 3279},{  575, 3529},
-        {  675, 3766},{  784, 3994},{  900, 4210},{ 1030, 4410},
-        { 1174, 4601},{ 1323, 4780},{ 1475, 4947},{ 1621, 5109},
-        { 1760, 5266},{ 1888, 5434},{ 2019, 5608},{ 2176, 5736}
+        {   64, -104},{  110, 1430},{  174, 2825},{  288, 4056},
+        {  531, 5097},{  828, 6054},{  975, 7050},{ 1253, 7829},
+        { 1822, 8305},{ 2655, 8430},{ 3552, 8272},{ 4294, 7995},
+        { 4883, 7708},{ 5425, 7540},{ 5864, 7395},{ 6254, 7392},
+        { 6760, 7522},{ 7260, 7455},{ 7584, 7485},{ 8015, 7405},
+        { 8494, 7426},{ 9075, 7517},{ 9408, 7470},{ 9848, 7490}
       }
     },
     {
       /*Cr  qi=32  INTRA*/
       {
-        {   19,    6},{  145,  386},{  232,  778},{  281, 1219},
-        {  333, 1627},{  402, 1968},{  482, 2263},{  562, 2514},
-        {  648, 2726},{  738, 2917},{  842, 3100},{  945, 3261},
-        { 1040, 3401},{ 1145, 3544},{ 1242, 3699},{ 1335, 3819},
-        { 1433, 3906},{ 1514, 4037},{ 1586, 4183},{ 1663, 4310},
-        { 1731, 4495},{ 1785, 4671},{ 1849, 4812},{ 1948, 4904}
+        {   67,  -22},{  330, 1505},{  677, 2630},{ 1068, 3373},
+        { 1489, 3866},{ 1915, 4250},{ 2394, 4587},{ 2912, 4797},
+        { 3454, 5003},{ 3853, 5162},{ 4173, 5287},{ 4515, 5404},
+        { 4782, 5463},{ 5194, 5559},{ 5568, 5576},{ 5919, 5395},
+        { 6538, 5557},{ 6654, 5768},{ 6664, 5640},{ 6923, 5653},
+        { 7357, 5782},{ 7907, 5967},{ 8276, 6020},{ 8697, 6117}
       },
       /*Cr  qi=32  INTER*/
       {
-        {  134,    6},{  146,  354},{  156,  683},{  165, 1057},
-        {  184, 1437},{  208, 1794},{  235, 2136},{  270, 2466},
-        {  318, 2773},{  383, 3054},{  466, 3313},{  569, 3551},
-        {  687, 3770},{  812, 3979},{  937, 4180},{ 1058, 4381},
-        { 1172, 4585},{ 1288, 4787},{ 1408, 4985},{ 1528, 5173},
-        { 1655, 5351},{ 1796, 5507},{ 1948, 5638},{ 2094, 5762}
+        {   53,  -90},{  112, 1432},{  170, 2835},{  296, 4061},
+        {  545, 5078},{  817, 6019},{  958, 7022},{ 1391, 7643},
+        { 2242, 7652},{ 3131, 7419},{ 3843, 7213},{ 4410, 7132},
+        { 4883, 7160},{ 5283, 7149},{ 5658, 7127},{ 5990, 7191},
+        { 6506, 7218},{ 6940, 7120},{ 7270, 7175},{ 7529, 7178},
+        { 7960, 7220},{ 8420, 7224},{ 8832, 7173},{ 9226, 7174}
       }
     }
   },
@@ -2104,61 +2104,61 @@
     {
       /*Y'  qi=33  INTRA*/
       {
-        {  251,   -3},{  482, 1400},{  956, 2310},{ 1547, 2757},
-        { 2093, 3091},{ 2618, 3466},{ 3134, 3876},{ 3627, 4282},
-        { 4082, 4675},{ 4507, 5046},{ 4908, 5383},{ 5283, 5659},
-        { 5640, 5883},{ 5971, 6103},{ 6296, 6342},{ 6615, 6576},
-        { 6909, 6783},{ 7206, 6990},{ 7476, 7167},{ 7700, 7318},
-        { 7924, 7482},{ 8156, 7632},{ 8390, 7783},{ 8661, 8018}
+        {  123,   35},{  408, 1343},{  793, 2310},{ 1247, 2934},
+        { 1716, 3401},{ 2195, 3850},{ 2698, 4267},{ 3221, 4600},
+        { 3740, 4852},{ 4262, 5031},{ 4778, 5166},{ 5261, 5229},
+        { 5735, 5251},{ 6172, 5318},{ 6605, 5423},{ 7065, 5509},
+        { 7505, 5558},{ 7930, 5615},{ 8314, 5653},{ 8642, 5668},
+        { 8991, 5669},{ 9359, 5673},{ 9732, 5687},{10207, 5680}
       },
       /*Y'  qi=33  INTER*/
       {
-        {  203,   42},{  212, 1342},{  438, 2585},{  826, 3628},
-        { 1333, 4507},{ 1902, 5276},{ 2508, 5959},{ 3143, 6559},
-        { 3816, 7021},{ 4504, 7301},{ 5154, 7443},{ 5731, 7545},
-        { 6241, 7640},{ 6699, 7726},{ 7118, 7804},{ 7509, 7867},
-        { 7867, 7922},{ 8206, 7981},{ 8536, 8031},{ 8842, 8055},
-        { 9122, 8072},{ 9399, 8088},{ 9654, 8089},{ 9879, 8087}
+        {   74,  -36},{  110, 1332},{  183, 2729},{  273, 4006},
+        {  388, 5157},{  588, 6184},{  947, 7009},{ 1514, 7564},
+        { 2302, 7839},{ 3216, 7899},{ 4096, 7848},{ 4866, 7766},
+        { 5537, 7690},{ 6129, 7624},{ 6658, 7564},{ 7140, 7519},
+        { 7579, 7481},{ 7998, 7450},{ 8387, 7426},{ 8742, 7405},
+        { 9086, 7381},{ 9406, 7352},{ 9706, 7333},{ 9994, 7319}
       }
     },
     {
       /*Cb  qi=33  INTRA*/
       {
-        {   22,    2},{  159,  372},{  260,  753},{  305, 1177},
-        {  357, 1577},{  434, 1917},{  523, 2204},{  614, 2451},
-        {  707, 2670},{  810, 2859},{  914, 3028},{ 1015, 3204},
-        { 1120, 3367},{ 1223, 3507},{ 1321, 3644},{ 1400, 3812},
-        { 1481, 3965},{ 1562, 4088},{ 1635, 4224},{ 1701, 4393},
-        { 1770, 4550},{ 1847, 4681},{ 1927, 4812},{ 2007, 5028}
+        {   67,  -33},{  301, 1496},{  632, 2671},{ 1000, 3477},
+        { 1387, 4068},{ 1801, 4523},{ 2255, 4791},{ 2714, 4931},
+        { 3207, 5059},{ 3673, 5158},{ 4003, 5326},{ 4331, 5538},
+        { 4870, 5716},{ 5328, 5818},{ 5573, 5901},{ 6105, 5975},
+        { 6463, 6078},{ 6317, 6085},{ 6414, 6087},{ 6748, 6279},
+        { 7070, 6141},{ 7178, 5907},{ 7533, 5959},{ 7802, 5849}
       },
       /*Cb  qi=33  INTER*/
       {
-        {  148,   39},{  157,  355},{  165,  678},{  177, 1050},
-        {  197, 1428},{  228, 1781},{  269, 2105},{  322, 2411},
-        {  384, 2703},{  456, 2977},{  543, 3235},{  642, 3479},
-        {  753, 3710},{  872, 3932},{ 1000, 4144},{ 1144, 4339},
-        { 1300, 4520},{ 1458, 4692},{ 1618, 4855},{ 1771, 5013},
-        { 1908, 5175},{ 2050, 5337},{ 2195, 5501},{ 2336, 5652}
+        {   46, -127},{   95, 1435},{  142, 2874},{  213, 4160},
+        {  352, 5290},{  603, 6260},{  973, 7030},{ 1429, 7640},
+        { 2105, 8018},{ 3023, 8049},{ 3899, 7828},{ 4609, 7592},
+        { 5154, 7404},{ 5647, 7197},{ 6087, 7104},{ 6526, 7074},
+        { 7063, 7065},{ 7406, 7155},{ 7800, 7193},{ 8327, 7097},
+        { 8828, 7129},{ 9395, 7132},{ 9716, 7068},{10188, 7052}
       }
     },
     {
       /*Cr  qi=33  INTRA*/
       {
-        {   23,    6},{  159,  388},{  251,  781},{  303, 1215},
-        {  363, 1607},{  440, 1930},{  525, 2208},{  609, 2447},
-        {  698, 2656},{  793, 2847},{  898, 3028},{ 1004, 3191},
-        { 1105, 3334},{ 1214, 3475},{ 1312, 3627},{ 1404, 3748},
-        { 1499, 3841},{ 1581, 3971},{ 1654, 4119},{ 1728, 4253},
-        { 1796, 4435},{ 1853, 4608},{ 1925, 4746},{ 2021, 4852}
+        {   58,  -25},{  312, 1499},{  648, 2645},{ 1009, 3444},
+        { 1396, 4004},{ 1806, 4416},{ 2255, 4761},{ 2708, 5015},
+        { 3203, 5201},{ 3634, 5343},{ 4000, 5560},{ 4320, 5693},
+        { 4463, 5748},{ 4900, 5747},{ 5434, 5738},{ 5877, 5602},
+        { 6797, 5861},{ 6838, 5917},{ 6980, 6171},{ 7118, 6501},
+        { 7359, 6832},{ 7505, 7107},{ 7792, 7391},{ 8015, 7677}
       },
       /*Cr  qi=33  INTER*/
       {
-        {  151,    6},{  152,  359},{  162,  686},{  173, 1058},
-        {  194, 1432},{  221, 1782},{  253, 2118},{  293, 2442},
-        {  351, 2741},{  428, 3014},{  524, 3266},{  641, 3495},
-        {  771, 3708},{  903, 3914},{ 1036, 4112},{ 1168, 4312},
-        { 1291, 4513},{ 1416, 4709},{ 1541, 4904},{ 1670, 5090},
-        { 1808, 5263},{ 1962, 5409},{ 2136, 5516},{ 2329, 5593}
+        {   44, -110},{   98, 1439},{  141, 2880},{  217, 4167},
+        {  372, 5270},{  604, 6215},{  958, 6993},{ 1614, 7388},
+        { 2522, 7316},{ 3365, 7073},{ 4057, 6929},{ 4636, 6826},
+        { 5104, 6737},{ 5418, 6741},{ 5767, 6718},{ 6094, 6721},
+        { 6492, 6764},{ 6842, 6673},{ 7300, 6646},{ 7593, 6716},
+        { 8080, 6758},{ 8403, 6807},{ 8597, 6815},{ 8953, 6826}
       }
     }
   },
@@ -2166,61 +2166,61 @@
     {
       /*Y'  qi=34  INTRA*/
       {
-        {  249,    0},{  488, 1396},{  986, 2289},{ 1601, 2724},
-        { 2165, 3049},{ 2706, 3409},{ 3240, 3798},{ 3748, 4183},
-        { 4214, 4561},{ 4650, 4916},{ 5062, 5232},{ 5446, 5484},
-        { 5810, 5686},{ 6143, 5888},{ 6467, 6114},{ 6786, 6340},
-        { 7076, 6539},{ 7371, 6728},{ 7644, 6893},{ 7861, 7037},
-        { 8071, 7188},{ 8302, 7324},{ 8542, 7465},{ 8808, 7698}
+        {  117,   57},{  438, 1318},{  891, 2178},{ 1427, 2666},
+        { 1956, 3014},{ 2494, 3352},{ 3054, 3683},{ 3619, 3967},
+        { 4167, 4198},{ 4701, 4379},{ 5218, 4532},{ 5697, 4641},
+        { 6162, 4713},{ 6612, 4795},{ 7078, 4885},{ 7566, 4945},
+        { 8015, 4978},{ 8439, 5006},{ 8829, 5019},{ 9166, 5012},
+        { 9522, 4990},{ 9883, 4970},{10258, 4954},{10737, 4929}
       },
       /*Y'  qi=34  INTER*/
       {
-        {  205,    9},{  214, 1338},{  464, 2567},{  895, 3586},
-        { 1446, 4434},{ 2058, 5171},{ 2711, 5819},{ 3401, 6368},
-        { 4128, 6753},{ 4846, 6963},{ 5495, 7075},{ 6064, 7158},
-        { 6568, 7237},{ 7021, 7308},{ 7433, 7365},{ 7816, 7412},
-        { 8173, 7454},{ 8507, 7484},{ 8827, 7504},{ 9135, 7516},
-        { 9410, 7514},{ 9670, 7500},{ 9914, 7484},{10130, 7453}
+        {   80,   -8},{  131, 1333},{  236, 2671},{  338, 3919},
+        {  438, 5086},{  647, 6111},{ 1049, 6896},{ 1686, 7393},
+        { 2546, 7608},{ 3499, 7625},{ 4387, 7550},{ 5152, 7458},
+        { 5820, 7380},{ 6407, 7318},{ 6931, 7263},{ 7417, 7212},
+        { 7863, 7167},{ 8273, 7138},{ 8662, 7110},{ 9027, 7085},
+        { 9358, 7063},{ 9675, 7033},{ 9961, 7005},{10170, 6971}
       }
     },
     {
       /*Cb  qi=34  INTRA*/
       {
-        {   17,    2},{  157,  371},{  261,  752},{  306, 1174},
-        {  363, 1568},{  445, 1901},{  540, 2186},{  636, 2432},
-        {  734, 2649},{  843, 2833},{  951, 2994},{ 1059, 3162},
-        { 1169, 3320},{ 1272, 3456},{ 1372, 3588},{ 1457, 3751},
-        { 1542, 3902},{ 1628, 4026},{ 1701, 4161},{ 1770, 4323},
-        { 1847, 4473},{ 1915, 4604},{ 1989, 4743},{ 2079, 4962}
+        {   67,  -17},{  360, 1478},{  774, 2540},{ 1230, 3246},
+        { 1689, 3752},{ 2158, 4145},{ 2640, 4435},{ 3115, 4644},
+        { 3609, 4782},{ 4072, 4843},{ 4445, 4963},{ 4822, 5111},
+        { 5366, 5256},{ 5833, 5393},{ 6145, 5464},{ 6672, 5524},
+        { 7128, 5622},{ 7200, 5637},{ 7504, 5648},{ 7921, 5760},
+        { 8133, 5726},{ 8230, 5588},{ 8644, 5685},{ 8969, 5780}
       },
       /*Cb  qi=34  INTER*/
       {
-        {  141,   42},{  155,  356},{  165,  677},{  178, 1049},
-        {  200, 1426},{  235, 1775},{  281, 2093},{  340, 2393},
-        {  412, 2679},{  496, 2947},{  593, 3200},{  704, 3436},
-        {  826, 3660},{  955, 3873},{ 1092, 4075},{ 1247, 4259},
-        { 1417, 4424},{ 1586, 4583},{ 1748, 4738},{ 1907, 4891},
-        { 2063, 5037},{ 2212, 5187},{ 2356, 5362},{ 2511, 5551}
+        {   77,  -91},{  123, 1424},{  212, 2770},{  391, 3930},
+        {  759, 4875},{ 1027, 5855},{ 1156, 6827},{ 1616, 7428},
+        { 2374, 7727},{ 3298, 7726},{ 4149, 7494},{ 4849, 7217},
+        { 5381, 6990},{ 5842, 6827},{ 6264, 6822},{ 6704, 6800},
+        { 7162, 6754},{ 7484, 6776},{ 7834, 6831},{ 8216, 6827},
+        { 8637, 6819},{ 8952, 6807},{ 9381, 6744},{ 9770, 6712}
       }
     },
     {
       /*Cr  qi=34  INTRA*/
       {
-        {   18,    5},{  157,  387},{  252,  780},{  304, 1210},
-        {  369, 1595},{  452, 1913},{  542, 2192},{  630, 2430},
-        {  725, 2633},{  826, 2820},{  937, 2997},{ 1047, 3156},
-        { 1153, 3287},{ 1267, 3420},{ 1367, 3569},{ 1462, 3690},
-        { 1559, 3782},{ 1643, 3911},{ 1718, 4052},{ 1793, 4182},
-        { 1864, 4364},{ 1923, 4528},{ 1992, 4664},{ 2092, 4771}
+        {   66,    1},{  374, 1481},{  777, 2535},{ 1235, 3206},
+        { 1711, 3640},{ 2179, 3980},{ 2692, 4267},{ 3176, 4483},
+        { 3655, 4663},{ 4136, 4827},{ 4596, 5005},{ 4985, 5128},
+        { 5229, 5223},{ 5594, 5293},{ 6019, 5336},{ 6331, 5340},
+        { 6989, 5516},{ 7091, 5601},{ 7228, 5641},{ 7034, 5525},
+        { 7371, 5634},{ 8019, 5807},{ 8649, 5902},{ 8947, 5956}
       },
       /*Cr  qi=34  INTER*/
       {
-        {  139,    9},{  153,  358},{  164,  687},{  175, 1058},
-        {  198, 1430},{  227, 1776},{  262, 2108},{  309, 2426},
-        {  375, 2719},{  463, 2986},{  573, 3228},{  702, 3450},
-        {  840, 3656},{  982, 3853},{ 1129, 4042},{ 1268, 4235},
-        { 1396, 4431},{ 1533, 4617},{ 1670, 4804},{ 1815, 4972},
-        { 1980, 5111},{ 2151, 5235},{ 2335, 5328},{ 2519, 5413}
+        {   66,  -76},{  125, 1424},{  208, 2781},{  406, 3927},
+        {  763, 4857},{  996, 5836},{ 1154, 6782},{ 1799, 7156},
+        { 2733, 7029},{ 3557, 6792},{ 4209, 6654},{ 4754, 6550},
+        { 5222, 6427},{ 5509, 6459},{ 5841, 6539},{ 6108, 6587},
+        { 6288, 6569},{ 6509, 6451},{ 6915, 6435},{ 7548, 6493},
+        { 7949, 6513},{ 8301, 6449},{ 8577, 6458},{ 8933, 6450}
       }
     }
   },
@@ -2228,61 +2228,61 @@
     {
       /*Y'  qi=35  INTRA*/
       {
-        {  242,    4},{  497, 1386},{ 1017, 2259},{ 1653, 2679},
-        { 2235, 2992},{ 2795, 3342},{ 3347, 3720},{ 3871, 4093},
-        { 4355, 4460},{ 4805, 4799},{ 5229, 5094},{ 5625, 5323},
-        { 5997, 5512},{ 6337, 5712},{ 6671, 5931},{ 7003, 6144},
-        { 7305, 6337},{ 7614, 6525},{ 7898, 6682},{ 8129, 6817},
-        { 8360, 6965},{ 8601, 7095},{ 8851, 7222},{ 9128, 7438}
+        {  121,   56},{  459, 1308},{  917, 2178},{ 1470, 2669},
+        { 2028, 3012},{ 2598, 3349},{ 3189, 3681},{ 3784, 3958},
+        { 4356, 4174},{ 4903, 4346},{ 5436, 4486},{ 5944, 4561},
+        { 6441, 4598},{ 6898, 4668},{ 7335, 4772},{ 7788, 4862},
+        { 8213, 4930},{ 8634, 4980},{ 9032, 4988},{ 9379, 4967},
+        { 9741, 4949},{10089, 4955},{10444, 4966},{10894, 4967}
       },
       /*Y'  qi=35  INTER*/
       {
-        {  204,    2},{  217, 1336},{  495, 2550},{  967, 3544},
-        { 1558, 4367},{ 2207, 5083},{ 2895, 5709},{ 3626, 6213},
-        { 4389, 6534},{ 5118, 6697},{ 5766, 6798},{ 6332, 6884},
-        { 6838, 6965},{ 7296, 7043},{ 7719, 7102},{ 8111, 7154},
-        { 8476, 7201},{ 8826, 7248},{ 9160, 7286},{ 9476, 7308},
-        { 9774, 7329},{10054, 7343},{10316, 7339},{10575, 7351}
+        {   79,  -13},{  129, 1332},{  231, 2669},{  333, 3911},
+        {  472, 5038},{  765, 5985},{ 1283, 6671},{ 2065, 7048},
+        { 3041, 7163},{ 4026, 7129},{ 4891, 7044},{ 5631, 6963},
+        { 6280, 6901},{ 6859, 6850},{ 7378, 6802},{ 7853, 6766},
+        { 8300, 6733},{ 8721, 6703},{ 9119, 6690},{ 9482, 6670},
+        { 9822, 6649},{10153, 6627},{10464, 6608},{10758, 6581}
       }
     },
     {
       /*Cb  qi=35  INTRA*/
       {
-        {   23,    2},{  162,  372},{  263,  752},{  312, 1170},
-        {  373, 1557},{  462, 1883},{  563, 2158},{  667, 2396},
-        {  772, 2607},{  887, 2785},{  999, 2947},{ 1112, 3113},
-        { 1226, 3266},{ 1332, 3402},{ 1433, 3537},{ 1519, 3696},
-        { 1609, 3845},{ 1695, 3968},{ 1772, 4099},{ 1845, 4256},
-        { 1925, 4408},{ 1994, 4545},{ 2065, 4677},{ 2146, 4904}
+        {   58,  -14},{  368, 1456},{  793, 2510},{ 1264, 3211},
+        { 1737, 3721},{ 2216, 4115},{ 2717, 4378},{ 3185, 4559},
+        { 3691, 4697},{ 4234, 4782},{ 4657, 4918},{ 5015, 5051},
+        { 5594, 5190},{ 6123, 5327},{ 6427, 5383},{ 6928, 5438},
+        { 7357, 5561},{ 7440, 5544},{ 7789, 5532},{ 8167, 5653},
+        { 8293, 5555},{ 8282, 5329},{ 8654, 5475},{ 8964, 5613}
       },
       /*Cb  qi=35  INTER*/
       {
-        {  147,   34},{  157,  354},{  167,  678},{  179, 1048},
-        {  203, 1422},{  241, 1768},{  293, 2083},{  359, 2379},
-        {  440, 2659},{  535, 2921},{  645, 3167},{  768, 3399},
-        {  897, 3619},{ 1034, 3829},{ 1182, 4024},{ 1345, 4202},
-        { 1525, 4365},{ 1704, 4518},{ 1872, 4673},{ 2038, 4824},
-        { 2201, 4966},{ 2358, 5126},{ 2508, 5302},{ 2648, 5479}
+        {   66,  -92},{  119, 1422},{  216, 2760},{  405, 3916},
+        {  770, 4872},{ 1028, 5838},{ 1305, 6671},{ 1974, 7118},
+        { 2898, 7265},{ 3868, 7169},{ 4665, 6960},{ 5323, 6697},
+        { 5860, 6524},{ 6357, 6415},{ 6781, 6345},{ 7161, 6431},
+        { 7686, 6398},{ 8297, 6427},{ 8526, 6510},{ 8924, 6457},
+        { 9200, 6387},{ 9768, 6406},{10358, 6425},{10841, 6422}
       }
     },
     {
       /*Cr  qi=35  INTRA*/
       {
-        {   25,    6},{  162,  389},{  255,  780},{  312, 1206},
-        {  382, 1583},{  470, 1894},{  565, 2166},{  657, 2399},
-        {  757, 2599},{  863, 2783},{  979, 2956},{ 1096, 3110},
-        { 1209, 3239},{ 1323, 3370},{ 1424, 3518},{ 1522, 3640},
-        { 1620, 3738},{ 1710, 3860},{ 1792, 3985},{ 1867, 4109},
-        { 1938, 4287},{ 2003, 4451},{ 2074, 4585},{ 2192, 4655}
+        {   60,    4},{  383, 1462},{  806, 2505},{ 1281, 3171},
+        { 1767, 3605},{ 2232, 3948},{ 2744, 4227},{ 3235, 4439},
+        { 3734, 4607},{ 4217, 4762},{ 4673, 4939},{ 5076, 5046},
+        { 5338, 5090},{ 5695, 5109},{ 6100, 5151},{ 6410, 5200},
+        { 7232, 5359},{ 7423, 5426},{ 7630, 5456},{ 7812, 5535},
+        { 8109, 5607},{ 8499, 5743},{ 9076, 5813},{ 9436, 5898}
       },
       /*Cr  qi=35  INTER*/
       {
-        {  135,    8},{  154,  359},{  164,  687},{  176, 1056},
-        {  202, 1425},{  234, 1769},{  274, 2098},{  328, 2411},
-        {  404, 2698},{  504, 2958},{  628, 3194},{  769, 3409},
-        {  918, 3608},{ 1068, 3799},{ 1215, 3990},{ 1360, 4178},
-        { 1498, 4373},{ 1637, 4563},{ 1786, 4743},{ 1942, 4904},
-        { 2117, 5033},{ 2299, 5148},{ 2497, 5226},{ 2705, 5259}
+        {   60,  -84},{  122, 1421},{  212, 2770},{  418, 3915},
+        {  780, 4852},{  998, 5823},{ 1317, 6615},{ 2168, 6803},
+        { 3156, 6612},{ 3993, 6391},{ 4665, 6278},{ 5167, 6198},
+        { 5611, 6135},{ 6002, 6134},{ 6447, 6172},{ 6801, 6186},
+        { 7175, 6228},{ 7640, 6206},{ 8014, 6267},{ 8369, 6370},
+        { 8629, 6390},{ 8943, 6360},{ 9434, 6425},{ 9811, 6457}
       }
     }
   },
@@ -2290,61 +2290,61 @@
     {
       /*Y'  qi=36  INTRA*/
       {
-        {  235,   11},{  510, 1382},{ 1051, 2249},{ 1711, 2656},
-        { 2318, 2951},{ 2906, 3275},{ 3484, 3630},{ 4030, 3984},
-        { 4531, 4330},{ 4995, 4651},{ 5433, 4930},{ 5837, 5147},
-        { 6213, 5325},{ 6560, 5519},{ 6901, 5737},{ 7234, 5946},
-        { 7539, 6134},{ 7857, 6316},{ 8153, 6471},{ 8388, 6597},
-        { 8618, 6732},{ 8865, 6856},{ 9121, 6978},{ 9381, 7166}
+        {  126,   57},{  452, 1317},{  872, 2244},{ 1383, 2814},
+        { 1922, 3223},{ 2476, 3623},{ 3055, 3992},{ 3658, 4265},
+        { 4258, 4450},{ 4843, 4580},{ 5398, 4677},{ 5894, 4717},
+        { 6379, 4726},{ 6842, 4769},{ 7300, 4848},{ 7783, 4916},
+        { 8234, 4957},{ 8670, 4999},{ 9065, 5018},{ 9399, 5023},
+        { 9759, 5019},{10123, 5029},{10498, 5046},{10982, 5034}
       },
       /*Y'  qi=36  INTER*/
       {
-        {  206,    6},{  219, 1335},{  520, 2535},{ 1028, 3510},
-        { 1661, 4306},{ 2354, 4990},{ 3089, 5579},{ 3862, 6036},
-        { 4652, 6305},{ 5389, 6436},{ 6032, 6527},{ 6597, 6606},
-        { 7102, 6680},{ 7564, 6752},{ 7990, 6809},{ 8386, 6856},
-        { 8762, 6900},{ 9118, 6941},{ 9456, 6975},{ 9772, 6995},
-        {10074, 7009},{10355, 7020},{10617, 7016},{10868, 7004}
+        {   82,  -15},{  124, 1330},{  211, 2686},{  329, 3919},
+        {  508, 5010},{  843, 5914},{ 1431, 6537},{ 2288, 6854},
+        { 3296, 6939},{ 4267, 6902},{ 5107, 6830},{ 5824, 6763},
+        { 6457, 6712},{ 7026, 6669},{ 7542, 6631},{ 8017, 6600},
+        { 8454, 6576},{ 8873, 6557},{ 9267, 6537},{ 9620, 6519},
+        { 9957, 6502},{10289, 6486},{10603, 6472},{10884, 6472}
       }
     },
     {
       /*Cb  qi=36  INTRA*/
       {
-        {   22,    2},{  163,  372},{  265,  752},{  314, 1167},
-        {  379, 1551},{  471, 1873},{  577, 2144},{  684, 2375},
-        {  794, 2580},{  914, 2751},{ 1031, 2909},{ 1147, 3070},
-        { 1267, 3216},{ 1378, 3352},{ 1481, 3484},{ 1572, 3639},
-        { 1663, 3783},{ 1750, 3905},{ 1825, 4041},{ 1898, 4197},
-        { 1985, 4339},{ 2063, 4468},{ 2131, 4613},{ 2213, 4832}
+        {   51,  -18},{  344, 1454},{  730, 2562},{ 1149, 3322},
+        { 1573, 3885},{ 2032, 4302},{ 2581, 4477},{ 3093, 4544},
+        { 3601, 4634},{ 4142, 4703},{ 4533, 4858},{ 4868, 5042},
+        { 5463, 5177},{ 5961, 5300},{ 6220, 5363},{ 6803, 5419},
+        { 7204, 5549},{ 7158, 5514},{ 7460, 5528},{ 7863, 5695},
+        { 8141, 5526},{ 8239, 5306},{ 8636, 5459},{ 8908, 5411}
       },
       /*Cb  qi=36  INTER*/
       {
-        {  148,   34},{  159,  353},{  168,  678},{  181, 1047},
-        {  206, 1419},{  246, 1762},{  304, 2072},{  378, 2364},
-        {  466, 2640},{  571, 2898},{  691, 3139},{  821, 3366},
-        {  962, 3579},{ 1108, 3782},{ 1268, 3968},{ 1443, 4138},
-        { 1628, 4296},{ 1813, 4446},{ 1996, 4587},{ 2170, 4732},
-        { 2335, 4877},{ 2502, 5023},{ 2662, 5204},{ 2816, 5396}
+        {   54,  -94},{  107, 1429},{  167, 2823},{  276, 4052},
+        {  499, 5101},{  891, 5936},{ 1432, 6553},{ 2177, 6941},
+        { 3151, 7041},{ 4108, 6940},{ 4866, 6737},{ 5490, 6531},
+        { 6031, 6376},{ 6485, 6247},{ 6967, 6247},{ 7382, 6283},
+        { 7841, 6286},{ 8303, 6308},{ 8722, 6306},{ 9165, 6314},
+        { 9639, 6250},{10016, 6219},{10427, 6236},{10843, 6216}
       }
     },
     {
       /*Cr  qi=36  INTRA*/
       {
-        {   24,    6},{  162,  388},{  256,  780},{  314, 1203},
-        {  389, 1575},{  480, 1883},{  578, 2151},{  675, 2377},
-        {  780, 2570},{  890, 2750},{ 1012, 2917},{ 1138, 3062},
-        { 1254, 3187},{ 1371, 3316},{ 1474, 3461},{ 1574, 3582},
-        { 1678, 3671},{ 1771, 3784},{ 1846, 3917},{ 1918, 4044},
-        { 1996, 4218},{ 2068, 4367},{ 2143, 4494},{ 2248, 4581}
+        {   46,  -11},{  359, 1466},{  742, 2567},{ 1164, 3292},
+        { 1607, 3769},{ 2064, 4129},{ 2580, 4430},{ 3076, 4663},
+        { 3605, 4831},{ 4090, 4976},{ 4485, 5173},{ 4779, 5285},
+        { 5025, 5281},{ 5443, 5216},{ 5880, 5236},{ 6234, 5270},
+        { 7300, 5429},{ 7463, 5502},{ 7819, 5644},{ 8053, 5801},
+        { 8440, 6055},{ 8808, 6166},{ 9292, 6320},{ 9692, 6481}
       },
       /*Cr  qi=36  INTER*/
       {
-        {  140,   10},{  157,  358},{  165,  686},{  178, 1055},
-        {  204, 1422},{  239, 1763},{  282, 2088},{  343, 2397},
-        {  429, 2679},{  541, 2934},{  675, 3164},{  825, 3371},
-        {  980, 3566},{ 1138, 3754},{ 1295, 3937},{ 1447, 4126},
-        { 1593, 4315},{ 1742, 4495},{ 1899, 4667},{ 2071, 4815},
-        { 2261, 4930},{ 2466, 5024},{ 2677, 5085},{ 2901, 5092}
+        {   46,  -78},{  109, 1432},{  166, 2828},{  286, 4056},
+        {  520, 5074},{  874, 5909},{ 1452, 6484},{ 2378, 6592},
+        { 3367, 6391},{ 4147, 6193},{ 4802, 6096},{ 5367, 6052},
+        { 5860, 6034},{ 6191, 5986},{ 6684, 5975},{ 6992, 6031},
+        { 7416, 6108},{ 7633, 6129},{ 8080, 6142},{ 8363, 6201},
+        { 8737, 6200},{ 9071, 6195},{ 9432, 6352},{ 9793, 6396}
       }
     }
   },
@@ -2352,61 +2352,61 @@
     {
       /*Y'  qi=37  INTRA*/
       {
-        {  236,   30},{  562, 1355},{ 1128, 2197},{ 1803, 2592},
-        { 2429, 2875},{ 3038, 3188},{ 3631, 3539},{ 4185, 3892},
-        { 4690, 4240},{ 5159, 4563},{ 5598, 4838},{ 6002, 5050},
-        { 6378, 5230},{ 6728, 5421},{ 7072, 5629},{ 7409, 5838},
-        { 7717, 6024},{ 8036, 6204},{ 8333, 6356},{ 8573, 6479},
-        { 8800, 6613},{ 9047, 6741},{ 9301, 6864},{ 9571, 7063}
+        {  104,   73},{  503, 1276},{ 1043, 2072},{ 1672, 2493},
+        { 2306, 2767},{ 2962, 3018},{ 3637, 3263},{ 4311, 3467},
+        { 4956, 3629},{ 5567, 3757},{ 6147, 3863},{ 6678, 3931},
+        { 7173, 3971},{ 7648, 4028},{ 8141, 4099},{ 8636, 4161},
+        { 9070, 4213},{ 9492, 4251},{ 9872, 4285},{10198, 4307},
+        {10546, 4305},{10883, 4319},{11233, 4334},{11670, 4347}
       },
       /*Y'  qi=37  INTER*/
       {
-        {  210,    5},{  222, 1332},{  548, 2519},{ 1091, 3477},
-        { 1756, 4260},{ 2475, 4935},{ 3235, 5511},{ 4034, 5937},
-        { 4839, 6173},{ 5573, 6290},{ 6212, 6379},{ 6772, 6459},
-        { 7276, 6531},{ 7737, 6599},{ 8163, 6655},{ 8566, 6701},
-        { 8944, 6745},{ 9299, 6784},{ 9636, 6814},{ 9953, 6836},
-        {10257, 6854},{10549, 6867},{10813, 6863},{11053, 6834}
+        {   76,   -2},{  139, 1332},{  273, 2620},{  385, 3852},
+        {  546, 4969},{  931, 5833},{ 1593, 6398},{ 2532, 6655},
+        { 3589, 6691},{ 4570, 6628},{ 5407, 6548},{ 6123, 6482},
+        { 6763, 6432},{ 7334, 6392},{ 7846, 6353},{ 8327, 6322},
+        { 8766, 6295},{ 9187, 6273},{ 9598, 6256},{ 9969, 6245},
+        {10320, 6232},{10658, 6217},{10969, 6200},{11273, 6186}
       }
     },
     {
       /*Cb  qi=37  INTRA*/
       {
-        {   27,    2},{  179,  373},{  291,  752},{  345, 1160},
-        {  416, 1532},{  515, 1843},{  627, 2103},{  739, 2327},
-        {  854, 2526},{  978, 2693},{ 1102, 2846},{ 1221, 3007},
-        { 1340, 3157},{ 1452, 3292},{ 1556, 3427},{ 1648, 3585},
-        { 1738, 3731},{ 1824, 3859},{ 1901, 3998},{ 1972, 4147},
-        { 2064, 4282},{ 2145, 4421},{ 2216, 4567},{ 2285, 4785}
+        {   31,    3},{  414, 1407},{  912, 2358},{ 1465, 2968},
+        { 2021, 3405},{ 2565, 3746},{ 3121, 3988},{ 3627, 4149},
+        { 4131, 4244},{ 4687, 4363},{ 5164, 4521},{ 5514, 4624},
+        { 6123, 4771},{ 6683, 4945},{ 6965, 4994},{ 7422, 5041},
+        { 7898, 5116},{ 8065, 5102},{ 8362, 5144},{ 8736, 5204},
+        { 8803, 5082},{ 8911, 4893},{ 9320, 5005},{ 9901, 5293}
       },
       /*Cb  qi=37  INTER*/
       {
-        {  157,   33},{  162,  355},{  168,  679},{  182, 1045},
-        {  210, 1414},{  255, 1754},{  317, 2061},{  398, 2348},
-        {  496, 2619},{  611, 2872},{  740, 3108},{  880, 3331},
-        { 1027, 3542},{ 1182, 3738},{ 1349, 3920},{ 1534, 4085},
-        { 1732, 4234},{ 1924, 4377},{ 2105, 4527},{ 2285, 4673},
-        { 2464, 4806},{ 2635, 4956},{ 2797, 5133},{ 2980, 5305}
+        {   78,  -71},{  132, 1409},{  284, 2665},{  631, 3687},
+        { 1305, 4432},{ 1572, 5289},{ 1841, 5978},{ 2750, 6079},
+        { 3635, 6036},{ 4351, 5966},{ 5035, 5928},{ 5715, 5868},
+        { 6165, 5858},{ 6460, 5753},{ 7032, 5758},{ 7539, 5911},
+        { 7938, 5991},{ 8432, 6006},{ 8704, 6017},{ 9047, 6051},
+        { 9282, 5910},{ 9739, 5874},{10002, 5844},{10359, 5832}
       }
     },
     {
       /*Cr  qi=37  INTRA*/
       {
-        {   36,    7},{  180,  394},{  277,  785},{  341, 1199},
-        {  424, 1556},{  524, 1851},{  628, 2108},{  730, 2325},
-        {  842, 2513},{  957, 2689},{ 1084, 2853},{ 1212, 3001},
-        { 1330, 3129},{ 1449, 3255},{ 1553, 3398},{ 1650, 3522},
-        { 1752, 3622},{ 1848, 3735},{ 1924, 3863},{ 1994, 3995},
-        { 2072, 4168},{ 2145, 4323},{ 2215, 4454},{ 2324, 4538}
+        {   35,   26},{  433, 1411},{  933, 2358},{ 1498, 2931},
+        { 2058, 3293},{ 2570, 3601},{ 3111, 3877},{ 3619, 4090},
+        { 4127, 4254},{ 4647, 4401},{ 5134, 4578},{ 5539, 4679},
+        { 5826, 4746},{ 6184, 4829},{ 6540, 4873},{ 6791, 4917},
+        { 7512, 5072},{ 7678, 5172},{ 7737, 5091},{ 8071, 5043},
+        { 8409, 5051},{ 9202, 5132},{ 9870, 5159},{10280, 5158}
       },
       /*Cr  qi=37  INTER*/
       {
-        {  149,    9},{  157,  359},{  166,  686},{  180, 1053},
-        {  208, 1417},{  246, 1755},{  295, 2077},{  362, 2381},
-        {  458, 2657},{  580, 2905},{  725, 3130},{  886, 3333},
-        { 1050, 3523},{ 1213, 3707},{ 1373, 3893},{ 1529, 4078},
-        { 1690, 4256},{ 1848, 4436},{ 2012, 4605},{ 2196, 4742},
-        { 2397, 4844},{ 2616, 4919},{ 2839, 4964},{ 3068, 4999}
+        {   65,  -63},{  135, 1406},{  279, 2675},{  643, 3681},
+        { 1241, 4465},{ 1560, 5291},{ 1963, 5798},{ 2844, 5808},
+        { 3593, 5719},{ 4153, 5711},{ 4753, 5799},{ 5254, 5588},
+        { 5709, 5614},{ 6136, 5519},{ 6742, 5464},{ 7340, 5458},
+        { 7866, 5399},{ 8392, 5339},{ 8919, 5280},{ 9058, 5379},
+        { 9540, 5338},{10021, 5297},{10502, 5257},{10984, 5216}
       }
     }
   },
@@ -2414,61 +2414,61 @@
     {
       /*Y'  qi=38  INTRA*/
       {
-        {  236,   32},{  570, 1352},{ 1154, 2183},{ 1846, 2567},
-        { 2492, 2835},{ 3124, 3127},{ 3740, 3457},{ 4315, 3791},
-        { 4844, 4115},{ 5329, 4414},{ 5780, 4670},{ 6193, 4864},
-        { 6578, 5028},{ 6937, 5212},{ 7292, 5410},{ 7639, 5604},
-        { 7956, 5783},{ 8286, 5953},{ 8589, 6102},{ 8830, 6217},
-        { 9069, 6339},{ 9321, 6458},{ 9578, 6574},{ 9858, 6766}
+        {  114,   81},{  536, 1261},{ 1080, 2065},{ 1727, 2496},
+        { 2411, 2769},{ 3122, 3016},{ 3834, 3247},{ 4519, 3436},
+        { 5157, 3587},{ 5757, 3707},{ 6325, 3810},{ 6834, 3873},
+        { 7318, 3906},{ 7777, 3974},{ 8218, 4090},{ 8619, 4231},
+        { 8949, 4458},{ 9356, 4680},{ 9763, 4752},{10131, 4754},
+        {10538, 4750},{10926, 4781},{11351, 4802},{11978, 4781}
       },
       /*Y'  qi=38  INTER*/
       {
-        {  210,    7},{  226, 1331},{  589, 2497},{ 1187, 3424},
-        { 1908, 4173},{ 2682, 4812},{ 3496, 5341},{ 4347, 5698},
-        { 5176, 5876},{ 5911, 5973},{ 6546, 6054},{ 7109, 6130},
-        { 7619, 6200},{ 8085, 6256},{ 8519, 6308},{ 8927, 6352},
-        { 9307, 6387},{ 9672, 6424},{10024, 6455},{10352, 6479},
-        {10665, 6495},{10955, 6501},{11224, 6504},{11463, 6509}
+        {   78,    2},{  140, 1332},{  258, 2633},{  385, 3852},
+        {  615, 4906},{ 1094, 5695},{ 1873, 6175},{ 2903, 6363},
+        { 3977, 6369},{ 4927, 6306},{ 5732, 6242},{ 6431, 6191},
+        { 7052, 6154},{ 7613, 6124},{ 8124, 6093},{ 8592, 6069},
+        { 9029, 6047},{ 9446, 6030},{ 9842, 6020},{10200, 6005},
+        {10557, 5996},{10888, 5985},{11190, 5963},{11496, 5944}
       }
     },
     {
       /*Cb  qi=38  INTRA*/
       {
-        {   29,    3},{  181,  373},{  292,  752},{  350, 1157},
-        {  429, 1525},{  537, 1831},{  654, 2087},{  772, 2304},
-        {  894, 2495},{ 1025, 2655},{ 1151, 2804},{ 1276, 2961},
-        { 1403, 3106},{ 1517, 3239},{ 1622, 3372},{ 1719, 3528},
-        { 1814, 3671},{ 1905, 3797},{ 1991, 3929},{ 2062, 4081},
-        { 2151, 4215},{ 2243, 4341},{ 2322, 4483},{ 2410, 4697}
+        {   11,    4},{  445, 1372},{  944, 2330},{ 1420, 3011},
+        { 1874, 3542},{ 2353, 3935},{ 2902, 4179},{ 3498, 4298},
+        { 4108, 4356},{ 4654, 4397},{ 5044, 4519},{ 5439, 4660},
+        { 6043, 4809},{ 6531, 4950},{ 6813, 4980},{ 7400, 5008},
+        { 7816, 5098},{ 7786, 5099},{ 8172, 5094},{ 8337, 5189},
+        { 8066, 5105},{ 7961, 4910},{ 8257, 5114},{ 8545, 5328}
       },
       /*Cb  qi=38  INTER*/
       {
-        {  154,   38},{  163,  356},{  170,  678},{  185, 1045},
-        {  215, 1411},{  263, 1746},{  334, 2048},{  426, 2329},
-        {  538, 2592},{  666, 2838},{  809, 3068},{  961, 3283},
-        { 1120, 3486},{ 1289, 3675},{ 1470, 3849},{ 1670, 4004},
-        { 1877, 4148},{ 2082, 4284},{ 2279, 4419},{ 2466, 4553},
-        { 2650, 4695},{ 2836, 4851},{ 3021, 5011},{ 3207, 5170}
+        {   75,  -61},{  131, 1404},{  309, 2637},{  701, 3639},
+        { 1364, 4401},{ 1544, 5277},{ 2102, 5770},{ 3070, 5803},
+        { 3964, 5745},{ 4652, 5712},{ 5302, 5700},{ 5911, 5623},
+        { 6405, 5644},{ 6893, 5669},{ 7390, 5641},{ 7843, 5675},
+        { 8340, 5762},{ 8622, 5727},{ 9051, 5671},{ 9429, 5648},
+        { 9750, 5666},{10162, 5614},{10405, 5614},{10768, 5608}
       }
     },
     {
       /*Cr  qi=38  INTRA*/
       {
-        {   38,    7},{  182,  394},{  279,  785},{  348, 1195},
-        {  438, 1550},{  544, 1842},{  653, 2096},{  761, 2308},
-        {  878, 2487},{ 1000, 2656},{ 1134, 2815},{ 1270, 2955},
-        { 1396, 3076},{ 1519, 3199},{ 1625, 3339},{ 1725, 3460},
-        { 1831, 3557},{ 1927, 3670},{ 2005, 3792},{ 2080, 3919},
-        { 2167, 4082},{ 2242, 4227},{ 2309, 4364},{ 2415, 4447}
+        {   12,   16},{  460, 1379},{  923, 2358},{ 1361, 3056},
+        { 1858, 3482},{ 2370, 3813},{ 2892, 4112},{ 3384, 4337},
+        { 3881, 4594},{ 4316, 4740},{ 4687, 4804},{ 5056, 4869},
+        { 5348, 4898},{ 5616, 5044},{ 5833, 5221},{ 6163, 5222},
+        { 6815, 5257},{ 6935, 5398},{ 6849, 5447},{ 7058, 5536},
+        { 7420, 5569},{ 8023, 5567},{ 8263, 5667},{ 8630, 5721}
       },
       /*Cr  qi=38  INTER*/
       {
-        {  149,    6},{  159,  359},{  166,  686},{  182, 1052},
-        {  213, 1414},{  255, 1748},{  309, 2064},{  387, 2363},
-        {  497, 2632},{  636, 2872},{  794, 3089},{  968, 3283},
-        { 1145, 3465},{ 1315, 3646},{ 1483, 3826},{ 1657, 4004},
-        { 1826, 4180},{ 1998, 4346},{ 2188, 4490},{ 2391, 4610},
-        { 2598, 4710},{ 2828, 4770},{ 3063, 4792},{ 3257, 4848}
+        {   60,  -56},{  136, 1401},{  303, 2648},{  698, 3644},
+        { 1281, 4448},{ 1578, 5217},{ 2251, 5520},{ 3157, 5513},
+        { 3907, 5504},{ 4474, 5543},{ 4988, 5541},{ 5649, 5482},
+        { 6093, 5424},{ 6635, 5406},{ 7084, 5452},{ 7629, 5415},
+        { 8150, 5393},{ 8671, 5372},{ 9193, 5350},{ 9492, 5344},
+        { 9987, 5324},{10482, 5304},{10977, 5284},{11472, 5264}
       }
     }
   },
@@ -2476,61 +2476,61 @@
     {
       /*Y'  qi=39  INTRA*/
       {
-        {  234,   32},{  570, 1352},{ 1155, 2183},{ 1848, 2566},
-        { 2495, 2831},{ 3133, 3119},{ 3755, 3440},{ 4337, 3764},
-        { 4871, 4082},{ 5364, 4373},{ 5820, 4621},{ 6237, 4809},
-        { 6626, 4966},{ 6987, 5146},{ 7346, 5340},{ 7699, 5527},
-        { 8024, 5697},{ 8356, 5862},{ 8660, 6005},{ 8907, 6116},
-        { 9150, 6230},{ 9408, 6342},{ 9665, 6449},{ 9941, 6627}
+        {  121,   69},{  541, 1277},{ 1091, 2184},{ 1765, 2738},
+        { 2537, 3042},{ 3294, 3270},{ 3994, 3473},{ 4650, 3638},
+        { 5249, 3759},{ 5810, 3849},{ 6341, 3935},{ 6785, 3968},
+        { 7224, 3974},{ 7678, 4028},{ 8155, 4126},{ 8669, 4210},
+        { 9134, 4259},{ 9605, 4302},{10032, 4327},{10382, 4336},
+        {10765, 4336},{11177, 4350},{11605, 4352},{12161, 4337}
       },
       /*Y'  qi=39  INTER*/
       {
-        {  206,    9},{  225, 1331},{  589, 2497},{ 1187, 3424},
-        { 1909, 4172},{ 2688, 4807},{ 3514, 5326},{ 4376, 5666},
-        { 5208, 5831},{ 5944, 5921},{ 6579, 6000},{ 7142, 6075},
-        { 7653, 6140},{ 8120, 6197},{ 8556, 6247},{ 8965, 6288},
-        { 9347, 6324},{ 9711, 6355},{10063, 6384},{10398, 6411},
-        {10700, 6425},{10994, 6428},{11271, 6426},{11496, 6430}
+        {   72,   -2},{  136, 1333},{  213, 2678},{  361, 3870},
+        {  643, 4876},{ 1172, 5628},{ 2023, 6058},{ 3112, 6202},
+        { 4212, 6177},{ 5172, 6099},{ 5983, 6027},{ 6685, 5973},
+        { 7313, 5933},{ 7879, 5900},{ 8395, 5869},{ 8873, 5848},
+        { 9321, 5825},{ 9751, 5805},{10160, 5792},{10537, 5781},
+        {10885, 5770},{11228, 5757},{11556, 5746},{11879, 5720}
       }
     },
     {
       /*Cb  qi=39  INTRA*/
       {
-        {   29,    3},{  180,  373},{  292,  752},{  350, 1157},
-        {  429, 1524},{  537, 1829},{  655, 2084},{  775, 2300},
-        {  899, 2489},{ 1028, 2648},{ 1155, 2796},{ 1281, 2950},
-        { 1410, 3093},{ 1525, 3226},{ 1629, 3360},{ 1728, 3513},
-        { 1828, 3654},{ 1919, 3778},{ 2002, 3911},{ 2079, 4060},
-        { 2169, 4191},{ 2260, 4320},{ 2340, 4457},{ 2413, 4674}
+        {   23,   -4},{  361, 1365},{  838, 2333},{ 1369, 2968},
+        { 1902, 3464},{ 2476, 3780},{ 3050, 3934},{ 3570, 4038},
+        { 4113, 4111},{ 4615, 4197},{ 5014, 4354},{ 5421, 4505},
+        { 6048, 4638},{ 6550, 4755},{ 6825, 4799},{ 7480, 4854},
+        { 7878, 4968},{ 7720, 4955},{ 8015, 4919},{ 8342, 5009},
+        { 8558, 4848},{ 8574, 4621},{ 8820, 4785},{ 8954, 4752}
       },
       /*Cb  qi=39  INTER*/
       {
-        {  164,   35},{  165,  355},{  169,  678},{  185, 1044},
-        {  214, 1410},{  263, 1746},{  334, 2048},{  426, 2328},
-        {  538, 2592},{  668, 2838},{  810, 3068},{  960, 3285},
-        { 1118, 3487},{ 1288, 3676},{ 1470, 3850},{ 1667, 4007},
-        { 1875, 4148},{ 2081, 4283},{ 2275, 4424},{ 2466, 4561},
-        { 2652, 4698},{ 2832, 4853},{ 3015, 5008},{ 3186, 5172}
+        {   34,  -85},{   97, 1419},{  175, 2755},{  348, 3887},
+        {  736, 4742},{ 1362, 5351},{ 2232, 5668},{ 3209, 5701},
+        { 4089, 5638},{ 4862, 5574},{ 5529, 5565},{ 6114, 5511},
+        { 6575, 5449},{ 7021, 5444},{ 7546, 5502},{ 8077, 5479},
+        { 8498, 5504},{ 8791, 5463},{ 9062, 5540},{ 9365, 5510},
+        { 9854, 5398},{10283, 5397},{10657, 5362},{11029, 5341}
       }
     },
     {
       /*Cr  qi=39  INTRA*/
       {
-        {   37,    7},{  182,  394},{  279,  785},{  348, 1195},
-        {  438, 1549},{  544, 1840},{  655, 2093},{  766, 2302},
-        {  883, 2481},{ 1005, 2650},{ 1138, 2809},{ 1272, 2949},
-        { 1397, 3070},{ 1522, 3190},{ 1632, 3327},{ 1734, 3451},
-        { 1843, 3549},{ 1938, 3659},{ 2017, 3775},{ 2095, 3895},
-        { 2179, 4058},{ 2256, 4208},{ 2331, 4335},{ 2441, 4401}
+        {   21,  -10},{  370, 1376},{  859, 2320},{ 1414, 2928},
+        { 1944, 3337},{ 2478, 3652},{ 3081, 3879},{ 3650, 4053},
+        { 4215, 4267},{ 4676, 4374},{ 5045, 4441},{ 5373, 4502},
+        { 5576, 4485},{ 5944, 4563},{ 6380, 4666},{ 6810, 4695},
+        { 7707, 4801},{ 7951, 4858},{ 8254, 4902},{ 8519, 4909},
+        { 8043, 4742},{ 8509, 4776},{ 8769, 4787},{ 8910, 4768}
       },
       /*Cr  qi=39  INTER*/
       {
-        {  146,    9},{  157,  360},{  168,  686},{  182, 1052},
-        {  212, 1413},{  254, 1747},{  309, 2064},{  388, 2363},
-        {  496, 2632},{  634, 2872},{  795, 3087},{  968, 3281},
-        { 1141, 3466},{ 1313, 3647},{ 1484, 3829},{ 1653, 4008},
-        { 1822, 4183},{ 1995, 4354},{ 2188, 4499},{ 2386, 4617},
-        { 2592, 4709},{ 2827, 4775},{ 3069, 4802},{ 3305, 4777}
+        {   38, -115},{  102, 1425},{  178, 2751},{  350, 3895},
+        {  751, 4761},{ 1444, 5286},{ 2376, 5435},{ 3277, 5418},
+        { 4009, 5416},{ 4622, 5414},{ 5232, 5401},{ 5713, 5197},
+        { 6221, 5190},{ 6698, 5139},{ 7282, 5104},{ 7910, 5099},
+        { 8454, 5044},{ 8999, 4989},{ 9543, 4934},{ 9778, 4984},
+        {10286, 4941},{10795, 4898},{11303, 4855},{11811, 4812}
       }
     }
   },
@@ -2538,61 +2538,61 @@
     {
       /*Y'  qi=40  INTRA*/
       {
-        {  226,   38},{  594, 1336},{ 1233, 2131},{ 1973, 2495},
-        { 2656, 2748},{ 3319, 3025},{ 3962, 3342},{ 4560, 3665},
-        { 5107, 3977},{ 5609, 4266},{ 6073, 4511},{ 6493, 4693},
-        { 6886, 4846},{ 7253, 5021},{ 7610, 5214},{ 7964, 5399},
-        { 8291, 5565},{ 8627, 5726},{ 8934, 5868},{ 9183, 5979},
-        { 9427, 6092},{ 9685, 6201},{ 9953, 6304},{10248, 6484}
+        {  110,   80},{  549, 1257},{ 1131, 2052},{ 1831, 2463},
+        { 2564, 2709},{ 3304, 2932},{ 4038, 3147},{ 4741, 3328},
+        { 5396, 3470},{ 6009, 3584},{ 6577, 3688},{ 7084, 3748},
+        { 7567, 3782},{ 8039, 3843},{ 8521, 3931},{ 9007, 4013},
+        { 9451, 4070},{ 9895, 4111},{10301, 4134},{10645, 4135},
+        {11002, 4133},{11370, 4143},{11745, 4145},{12218, 4151}
       },
       /*Y'  qi=40  INTER*/
       {
-        {  217,   -2},{  233, 1327},{  661, 2461},{ 1337, 3353},
-        { 2130, 4073},{ 2967, 4690},{ 3841, 5178},{ 4739, 5469},
-        { 5581, 5606},{ 6311, 5693},{ 6944, 5771},{ 7510, 5843},
-        { 8025, 5907},{ 8501, 5964},{ 8944, 6014},{ 9359, 6055},
-        { 9752, 6088},{10124, 6122},{10477, 6148},{10807, 6163},
-        {11117, 6175},{11411, 6185},{11686, 6188},{11943, 6192}
+        {   85,   -3},{  144, 1328},{  281, 2609},{  447, 3791},
+        {  763, 4777},{ 1414, 5448},{ 2410, 5786},{ 3577, 5866},
+        { 4667, 5822},{ 5587, 5756},{ 6372, 5702},{ 7056, 5661},
+        { 7671, 5629},{ 8228, 5605},{ 8737, 5582},{ 9213, 5560},
+        { 9651, 5539},{10067, 5527},{10475, 5519},{10854, 5510},
+        {11198, 5502},{11531, 5491},{11832, 5479},{12076, 5451}
       }
     },
     {
       /*Cb  qi=40  INTRA*/
       {
-        {   29,    2},{  183,  373},{  297,  751},{  362, 1148},
-        {  450, 1502},{  570, 1792},{  698, 2035},{  829, 2240},
-        {  961, 2422},{ 1097, 2579},{ 1226, 2727},{ 1356, 2883},
-        { 1489, 3027},{ 1606, 3163},{ 1711, 3303},{ 1807, 3459},
-        { 1907, 3600},{ 2005, 3724},{ 2088, 3858},{ 2163, 4007},
-        { 2257, 4127},{ 2347, 4251},{ 2426, 4396},{ 2514, 4608}
+        {   18,   13},{  457, 1358},{ 1008, 2263},{ 1599, 2837},
+        { 2184, 3258},{ 2762, 3576},{ 3325, 3795},{ 3841, 3958},
+        { 4386, 4073},{ 4954, 4196},{ 5425, 4360},{ 5840, 4493},
+        { 6475, 4620},{ 6992, 4721},{ 7282, 4741},{ 7798, 4781},
+        { 8256, 4864},{ 8312, 4864},{ 8582, 4876},{ 8805, 4942},
+        { 8795, 4835},{ 8734, 4681},{ 9126, 4791},{ 9449, 4904}
       },
       /*Cb  qi=40  INTER*/
       {
-        {  155,   41},{  164,  358},{  172,  678},{  190, 1042},
-        {  226, 1401},{  286, 1728},{  373, 2020},{  487, 2289},
-        {  620, 2542},{  768, 2779},{  930, 3000},{ 1099, 3206},
-        { 1271, 3402},{ 1459, 3582},{ 1665, 3742},{ 1886, 3883},
-        { 2110, 4012},{ 2330, 4144},{ 2536, 4284},{ 2735, 4419},
-        { 2944, 4551},{ 3148, 4704},{ 3347, 4840},{ 3557, 4961}
+        {   70,  -57},{  132, 1398},{  349, 2601},{  835, 3550},
+        { 1585, 4258},{ 1824, 5040},{ 2591, 5360},{ 3631, 5332},
+        { 4467, 5299},{ 5132, 5280},{ 5801, 5282},{ 6424, 5224},
+        { 6922, 5195},{ 7452, 5228},{ 7829, 5189},{ 8441, 5200},
+        { 8927, 5194},{ 9051, 5095},{ 9489, 5201},{ 9884, 5243},
+        {10272, 5213},{10544, 5219},{12034, 5113},{12638, 5094}
       }
     },
     {
       /*Cr  qi=40  INTRA*/
       {
-        {   37,    6},{  184,  394},{  283,  783},{  359, 1185},
-        {  461, 1523},{  580, 1798},{  699, 2036},{  819, 2237},
-        {  946, 2411},{ 1074, 2583},{ 1211, 2746},{ 1346, 2885},
-        { 1474, 3006},{ 1602, 3130},{ 1714, 3272},{ 1819, 3390},
-        { 1926, 3483},{ 2023, 3598},{ 2105, 3714},{ 2181, 3841},
-        { 2265, 4009},{ 2341, 4150},{ 2415, 4273},{ 2521, 4361}
+        {   20,   30},{  475, 1359},{ 1017, 2258},{ 1625, 2800},
+        { 2217, 3143},{ 2764, 3436},{ 3343, 3684},{ 3889, 3877},
+        { 4414, 4054},{ 4892, 4173},{ 5391, 4283},{ 5801, 4364},
+        { 5995, 4395},{ 6309, 4478},{ 6746, 4576},{ 7105, 4624},
+        { 7918, 4748},{ 8165, 4825},{ 7898, 4748},{ 7919, 4719},
+        { 8187, 4718},{ 9152, 4856},{ 9562, 4922},{ 9996, 4964}
       },
       /*Cr  qi=40  INTER*/
       {
-        {  151,   10},{  160,  359},{  169,  686},{  186, 1049},
-        {  223, 1404},{  276, 1730},{  345, 2038},{  446, 2324},
-        {  579, 2581},{  740, 2809},{  920, 3014},{ 1108, 3201},
-        { 1299, 3378},{ 1485, 3556},{ 1663, 3737},{ 1848, 3910},
-        { 2041, 4076},{ 2237, 4231},{ 2448, 4358},{ 2676, 4452},
-        { 2912, 4519},{ 3154, 4562},{ 3406, 4570},{ 3671, 4526}
+        {   59,  -50},{  138, 1394},{  344, 2609},{  827, 3557},
+        { 1506, 4301},{ 1891, 4959},{ 2721, 5145},{ 3606, 5097},
+        { 4325, 5039},{ 4952, 5060},{ 5576, 5095},{ 5999, 4983},
+        { 6551, 4948},{ 6736, 4989},{ 7151, 4981},{ 7694, 5130},
+        { 7902, 5080},{ 8256, 5062},{ 8626, 5080},{ 8953, 5121},
+        { 9316, 5143},{ 9680, 5164},{10207, 5132},{10588, 5148}
       }
     }
   },
@@ -2600,61 +2600,61 @@
     {
       /*Y'  qi=41  INTRA*/
       {
-        {  220,   40},{  608, 1331},{ 1268, 2118},{ 2027, 2472},
-        { 2731, 2711},{ 3421, 2968},{ 4089, 3261},{ 4710, 3558},
-        { 5280, 3842},{ 5800, 4103},{ 6277, 4326},{ 6709, 4490},
-        { 7111, 4632},{ 7488, 4797},{ 7858, 4979},{ 8226, 5151},
-        { 8570, 5308},{ 8922, 5458},{ 9244, 5585},{ 9501, 5682},
-        { 9751, 5786},{10022, 5892},{10298, 5991},{10596, 6153}
+        {  109,   82},{  552, 1255},{ 1151, 2046},{ 1898, 2442},
+        { 2677, 2663},{ 3428, 2870},{ 4154, 3073},{ 4839, 3248},
+        { 5468, 3395},{ 6059, 3525},{ 6612, 3645},{ 7100, 3717},
+        { 7568, 3759},{ 8031, 3825},{ 8500, 3920},{ 8985, 4002},
+        { 9429, 4056},{ 9848, 4090},{10244, 4101},{10600, 4091},
+        {10978, 4075},{11390, 4074},{11812, 4070},{12344, 4056}
       },
       /*Y'  qi=41  INTER*/
       {
-        {  219,    0},{  234, 1327},{  696, 2445},{ 1417, 3313},
-        { 2263, 4001},{ 3165, 4571},{ 4109, 4982},{ 5051, 5193},
-        { 5899, 5292},{ 6626, 5368},{ 7262, 5435},{ 7836, 5495},
-        { 8360, 5549},{ 8842, 5597},{ 9292, 5639},{ 9718, 5675},
-        {10119, 5705},{10499, 5732},{10865, 5753},{11204, 5770},
-        {11519, 5782},{11819, 5788},{12093, 5785},{12335, 5762}
+        {   84,   -1},{  144, 1326},{  280, 2609},{  456, 3781},
+        {  811, 4737},{ 1517, 5373},{ 2570, 5679},{ 3763, 5741},
+        { 4853, 5694},{ 5769, 5633},{ 6546, 5580},{ 7226, 5542},
+        { 7838, 5517},{ 8396, 5494},{ 8908, 5473},{ 9382, 5460},
+        { 9823, 5447},{10243, 5433},{10659, 5422},{11039, 5416},
+        {11395, 5410},{11734, 5400},{12036, 5385},{12307, 5353}
       }
     },
     {
       /*Cb  qi=41  INTRA*/
       {
-        {   30,    3},{  184,  373},{  299,  750},{  365, 1145},
-        {  458, 1495},{  583, 1782},{  717, 2020},{  852, 2218},
-        {  988, 2394},{ 1129, 2545},{ 1267, 2688},{ 1405, 2834},
-        { 1542, 2972},{ 1659, 3107},{ 1769, 3242},{ 1874, 3395},
-        { 1977, 3532},{ 2077, 3656},{ 2166, 3791},{ 2246, 3938},
-        { 2345, 4055},{ 2440, 4161},{ 2522, 4293},{ 2617, 4505}
+        {   16,   16},{  479, 1345},{ 1053, 2236},{ 1646, 2819},
+        { 2184, 3276},{ 2699, 3643},{ 3245, 3875},{ 3791, 4006},
+        { 4376, 4118},{ 4978, 4264},{ 5432, 4437},{ 5791, 4529},
+        { 6436, 4651},{ 7022, 4784},{ 7324, 4791},{ 7846, 4798},
+        { 8326, 4874},{ 8338, 4904},{ 8565, 4905},{ 8702, 4983},
+        { 8491, 4859},{ 8324, 4620},{ 8747, 4800},{ 9100, 4974}
       },
       /*Cb  qi=41  INTER*/
       {
-        {  146,   41},{  161,  357},{  174,  678},{  190, 1041},
-        {  229, 1398},{  293, 1722},{  388, 2011},{  514, 2274},
-        {  660, 2522},{  819, 2754},{  986, 2972},{ 1161, 3174},
-        { 1348, 3360},{ 1549, 3531},{ 1767, 3684},{ 2002, 3817},
-        { 2237, 3945},{ 2470, 4066},{ 2695, 4187},{ 2913, 4315},
-        { 3129, 4450},{ 3349, 4574},{ 3581, 4689},{ 3807, 4801}
+        {   68,  -52},{  134, 1393},{  403, 2561},{  989, 3461},
+        { 1605, 4226},{ 1765, 5020},{ 2763, 5228},{ 3774, 5170},
+        { 4636, 5109},{ 5272, 5162},{ 5934, 5181},{ 6620, 5108},
+        { 7091, 5085},{ 7632, 5116},{ 8100, 5115},{ 8597, 5096},
+        { 8913, 5071},{ 9309, 5063},{ 9663, 5129},{10107, 5127},
+        {10476, 5152},{10898, 5235},{11247, 5227},{11649, 5258}
       }
     },
     {
       /*Cr  qi=41  INTRA*/
       {
-        {   39,    7},{  185,  394},{  285,  783},{  364, 1181},
-        {  470, 1516},{  591, 1789},{  716, 2022},{  841, 2218},
-        {  973, 2386},{ 1107, 2551},{ 1250, 2707},{ 1392, 2842},
-        { 1527, 2956},{ 1654, 3079},{ 1771, 3217},{ 1887, 3327},
-        { 1995, 3418},{ 2094, 3525},{ 2187, 3631},{ 2270, 3753},
-        { 2351, 3917},{ 2428, 4055},{ 2508, 4171},{ 2614, 4242}
+        {   21,   35},{  496, 1346},{ 1017, 2263},{ 1564, 2869},
+        { 2137, 3235},{ 2699, 3528},{ 3259, 3798},{ 3783, 4004},
+        { 4285, 4196},{ 4731, 4332},{ 5201, 4421},{ 5573, 4499},
+        { 5795, 4506},{ 6068, 4575},{ 6403, 4744},{ 6787, 4821},
+        { 7575, 4882},{ 7792, 4928},{ 7484, 4944},{ 7709, 5018},
+        { 7987, 5089},{ 8510, 5121},{ 8745, 5163},{ 9064, 5221}
       },
       /*Cr  qi=41  INTER*/
       {
-        {  146,    9},{  159,  360},{  171,  686},{  188, 1048},
-        {  226, 1401},{  283, 1724},{  360, 2028},{  471, 2310},
-        {  616, 2562},{  787, 2786},{  976, 2985},{ 1175, 3164},
-        { 1373, 3337},{ 1564, 3512},{ 1760, 3681},{ 1961, 3846},
-        { 2163, 4007},{ 2381, 4143},{ 2611, 4253},{ 2851, 4332},
-        { 3118, 4372},{ 3381, 4397},{ 3624, 4407},{ 3864, 4412}
+        {   50,  -44},{  142, 1388},{  396, 2571},{  960, 3484},
+        { 1500, 4297},{ 1839, 4956},{ 2850, 5017},{ 3760, 4916},
+        { 4476, 4908},{ 4936, 4977},{ 5522, 4990},{ 6080, 5008},
+        { 6562, 4854},{ 6934, 4850},{ 7283, 4903},{ 7773, 4958},
+        { 8009, 4852},{ 8255, 4860},{ 8595, 4845},{ 8923, 4842},
+        { 9261, 4829},{ 9600, 4815},{ 9938, 4802},{10276, 4789}
       }
     }
   },
@@ -2662,61 +2662,61 @@
     {
       /*Y'  qi=42  INTRA*/
       {
-        {  258,   53},{  689, 1302},{ 1369, 2075},{ 2137, 2422},
-        { 2859, 2650},{ 3570, 2897},{ 4256, 3184},{ 4892, 3478},
-        { 5469, 3758},{ 5996, 4017},{ 6480, 4240},{ 6912, 4404},
-        { 7322, 4544},{ 7708, 4707},{ 8079, 4886},{ 8450, 5058},
-        { 8792, 5211},{ 9146, 5355},{ 9478, 5481},{ 9735, 5578},
-        { 9985, 5673},{10259, 5775},{10536, 5872},{10851, 6033}
+        {  110,   95},{  606, 1237},{ 1246, 1986},{ 2040, 2330},
+        { 2847, 2500},{ 3628, 2662},{ 4408, 2828},{ 5163, 2973},
+        { 5874, 3099},{ 6541, 3208},{ 7173, 3300},{ 7745, 3361},
+        { 8277, 3402},{ 8792, 3452},{ 9312, 3513},{ 9828, 3570},
+        {10290, 3615},{10731, 3647},{11128, 3669},{11475, 3675},
+        {11835, 3671},{12187, 3676},{12549, 3677},{12996, 3669}
       },
       /*Y'  qi=42  INTER*/
       {
-        {  212,    3},{  236, 1325},{  712, 2436},{ 1458, 3294},
-        { 2324, 3974},{ 3239, 4539},{ 4195, 4939},{ 5141, 5141},
-        { 5991, 5239},{ 6719, 5314},{ 7356, 5381},{ 7930, 5443},
-        { 8456, 5498},{ 8944, 5547},{ 9396, 5586},{ 9819, 5617},
-        {10224, 5650},{10608, 5680},{10971, 5700},{11317, 5717},
-        {11640, 5726},{11942, 5728},{12217, 5731},{12468, 5725}
+        {   86,    4},{  143, 1326},{  351, 2551},{  573, 3687},
+        {  986, 4609},{ 1846, 5154},{ 3031, 5375},{ 4253, 5391},
+        { 5315, 5339},{ 6199, 5291},{ 6960, 5253},{ 7635, 5224},
+        { 8244, 5206},{ 8805, 5190},{ 9316, 5174},{ 9794, 5164},
+        {10239, 5153},{10666, 5140},{11085, 5135},{11481, 5134},
+        {11845, 5129},{12190, 5120},{12513, 5110},{12802, 5104}
       }
     },
     {
       /*Cb  qi=42  INTRA*/
       {
-        {   28,    3},{  194,  372},{  318,  747},{  395, 1133},
-        {  499, 1475},{  635, 1753},{  780, 1984},{  925, 2176},
-        { 1070, 2345},{ 1219, 2492},{ 1364, 2631},{ 1506, 2776},
-        { 1646, 2913},{ 1769, 3048},{ 1877, 3186},{ 1980, 3341},
-        { 2083, 3478},{ 2183, 3601},{ 2275, 3735},{ 2360, 3880},
-        { 2461, 3998},{ 2551, 4110},{ 2637, 4241},{ 2738, 4445}
+        {   32,   38},{  529, 1342},{ 1152, 2168},{ 1810, 2700},
+        { 2434, 3098},{ 3033, 3408},{ 3673, 3614},{ 4313, 3754},
+        { 4906, 3864},{ 5439, 3940},{ 5920, 4021},{ 6340, 4103},
+        { 6890, 4234},{ 7465, 4360},{ 7865, 4403},{ 8408, 4434},
+        { 8867, 4491},{ 8948, 4520},{ 9306, 4504},{ 9504, 4571},
+        { 9286, 4516},{ 9118, 4303},{ 9336, 4502},{ 9965, 4826}
       },
       /*Cb  qi=42  INTER*/
       {
-        {  148,   34},{  161,  353},{  174,  677},{  191, 1040},
-        {  230, 1396},{  298, 1718},{  397, 2004},{  526, 2266},
-        {  676, 2513},{  840, 2743},{ 1015, 2957},{ 1199, 3156},
-        { 1392, 3339},{ 1599, 3507},{ 1822, 3658},{ 2063, 3788},
-        { 2306, 3908},{ 2538, 4035},{ 2765, 4160},{ 2990, 4279},
-        { 3212, 4407},{ 3443, 4532},{ 3685, 4637},{ 3903, 4746}
+        {   64,  -41},{  139, 1381},{  474, 2508},{ 1175, 3363},
+        { 2051, 4026},{ 2086, 4847},{ 3182, 4996},{ 4192, 4937},
+        { 5056, 4932},{ 5879, 4966},{ 6454, 4950},{ 6951, 4907},
+        { 7569, 4919},{ 7982, 4822},{ 8569, 4857},{ 9017, 4860},
+        { 9616, 4971},{ 9950, 4918},{10259, 4919},{10706, 4919},
+        {10894, 4872},{11225, 4838},{11481, 4863},{11816, 4855}
       }
     },
     {
       /*Cr  qi=42  INTRA*/
       {
-        {   40,    7},{  196,  395},{  303,  781},{  394, 1168},
-        {  514, 1490},{  645, 1757},{  780, 1983},{  913, 2172},
-        { 1056, 2335},{ 1203, 2490},{ 1354, 2639},{ 1499, 2774},
-        { 1634, 2894},{ 1762, 3019},{ 1880, 3153},{ 1996, 3267},
-        { 2101, 3368},{ 2201, 3475},{ 2295, 3579},{ 2379, 3697},
-        { 2462, 3858},{ 2540, 4000},{ 2625, 4121},{ 2743, 4206}
+        {   30,   74},{  554, 1338},{ 1162, 2174},{ 1832, 2687},
+        { 2494, 2996},{ 3111, 3245},{ 3723, 3469},{ 4303, 3638},
+        { 4849, 3758},{ 5369, 3872},{ 5889, 4002},{ 6292, 4096},
+        { 6552, 4156},{ 6909, 4220},{ 7285, 4300},{ 7541, 4382},
+        { 8289, 4467},{ 8504, 4561},{ 8177, 4574},{ 8457, 4635},
+        { 8732, 4711},{ 9338, 4798},{ 9744, 4898},{10161, 4991}
       },
       /*Cr  qi=42  INTER*/
       {
-        {  142,    7},{  162,  358},{  171,  686},{  188, 1047},
-        {  227, 1398},{  286, 1720},{  367, 2023},{  482, 2303},
-        {  633, 2552},{  813, 2772},{ 1010, 2967},{ 1215, 3144},
-        { 1415, 3316},{ 1612, 3488},{ 1815, 3658},{ 2020, 3819},
-        { 2233, 3972},{ 2458, 4106},{ 2688, 4214},{ 2937, 4286},
-        { 3196, 4330},{ 3462, 4349},{ 3723, 4350},{ 3958, 4352}
+        {   45,  -32},{  148, 1374},{  467, 2520},{ 1156, 3379},
+        { 1904, 4108},{ 2154, 4750},{ 3226, 4778},{ 4154, 4758},
+        { 4916, 4792},{ 5635, 4788},{ 6155, 4819},{ 6401, 4768},
+        { 7014, 4706},{ 7545, 4649},{ 7845, 4646},{ 8111, 4659},
+        { 8498, 4633},{ 8885, 4606},{ 9272, 4579},{ 9609, 4497},
+        { 9990, 4464},{10371, 4431},{10753, 4398},{11134, 4365}
       }
     }
   },
@@ -2724,61 +2724,61 @@
     {
       /*Y'  qi=43  INTRA*/
       {
-        {  256,   55},{  695, 1296},{ 1396, 2053},{ 2187, 2394},
-        { 2931, 2613},{ 3655, 2854},{ 4350, 3137},{ 4993, 3425},
-        { 5574, 3700},{ 6101, 3953},{ 6590, 4174},{ 7025, 4335},
-        { 7428, 4471},{ 7812, 4627},{ 8183, 4799},{ 8556, 4966},
-        { 8902, 5117},{ 9258, 5258},{ 9589, 5381},{ 9848, 5478},
-        {10099, 5570},{10368, 5666},{10647, 5766},{10965, 5934}
+        {  119,   88},{  622, 1232},{ 1291, 1994},{ 2135, 2340},
+        { 2996, 2522},{ 3822, 2703},{ 4628, 2878},{ 5392, 3023},
+        { 6096, 3141},{ 6748, 3235},{ 7360, 3313},{ 7897, 3354},
+        { 8397, 3378},{ 8900, 3422},{ 9421, 3484},{ 9940, 3542},
+        {10400, 3584},{10867, 3610},{11294, 3625},{11642, 3632},
+        {12009, 3632},{12379, 3645},{12770, 3653},{13258, 3645}
       },
       /*Y'  qi=43  INTER*/
       {
-        {  214,    2},{  245, 1321},{  781, 2405},{ 1591, 3238},
-        { 2506, 3906},{ 3461, 4455},{ 4455, 4815},{ 5416, 4982},
-        { 6257, 5075},{ 6979, 5151},{ 7613, 5217},{ 8186, 5279},
-        { 8712, 5333},{ 9200, 5380},{ 9657, 5418},{10086, 5449},
-        {10493, 5479},{10879, 5509},{11240, 5530},{11584, 5543},
-        {11909, 5552},{12209, 5555},{12485, 5556},{12717, 5549}
+        {   91,   -4},{  149, 1322},{  316, 2574},{  560, 3695},
+        { 1067, 4552},{ 2019, 5042},{ 3275, 5213},{ 4524, 5198},
+        { 5588, 5133},{ 6473, 5081},{ 7240, 5042},{ 7919, 5013},
+        { 8535, 4991},{ 9099, 4972},{ 9619, 4957},{10102, 4946},
+        {10557, 4933},{10996, 4921},{11418, 4917},{11809, 4914},
+        {12179, 4908},{12536, 4900},{12849, 4892},{13123, 4876}
       }
     },
     {
       /*Cb  qi=43  INTRA*/
       {
-        {   31,    3},{  198,  373},{  322,  746},{  403, 1125},
-        {  514, 1456},{  653, 1725},{  801, 1950},{  950, 2138},
-        { 1095, 2307},{ 1243, 2458},{ 1385, 2602},{ 1525, 2748},
-        { 1668, 2884},{ 1789, 3022},{ 1897, 3164},{ 2001, 3317},
-        { 2106, 3454},{ 2204, 3579},{ 2293, 3709},{ 2378, 3855},
-        { 2482, 3974},{ 2580, 4082},{ 2669, 4214},{ 2765, 4427}
+        {    4,   22},{  532, 1314},{ 1157, 2160},{ 1803, 2704},
+        { 2413, 3117},{ 3020, 3418},{ 3634, 3609},{ 4183, 3760},
+        { 4735, 3868},{ 5335, 3987},{ 5847, 4129},{ 6205, 4203},
+        { 6828, 4316},{ 7487, 4444},{ 7888, 4461},{ 8472, 4505},
+        { 8916, 4576},{ 8954, 4592},{ 9270, 4608},{ 9401, 4637},
+        { 9162, 4509},{ 9068, 4397},{ 9428, 4529},{ 9747, 4673}
       },
       /*Cb  qi=43  INTER*/
       {
-        {  174,   33},{  172,  353},{  175,  677},{  197, 1037},
-        {  243, 1387},{  321, 1702},{  436, 1980},{  583, 2234},
-        {  750, 2473},{  930, 2697},{ 1119, 2906},{ 1315, 3099},
-        { 1525, 3275},{ 1749, 3434},{ 1990, 3574},{ 2240, 3701},
-        { 2488, 3822},{ 2733, 3941},{ 2979, 4054},{ 3211, 4171},
-        { 3439, 4295},{ 3680, 4417},{ 3926, 4518},{ 4173, 4645}
+        {   61,  -40},{  137, 1377},{  480, 2503},{ 1177, 3361},
+        { 1757, 4131},{ 2207, 4768},{ 3386, 4853},{ 4454, 4782},
+        { 5340, 4728},{ 6097, 4758},{ 6688, 4759},{ 7226, 4706},
+        { 7852, 4726},{ 8318, 4689},{ 8897, 4708},{ 9363, 4750},
+        { 9928, 4749},{10339, 4725},{10609, 4683},{10902, 4742},
+        {11210, 4726},{11635, 4731},{12106, 4754},{12495, 4755}
       }
     },
     {
       /*Cr  qi=43  INTRA*/
       {
-        {   42,    7},{  199,  395},{  308,  780},{  404, 1159},
-        {  528, 1470},{  662, 1726},{  799, 1947},{  937, 2133},
-        { 1082, 2298},{ 1227, 2458},{ 1374, 2613},{ 1515, 2754},
-        { 1654, 2873},{ 1783, 2995},{ 1899, 3132},{ 2016, 3243},
-        { 2122, 3341},{ 2219, 3447},{ 2312, 3553},{ 2402, 3674},
-        { 2491, 3830},{ 2566, 3965},{ 2645, 4089},{ 2748, 4190}
+        {    2,   46},{  553, 1313},{ 1157, 2169},{ 1770, 2724},
+        { 2368, 3073},{ 2955, 3362},{ 3576, 3608},{ 4141, 3780},
+        { 4683, 3970},{ 5189, 4101},{ 5668, 4165},{ 6071, 4238},
+        { 6322, 4261},{ 6670, 4345},{ 7007, 4450},{ 7267, 4509},
+        { 7911, 4576},{ 8095, 4638},{ 8176, 4646},{ 8357, 4665},
+        { 8682, 4720},{ 9177, 4761},{ 9475, 4807},{ 9844, 4845}
       },
       /*Cr  qi=43  INTER*/
       {
-        {  143,    9},{  161,  359},{  172,  685},{  194, 1044},
-        {  240, 1390},{  308, 1705},{  402, 2000},{  534, 2272},
-        {  703, 2513},{  901, 2725},{ 1114, 2913},{ 1332, 3084},
-        { 1547, 3253},{ 1756, 3422},{ 1970, 3588},{ 2186, 3749},
-        { 2414, 3893},{ 2658, 4008},{ 2905, 4102},{ 3172, 4164},
-        { 3445, 4190},{ 3721, 4193},{ 3984, 4182},{ 4236, 4159}
+        {   44,  -35},{  147, 1370},{  471, 2514},{ 1135, 3389},
+        { 1671, 4175},{ 2298, 4659},{ 3396, 4652},{ 4331, 4609},
+        { 5125, 4618},{ 5852, 4632},{ 6404, 4592},{ 6896, 4554},
+        { 7383, 4485},{ 7894, 4517},{ 8223, 4592},{ 8773, 4579},
+        { 9234, 4576},{ 9694, 4573},{10155, 4571},{10615, 4568},
+        {10790, 4619},{11220, 4622},{11650, 4625},{12081, 4628}
       }
     }
   },
@@ -2786,61 +2786,61 @@
     {
       /*Y'  qi=44  INTRA*/
       {
-        {  246,   58},{  719, 1291},{ 1460, 2040},{ 2282, 2374},
-        { 3049, 2582},{ 3792, 2805},{ 4505, 3066},{ 5168, 3336},
-        { 5771, 3589},{ 6319, 3821},{ 6824, 4027},{ 7270, 4177},
-        { 7690, 4300},{ 8087, 4447},{ 8472, 4613},{ 8861, 4772},
-        { 9222, 4912},{ 9593, 5041},{ 9934, 5155},{10202, 5245},
-        {10468, 5328},{10751, 5418},{11036, 5509},{11366, 5659}
+        {   93,   99},{  657, 1218},{ 1340, 2032},{ 2154, 2511},
+        { 3049, 2764},{ 3894, 2955},{ 4664, 3119},{ 5375, 3253},
+        { 6035, 3356},{ 6644, 3439},{ 7225, 3509},{ 7718, 3527},
+        { 8174, 3528},{ 8665, 3562},{ 9172, 3625},{ 9687, 3688},
+        {10154, 3729},{10639, 3762},{11087, 3781},{11445, 3780},
+        {11826, 3765},{12224, 3772},{12658, 3772},{13222, 3736}
       },
       /*Y'  qi=44  INTER*/
       {
-        {  209,    5},{  247, 1320},{  824, 2388},{ 1683, 3196},
-        { 2649, 3835},{ 3667, 4338},{ 4711, 4634},{ 5689, 4762},
-        { 6530, 4841},{ 7256, 4909},{ 7901, 4968},{ 8488, 5021},
-        { 9026, 5066},{ 9523, 5106},{ 9989, 5140},{10433, 5167},
-        {10850, 5194},{11238, 5218},{11616, 5237},{11970, 5252},
-        {12292, 5258},{12598, 5259},{12886, 5260},{13140, 5252}
+        {   98,  -30},{  162, 1326},{  307, 2596},{  626, 3655},
+        { 1287, 4421},{ 2373, 4847},{ 3679, 4985},{ 4900, 4970},
+        { 5919, 4929},{ 6771, 4899},{ 7512, 4877},{ 8180, 4862},
+        { 8786, 4850},{ 9340, 4839},{ 9855, 4833},{10332, 4828},
+        {10779, 4821},{11224, 4813},{11646, 4809},{12027, 4812},
+        {12400, 4807},{12758, 4798},{13083, 4796},{13388, 4797}
       }
     },
     {
       /*Cb  qi=44  INTRA*/
       {
-        {   31,    3},{  198,  373},{  323,  746},{  406, 1124},
-        {  523, 1452},{  670, 1717},{  825, 1933},{  980, 2113},
-        { 1134, 2274},{ 1286, 2419},{ 1433, 2557},{ 1583, 2697},
-        { 1730, 2829},{ 1853, 2966},{ 1965, 3107},{ 2079, 3254},
-        { 2190, 3390},{ 2292, 3511},{ 2384, 3637},{ 2474, 3777},
-        { 2586, 3890},{ 2684, 3997},{ 2774, 4126},{ 2901, 4310}
+        {   28,    4},{  413, 1338},{  937, 2266},{ 1536, 2841},
+        { 2131, 3261},{ 2767, 3549},{ 3388, 3728},{ 3950, 3817},
+        { 4553, 3814},{ 5158, 3864},{ 5665, 3988},{ 6008, 4053},
+        { 6618, 4190},{ 7279, 4373},{ 7628, 4429},{ 8318, 4504},
+        { 8740, 4569},{ 8698, 4523},{ 9018, 4477},{ 9032, 4486},
+        { 8778, 4233},{ 8823, 4155},{ 9279, 4304},{ 9825, 4503}
       },
       /*Cb  qi=44  INTER*/
       {
-        {  163,   43},{  170,  357},{  176,  677},{  198, 1036},
-        {  247, 1384},{  331, 1695},{  458, 1970},{  620, 2219},
-        {  800, 2452},{  990, 2671},{ 1188, 2873},{ 1393, 3060},
-        { 1611, 3231},{ 1849, 3380},{ 2103, 3515},{ 2363, 3640},
-        { 2627, 3755},{ 2892, 3861},{ 3142, 3969},{ 3387, 4089},
-        { 3645, 4194},{ 3907, 4294},{ 4163, 4378},{ 4403, 4434}
+        {   53,  -73},{  121, 1402},{  284, 2644},{  672, 3611},
+        { 1425, 4258},{ 2508, 4612},{ 3724, 4639},{ 4782, 4592},
+        { 5651, 4628},{ 6388, 4594},{ 7026, 4544},{ 7569, 4588},
+        { 8130, 4602},{ 8525, 4623},{ 9066, 4593},{ 9629, 4625},
+        {10210, 4574},{10632, 4575},{10922, 4600},{11352, 4643},
+        {11604, 4674},{11956, 4710},{12384, 4764},{12770, 4790}
       }
     },
     {
       /*Cr  qi=44  INTRA*/
       {
-        {   42,    7},{  199,  395},{  309,  779},{  409, 1157},
-        {  539, 1465},{  678, 1717},{  822, 1931},{  967, 2109},
-        { 1121, 2266},{ 1276, 2417},{ 1429, 2567},{ 1574, 2705},
-        { 1720, 2820},{ 1856, 2938},{ 1977, 3069},{ 2097, 3178},
-        { 2211, 3275},{ 2309, 3382},{ 2398, 3484},{ 2496, 3596},
-        { 2595, 3743},{ 2671, 3877},{ 2758, 4002},{ 2875, 4110}
+        {   23,    4},{  428, 1336},{  932, 2278},{ 1514, 2863},
+        { 2109, 3207},{ 2699, 3505},{ 3333, 3756},{ 3917, 3918},
+        { 4489, 4122},{ 4956, 4234},{ 5318, 4270},{ 5646, 4324},
+        { 5871, 4297},{ 6253, 4366},{ 6659, 4487},{ 7049, 4524},
+        { 7816, 4600},{ 7996, 4657},{ 7850, 4678},{ 7934, 4688},
+        { 8354, 4758},{ 8762, 4819},{ 9099, 4803},{ 9435, 4837}
       },
       /*Cr  qi=44  INTER*/
       {
-        {  147,    6},{  163,  358},{  172,  685},{  194, 1043},
-        {  244, 1387},{  320, 1698},{  425, 1989},{  570, 2256},
-        {  753, 2493},{  961, 2698},{ 1182, 2879},{ 1407, 3046},
-        { 1631, 3211},{ 1853, 3373},{ 2077, 3534},{ 2310, 3685},
-        { 2553, 3819},{ 2813, 3923},{ 3084, 3994},{ 3361, 4046},
-        { 3644, 4065},{ 3923, 4063},{ 4185, 4058},{ 4441, 4046}
+        {   38,  -88},{  128, 1400},{  288, 2639},{  687, 3614},
+        { 1484, 4235},{ 2600, 4480},{ 3722, 4440},{ 4655, 4450},
+        { 5446, 4493},{ 6114, 4495},{ 6744, 4550},{ 7230, 4467},
+        { 7565, 4396},{ 8090, 4387},{ 8614, 4378},{ 8983, 4423},
+        { 9447, 4406},{ 9910, 4388},{10374, 4370},{10823, 4339},
+        {11285, 4320},{11747, 4300},{12209, 4281},{12670, 4262}
       }
     }
   },
@@ -2848,61 +2848,61 @@
     {
       /*Y'  qi=45  INTRA*/
       {
-        {  236,   61},{  736, 1283},{ 1501, 2022},{ 2342, 2352},
-        { 3126, 2552},{ 3890, 2761},{ 4623, 3009},{ 5301, 3264},
-        { 5920, 3504},{ 6480, 3725},{ 6993, 3920},{ 7444, 4059},
-        { 7868, 4172},{ 8275, 4312},{ 8667, 4470},{ 9062, 4623},
-        { 9431, 4760},{ 9805, 4881},{10147, 4986},{10416, 5067},
-        {10678, 5143},{10958, 5229},{11247, 5318},{11586, 5474}
+        {  130,   95},{  697, 1201},{ 1469, 1971},{ 2414, 2382},
+        { 3388, 2599},{ 4279, 2768},{ 5080, 2908},{ 5810, 3027},
+        { 6474, 3130},{ 7090, 3212},{ 7680, 3276},{ 8172, 3293},
+        { 8624, 3301},{ 9114, 3335},{ 9635, 3393},{10169, 3447},
+        {10654, 3478},{11140, 3510},{11588, 3524},{11952, 3523},
+        {12332, 3510},{12745, 3506},{13183, 3507},{13726, 3477}
       },
       /*Y'  qi=45  INTER*/
       {
-        {  204,    7},{  254, 1317},{  882, 2366},{ 1798, 3150},
-        { 2820, 3763},{ 3887, 4229},{ 4965, 4483},{ 5952, 4590},
-        { 6797, 4664},{ 7528, 4728},{ 8178, 4782},{ 8770, 4830},
-        { 9316, 4876},{ 9822, 4914},{10290, 4942},{10728, 4966},
-        {11146, 4987},{11533, 5006},{11903, 5021},{12253, 5028},
-        {12568, 5022},{12870, 5020},{13147, 5017},{13358, 4994}
+        {  100,  -18},{  161, 1322},{  320, 2581},{  688, 3609},
+        { 1453, 4320},{ 2676, 4668},{ 4071, 4734},{ 5315, 4684},
+        { 6336, 4632},{ 7197, 4596},{ 7949, 4569},{ 8628, 4552},
+        { 9243, 4536},{ 9810, 4522},{10339, 4513},{10833, 4505},
+        {11298, 4495},{11747, 4488},{12178, 4488},{12569, 4485},
+        {12949, 4478},{13324, 4473},{13649, 4465},{13935, 4449}
       }
     },
     {
       /*Cb  qi=45  INTRA*/
       {
-        {   33,    3},{  201,  373},{  328,  745},{  419, 1119},
-        {  545, 1441},{  702, 1699},{  869, 1907},{ 1037, 2078},
-        { 1197, 2235},{ 1355, 2378},{ 1509, 2514},{ 1663, 2652},
-        { 1815, 2780},{ 1945, 2913},{ 2063, 3054},{ 2181, 3203},
-        { 2295, 3337},{ 2403, 3456},{ 2496, 3582},{ 2588, 3723},
-        { 2713, 3826},{ 2815, 3929},{ 2904, 4054},{ 3037, 4230}
+        {   12,   12},{  494, 1284},{ 1146, 2109},{ 1858, 2606},
+        { 2518, 3008},{ 3194, 3289},{ 3870, 3432},{ 4407, 3514},
+        { 4910, 3576},{ 5482, 3661},{ 6019, 3781},{ 6481, 3884},
+        { 7123, 4004},{ 7644, 4131},{ 7950, 4146},{ 8724, 4190},
+        { 9199, 4274},{ 9015, 4223},{ 9303, 4181},{ 9833, 4280},
+        { 9845, 4225},{ 9661, 4046},{10151, 4118},{10303, 4059}
       },
       /*Cb  qi=45  INTER*/
       {
-        {  165,   38},{  173,  355},{  181,  676},{  203, 1034},
-        {  257, 1378},{  355, 1683},{  497, 1951},{  672, 2195},
-        {  863, 2422},{ 1062, 2636},{ 1269, 2834},{ 1490, 3013},
-        { 1725, 3177},{ 1978, 3320},{ 2251, 3443},{ 2529, 3557},
-        { 2805, 3665},{ 3075, 3767},{ 3336, 3877},{ 3598, 3983},
-        { 3862, 4066},{ 4130, 4159},{ 4399, 4252},{ 4675, 4334}
+        {   61,  -86},{  120, 1397},{  297, 2624},{  734, 3561},
+        { 1593, 4152},{ 2825, 4400},{ 4074, 4395},{ 5120, 4393},
+        { 6011, 4391},{ 6765, 4373},{ 7519, 4308},{ 8070, 4303},
+        { 8563, 4350},{ 9079, 4319},{ 9450, 4326},{ 9971, 4390},
+        {10575, 4423},{11146, 4342},{11488, 4319},{11874, 4332},
+        {12017, 4370},{12521, 4380},{12933, 4372},{13355, 4374}
       }
     },
     {
       /*Cr  qi=45  INTRA*/
       {
-        {   43,    8},{  201,  395},{  313,  778},{  420, 1151},
-        {  559, 1454},{  709, 1701},{  865, 1906},{ 1024, 2076},
-        { 1187, 2228},{ 1349, 2378},{ 1507, 2528},{ 1657, 2663},
-        { 1808, 2778},{ 1945, 2898},{ 2069, 3023},{ 2194, 3124},
-        { 2308, 3217},{ 2413, 3324},{ 2509, 3425},{ 2607, 3540},
-        { 2711, 3686},{ 2794, 3810},{ 2883, 3925},{ 3017, 4008}
+        {    2,   15},{  508, 1284},{ 1173, 2085},{ 1895, 2554},
+        { 2556, 2870},{ 3200, 3152},{ 3882, 3389},{ 4493, 3550},
+        { 5112, 3699},{ 5613, 3782},{ 6061, 3837},{ 6390, 3876},
+        { 6571, 3869},{ 6994, 3930},{ 7446, 4006},{ 7766, 4071},
+        { 8623, 4224},{ 8854, 4330},{ 8670, 4223},{ 8698, 4175},
+        { 9027, 4156},{ 9929, 4191},{10221, 4227},{10647, 4220}
       },
       /*Cr  qi=45  INTER*/
       {
-        {  149,    8},{  168,  359},{  176,  685},{  199, 1042},
-        {  254, 1381},{  340, 1686},{  460, 1972},{  619, 2234},
-        {  814, 2464},{ 1032, 2664},{ 1266, 2839},{ 1505, 3000},
-        { 1745, 3157},{ 1980, 3318},{ 2214, 3475},{ 2466, 3611},
-        { 2728, 3735},{ 2999, 3829},{ 3284, 3883},{ 3574, 3919},
-        { 3864, 3921},{ 4150, 3911},{ 4408, 3915},{ 4629, 3949}
+        {   38,  -84},{  128, 1395},{  304, 2618},{  765, 3553},
+        { 1664, 4118},{ 2873, 4290},{ 4046, 4221},{ 4991, 4203},
+        { 5740, 4228},{ 6458, 4236},{ 7008, 4231},{ 7562, 4194},
+        { 8030, 4208},{ 8702, 4154},{ 9227, 4136},{ 9749, 4140},
+        {10286, 4122},{10823, 4104},{11360, 4086},{11897, 4068},
+        {12274, 4041},{12794, 4022},{13314, 4003},{13834, 3984}
       }
     }
   },
@@ -2910,61 +2910,61 @@
     {
       /*Y'  qi=46  INTRA*/
       {
-        {  234,   66},{  742, 1278},{ 1538, 2007},{ 2425, 2326},
-        { 3250, 2507},{ 4031, 2706},{ 4773, 2945},{ 5455, 3190},
-        { 6073, 3423},{ 6638, 3640},{ 7157, 3829},{ 7609, 3965},
-        { 8032, 4080},{ 8438, 4216},{ 8837, 4371},{ 9236, 4522},
-        { 9606, 4654},{ 9985, 4773},{10329, 4878},{10597, 4957},
-        {10865, 5029},{11146, 5110},{11432, 5194},{11752, 5335}
+        {  121,  100},{  690, 1215},{ 1426, 1954},{ 2415, 2227},
+        { 3373, 2336},{ 4250, 2473},{ 5106, 2613},{ 5913, 2731},
+        { 6664, 2835},{ 7366, 2925},{ 8025, 2999},{ 8613, 3041},
+        { 9141, 3068},{ 9655, 3109},{10176, 3165},{10685, 3219},
+        {11141, 3256},{11594, 3278},{12019, 3289},{12393, 3289},
+        {12765, 3288},{13114, 3298},{13471, 3310},{13917, 3317}
       },
       /*Y'  qi=46  INTER*/
       {
-        {  199,    9},{  270, 1313},{ 1002, 2320},{ 2024, 3067},
-        { 3120, 3660},{ 4247, 4085},{ 5356, 4290},{ 6339, 4383},
-        { 7175, 4460},{ 7906, 4525},{ 8560, 4577},{ 9159, 4626},
-        { 9711, 4671},{10224, 4705},{10707, 4737},{11164, 4767},
-        {11593, 4792},{12000, 4814},{12382, 4832},{12739, 4844},
-        {13074, 4848},{13379, 4846},{13661, 4844},{13914, 4841}
+        {   92,    2},{  157, 1312},{  424, 2499},{  834, 3519},
+        { 1686, 4196},{ 3006, 4495},{ 4416, 4536},{ 5622, 4494},
+        { 6606, 4464},{ 7448, 4442},{ 8195, 4419},{ 8867, 4406},
+        { 9482, 4393},{10052, 4381},{10576, 4373},{11073, 4363},
+        {11539, 4351},{11985, 4343},{12414, 4341},{12810, 4338},
+        {13190, 4336},{13559, 4329},{13879, 4321},{14147, 4321}
       }
     },
     {
       /*Cb  qi=46  INTRA*/
       {
-        {   27,    2},{  202,  373},{  334,  744},{  431, 1108},
-        {  566, 1418},{  729, 1667},{  901, 1869},{ 1075, 2036},
-        { 1239, 2192},{ 1395, 2340},{ 1548, 2481},{ 1707, 2617},
-        { 1863, 2744},{ 1993, 2880},{ 2112, 3021},{ 2230, 3166},
-        { 2344, 3298},{ 2455, 3416},{ 2551, 3539},{ 2641, 3676},
-        { 2760, 3784},{ 2866, 3886},{ 2965, 4005},{ 3115, 4174}
+        {   42,   52},{  589, 1299},{ 1281, 2082},{ 1952, 2606},
+        { 2565, 3002},{ 3216, 3276},{ 3911, 3437},{ 4537, 3549},
+        { 5077, 3644},{ 5600, 3738},{ 6131, 3852},{ 6611, 3949},
+        { 7212, 4047},{ 7728, 4153},{ 8088, 4177},{ 8710, 4218},
+        { 9171, 4257},{ 9191, 4227},{ 9360, 4194},{ 9770, 4222},
+        { 9868, 4174},{10105, 4160},{10226, 4228},{10492, 4323}
       },
       /*Cb  qi=46  INTER*/
       {
-        {  171,    7},{  176,  356},{  185,  677},{  213, 1030},
-        {  279, 1366},{  398, 1663},{  568, 1921},{  769, 2154},
-        {  982, 2372},{ 1207, 2574},{ 1444, 2758},{ 1694, 2925},
-        { 1963, 3073},{ 2245, 3204},{ 2539, 3322},{ 2835, 3431},
-        { 3128, 3529},{ 3411, 3623},{ 3690, 3731},{ 3966, 3827},
-        { 4241, 3909},{ 4523, 3995},{ 4803, 4082},{ 5080, 4164}
+        {   31,   -7},{  165, 1349},{  697, 2384},{ 1331, 3280},
+        { 1817, 4034},{ 3104, 4254},{ 4341, 4248},{ 4220, 5536},
+        { 4411, 6439},{ 5470, 6253},{ 6473, 5917},{ 7272, 5593},
+        { 7848, 5414},{ 8433, 5299},{ 9015, 5172},{ 9495, 5194},
+        {10179, 5231},{10638, 5189},{11036, 5269},{11471, 5305},
+        {11817, 5267},{12506, 5161},{12972, 5121},{13471, 5096}
       }
     },
     {
       /*Cr  qi=46  INTRA*/
       {
-        {   35,    6},{  200,  393},{  319,  775},{  434, 1137},
-        {  581, 1427},{  737, 1664},{  901, 1862},{ 1066, 2030},
-        { 1235, 2181},{ 1397, 2333},{ 1554, 2486},{ 1705, 2625},
-        { 1858, 2738},{ 1995, 2861},{ 2115, 2991},{ 2238, 3092},
-        { 2354, 3186},{ 2462, 3294},{ 2560, 3392},{ 2662, 3500},
-        { 2773, 3643},{ 2859, 3769},{ 2948, 3883},{ 3085, 3977}
+        {   35,   82},{  608, 1291},{ 1246, 2101},{ 1915, 2608},
+        { 2568, 2914},{ 3228, 3147},{ 3903, 3354},{ 4495, 3520},
+        { 5069, 3682},{ 5554, 3783},{ 6012, 3849},{ 6378, 3928},
+        { 6618, 3954},{ 6999, 4009},{ 7330, 4101},{ 7574, 4176},
+        { 8396, 4272},{ 8736, 4327},{ 8515, 4310},{ 8817, 4340},
+        { 9061, 4377},{ 9638, 4443},{ 9915, 4458},{10295, 4474}
       },
       /*Cr  qi=46  INTER*/
       {
-        {  160,    8},{  168,  359},{  180,  684},{  209, 1037},
-        {  277, 1370},{  382, 1667},{  525, 1942},{  712, 2192},
-        {  935, 2409},{ 1184, 2594},{ 1448, 2756},{ 1712, 2911},
-        { 1971, 3066},{ 2228, 3219},{ 2487, 3368},{ 2758, 3498},
-        { 3045, 3602},{ 3343, 3678},{ 3651, 3720},{ 3952, 3738},
-        { 4248, 3740},{ 4530, 3728},{ 4791, 3728},{ 5043, 3721}
+        {   20,   -3},{  177, 1341},{  674, 2405},{ 1291, 3299},
+        { 1891, 3995},{ 3128, 4140},{ 4246, 4101},{ 4420, 5135},
+        { 4770, 5779},{ 5618, 5589},{ 6361, 5451},{ 7040, 5362},
+        { 7655, 5218},{ 8203, 5121},{ 8663, 5095},{ 9194, 5102},
+        { 9368, 5309},{ 9860, 5348},{10195, 5416},{10577, 5513},
+        {10969, 5404},{11245, 5493},{11687, 5472},{12078, 5507}
       }
     }
   },
@@ -2972,61 +2972,61 @@
     {
       /*Y'  qi=47  INTRA*/
       {
-        {  220,   69},{  768, 1271},{ 1601, 1990},{ 2516, 2299},
-        { 3361, 2472},{ 4163, 2661},{ 4926, 2886},{ 5628, 3119},
-        { 6264, 3342},{ 6844, 3546},{ 7378, 3724},{ 7843, 3857},
-        { 8275, 3965},{ 8692, 4095},{ 9104, 4244},{ 9513, 4387},
-        { 9892, 4512},{10280, 4626},{10630, 4723},{10908, 4796},
-        {11191, 4862},{11477, 4938},{11764, 5015},{12113, 5150}
+        {  108,  113},{  802, 1168},{ 1714, 1865},{ 2770, 2226},
+        { 3820, 2414},{ 4747, 2571},{ 5571, 2698},{ 6325, 2800},
+        { 6999, 2877},{ 7624, 2937},{ 8222, 2987},{ 8702, 2992},
+        { 9150, 2997},{ 9638, 3024},{10161, 3076},{10675, 3158},
+        {11069, 3239},{11470, 3298},{11898, 3323},{12252, 3329},
+        {12631, 3321},{13045, 3333},{13485, 3341},{14057, 3337}
       },
       /*Y'  qi=47  INTER*/
       {
-        {  200,    9},{  275, 1312},{ 1023, 2314},{ 2069, 3048},
-        { 3200, 3622},{ 4364, 4013},{ 5491, 4189},{ 6477, 4272},
-        { 7317, 4342},{ 8051, 4400},{ 8711, 4448},{ 9318, 4494},
-        { 9878, 4533},{10399, 4565},{10882, 4594},{11344, 4621},
-        {11780, 4643},{12185, 4662},{12571, 4674},{12934, 4687},
-        {13269, 4691},{13579, 4692},{13874, 4695},{14155, 4701}
+        {   96,  -15},{  163, 1315},{  378, 2531},{  899, 3480},
+        { 1928, 4071},{ 3376, 4300},{ 4831, 4297},{ 6038, 4246},
+        { 7026, 4213},{ 7873, 4185},{ 8625, 4161},{ 9308, 4141},
+        { 9932, 4126},{10512, 4113},{11047, 4102},{11548, 4091},
+        {12030, 4081},{12491, 4074},{12928, 4069},{13334, 4063},
+        {13709, 4058},{14061, 4053},{14365, 4046},{14571, 4035}
       }
     },
     {
       /*Cb  qi=47  INTRA*/
       {
-        {   37,    3},{  207,  374},{  335,  743},{  434, 1106},
-        {  573, 1412},{  740, 1657},{  915, 1855},{ 1091, 2020},
-        { 1256, 2175},{ 1415, 2321},{ 1570, 2460},{ 1729, 2593},
-        { 1888, 2718},{ 2021, 2853},{ 2141, 2991},{ 2263, 3132},
-        { 2380, 3263},{ 2493, 3381},{ 2594, 3498},{ 2691, 3630},
-        { 2807, 3735},{ 2908, 3831},{ 3011, 3940},{ 3173, 4090}
+        {   23,   19},{  519, 1276},{ 1203, 2081},{ 1948, 2561},
+        { 2663, 2913},{ 3432, 3144},{ 4114, 3291},{ 4640, 3415},
+        { 5189, 3490},{ 5758, 3558},{ 6350, 3653},{ 6824, 3717},
+        { 7415, 3794},{ 7948, 3909},{ 8250, 3943},{ 8959, 3962},
+        { 9413, 3987},{ 9350, 3988},{ 9689, 3971},{10469, 3998},
+        {10606, 3952},{10626, 3891},{10991, 3973},{11471, 4055}
       },
       /*Cb  qi=47  INTER*/
       {
-        {  171,   40},{  179,  357},{  188,  678},{  215, 1029},
-        {  285, 1365},{  410, 1659},{  587, 1915},{  791, 2146},
-        { 1005, 2363},{ 1229, 2563},{ 1471, 2744},{ 1729, 2908},
-        { 2005, 3052},{ 2296, 3181},{ 2596, 3295},{ 2901, 3399},
-        { 3200, 3495},{ 3491, 3587},{ 3784, 3693},{ 4066, 3780},
-        { 4349, 3848},{ 4639, 3928},{ 4922, 4000},{ 5202, 4037}
+        {   53,  -73},{  124, 1385},{  380, 2552},{  989, 3395},
+        { 2085, 3855},{ 3449, 3957},{ 4016, 4631},{ 4138, 5700},
+        { 4955, 5972},{ 6020, 5740},{ 6917, 5468},{ 7684, 5200},
+        { 8313, 5036},{ 8862, 4919},{ 9432, 4806},{10061, 4752},
+        {10718, 4734},{11364, 4706},{11565, 4746},{11857, 4741},
+        {12152, 4724},{12728, 4672},{12856, 4670},{13196, 4653}
       }
     },
     {
       /*Cr  qi=47  INTRA*/
       {
-        {   48,    8},{  206,  395},{  321,  775},{  438, 1134},
-        {  588, 1420},{  748, 1654},{  914, 1850},{ 1081, 2016},
-        { 1250, 2166},{ 1416, 2315},{ 1576, 2466},{ 1727, 2603},
-        { 1884, 2713},{ 2023, 2833},{ 2143, 2960},{ 2272, 3059},
-        { 2394, 3149},{ 2502, 3253},{ 2601, 3350},{ 2703, 3454},
-        { 2818, 3592},{ 2908, 3719},{ 2997, 3828},{ 3151, 3903}
+        {    6,   27},{  532, 1271},{ 1217, 2066},{ 1970, 2521},
+        { 2661, 2808},{ 3370, 3041},{ 4111, 3243},{ 4763, 3392},
+        { 5431, 3527},{ 5913, 3601},{ 6316, 3627},{ 6632, 3652},
+        { 6815, 3638},{ 7250, 3680},{ 7666, 3781},{ 7986, 3879},
+        { 9135, 3983},{ 9622, 4001},{ 9077, 3939},{ 9257, 3965},
+        { 9546, 4015},{10065, 4055},{10310, 4095},{10622, 4132}
       },
       /*Cr  qi=47  INTER*/
       {
-        {  159,    8},{  169,  360},{  182,  684},{  211, 1036},
-        {  282, 1367},{  394, 1663},{  544, 1936},{  734, 2185},
-        {  958, 2400},{ 1207, 2583},{ 1472, 2744},{ 1742, 2897},
-        { 2010, 3049},{ 2275, 3199},{ 2542, 3345},{ 2823, 3470},
-        { 3122, 3565},{ 3429, 3632},{ 3740, 3672},{ 4049, 3682},
-        { 4353, 3675},{ 4629, 3678},{ 4871, 3679},{ 5116, 3695}
+        {   50,  -79},{  136, 1380},{  384, 2549},{ 1019, 3397},
+        { 2138, 3844},{ 3468, 3889},{ 4110, 4429},{ 4402, 5271},
+        { 5173, 5321},{ 6059, 5106},{ 6824, 4970},{ 7487, 4843},
+        { 8054, 4656},{ 8615, 4556},{ 9358, 4417},{ 9695, 4365},
+        {10061, 4388},{10433, 4350},{10823, 4386},{11048, 4466},
+        {11503, 4549},{11883, 4603},{12230, 4630},{12606, 4650}
       }
     }
   },
@@ -3034,61 +3034,61 @@
     {
       /*Y'  qi=48  INTRA*/
       {
-        {  198,   77},{  796, 1266},{ 1666, 1983},{ 2615, 2290},
-        { 3492, 2446},{ 4314, 2616},{ 5095, 2823},{ 5816, 3036},
-        { 6468, 3241},{ 7061, 3433},{ 7609, 3601},{ 8085, 3724},
-        { 8523, 3823},{ 8950, 3945},{ 9373, 4086},{ 9788, 4223},
-        {10177, 4339},{10574, 4442},{10932, 4528},{11215, 4591},
-        {11491, 4649},{11779, 4718},{12081, 4786},{12431, 4903}
+        {  120,  101},{  719, 1212},{ 1566, 1940},{ 2716, 2175},
+        { 3791, 2251},{ 4725, 2370},{ 5594, 2489},{ 6414, 2586},
+        { 7175, 2668},{ 7876, 2736},{ 8537, 2791},{ 9100, 2818},
+        { 9607, 2837},{10122, 2866},{10668, 2910},{11217, 2956},
+        {11696, 2987},{12168, 3008},{12603, 3021},{12959, 3021},
+        {13329, 3017},{13703, 3027},{14082, 3033},{14579, 3034}
       },
       /*Y'  qi=48  INTER*/
       {
-        {  188,   17},{  276, 1313},{ 1090, 2296},{ 2224, 2999},
-        { 3439, 3536},{ 4663, 3879},{ 5813, 4018},{ 6802, 4091},
-        { 7650, 4156},{ 8397, 4209},{ 9071, 4255},{ 9691, 4297},
-        {10259, 4331},{10790, 4359},{11284, 4386},{11746, 4411},
-        {12184, 4428},{12599, 4444},{12985, 4456},{13337, 4464},
-        {13680, 4467},{14000, 4461},{14282, 4452},{14545, 4435}
+        {   95,   -1},{  166, 1305},{  430, 2491},{  926, 3464},
+        { 1994, 4037},{ 3477, 4247},{ 4936, 4239},{ 6137, 4190},
+        { 7128, 4156},{ 7983, 4127},{ 8743, 4104},{ 9435, 4089},
+        {10068, 4076},{10659, 4063},{11206, 4053},{11711, 4043},
+        {12196, 4032},{12656, 4027},{13099, 4026},{13507, 4021},
+        {13890, 4017},{14265, 4011},{14600, 4004},{14928, 3994}
       }
     },
     {
       /*Cb  qi=48  INTRA*/
       {
-        {   35,    3},{  211,  373},{  345,  741},{  456, 1099},
-        {  610, 1402},{  791, 1640},{  978, 1831},{ 1164, 1992},
-        { 1336, 2145},{ 1502, 2290},{ 1664, 2426},{ 1833, 2553},
-        { 2000, 2670},{ 2148, 2799},{ 2279, 2931},{ 2403, 3067},
-        { 2531, 3192},{ 2649, 3308},{ 2755, 3419},{ 2860, 3542},
-        { 2982, 3645},{ 3084, 3740},{ 3181, 3845},{ 3354, 3966}
+        {   17,   50},{  633, 1259},{ 1418, 1992},{ 2202, 2444},
+        { 2895, 2795},{ 3637, 3039},{ 4387, 3176},{ 5003, 3288},
+        { 5564, 3391},{ 6123, 3455},{ 6696, 3538},{ 7196, 3628},
+        { 7835, 3720},{ 8377, 3816},{ 8703, 3835},{ 9436, 3863},
+        { 9953, 3899},{ 9820, 3903},{ 9919, 3877},{10362, 3920},
+        {10560, 3896},{10540, 3841},{10810, 3879},{10933, 3859}
       },
       /*Cb  qi=48  INTER*/
       {
-        {  177,   56},{  187,  367},{  194,  680},{  222, 1026},
-        {  296, 1356},{  431, 1644},{  622, 1894},{  843, 2120},
-        { 1075, 2329},{ 1320, 2523},{ 1583, 2698},{ 1867, 2851},
-        { 2169, 2985},{ 2479, 3107},{ 2797, 3218},{ 3116, 3314},
-        { 3429, 3405},{ 3739, 3495},{ 4045, 3576},{ 4338, 3661},
-        { 4629, 3739},{ 4934, 3799},{ 5236, 3853},{ 5497, 3900}
+        {   19,   -1},{  172, 1341},{  685, 2387},{ 1084, 3351},
+        { 2116, 3874},{ 3515, 4017},{ 4035, 4747},{ 4199, 5753},
+        { 5151, 5873},{ 6234, 5621},{ 7140, 5341},{ 7919, 5117},
+        { 8526, 4981},{ 9126, 4911},{ 9650, 4848},{10114, 4813},
+        {10833, 4817},{11448, 4789},{11962, 4860},{12388, 4867},
+        {12726, 4886},{13381, 4925},{13645, 4928},{14071, 4956}
       }
     },
     {
       /*Cr  qi=48  INTRA*/
       {
-        {   45,    7},{  210,  392},{  333,  770},{  464, 1125},
-        {  627, 1411},{  798, 1644},{  975, 1834},{ 1152, 1992},
-        { 1333, 2135},{ 1511, 2277},{ 1684, 2421},{ 1845, 2553},
-        { 2004, 2662},{ 2150, 2778},{ 2285, 2898},{ 2422, 2988},
-        { 2547, 3071},{ 2660, 3172},{ 2765, 3270},{ 2873, 3369},
-        { 2988, 3498},{ 3082, 3621},{ 3180, 3725},{ 3302, 3813}
+        {   10,   78},{  659, 1249},{ 1419, 1986},{ 2180, 2432},
+        { 2865, 2727},{ 3554, 2965},{ 4303, 3158},{ 4972, 3293},
+        { 5606, 3412},{ 6138, 3497},{ 6645, 3566},{ 7062, 3617},
+        { 7304, 3628},{ 7696, 3670},{ 8064, 3732},{ 8318, 3797},
+        { 9262, 3914},{ 9635, 3946},{ 9257, 3858},{ 9546, 3882},
+        { 9893, 3940},{10422, 3978},{10649, 4043},{10987, 4091}
       },
       /*Cr  qi=48  INTER*/
       {
-        {  158,   13},{  174,  367},{  183,  688},{  214, 1035},
-        {  292, 1359},{  413, 1648},{  577, 1916},{  781, 2160},
-        { 1019, 2373},{ 1288, 2550},{ 1578, 2703},{ 1872, 2847},
-        { 2163, 2991},{ 2450, 3133},{ 2738, 3265},{ 3041, 3381},
-        { 3364, 3465},{ 3693, 3512},{ 4019, 3535},{ 4330, 3547},
-        { 4630, 3537},{ 4902, 3535},{ 5158, 3535},{ 5402, 3514}
+        {   11,    1},{  187, 1333},{  650, 2415},{ 1139, 3335},
+        { 2171, 3839},{ 3555, 3899},{ 4182, 4486},{ 4484, 5297},
+        { 5362, 5270},{ 6229, 5102},{ 6985, 5003},{ 7643, 4937},
+        { 8197, 4862},{ 8797, 4877},{ 9475, 4812},{ 9902, 4853},
+        {10310, 4888},{10891, 4934},{11217, 5043},{11719, 4954},
+        {12114, 4979},{12652, 5015},{13004, 4969},{13469, 4983}
       }
     }
   },
@@ -3096,61 +3096,61 @@
     {
       /*Y'  qi=49  INTRA*/
       {
-        {  199,   78},{  799, 1265},{ 1680, 1978},{ 2646, 2277},
-        { 3534, 2424},{ 4361, 2584},{ 5146, 2780},{ 5871, 2985},
-        { 6528, 3183},{ 7126, 3365},{ 7677, 3528},{ 8159, 3647},
-        { 8598, 3744},{ 9026, 3863},{ 9456, 3998},{ 9880, 4130},
-        {10274, 4242},{10674, 4345},{11036, 4430},{11321, 4487},
-        {11601, 4540},{11894, 4606},{12197, 4671},{12539, 4771}
+        {  127,  107},{  763, 1202},{ 1618, 1970},{ 2867, 2217},
+        { 4016, 2271},{ 4948, 2369},{ 5701, 2444},{ 6400, 2517},
+        { 7145, 2614},{ 7844, 2701},{ 8492, 2774},{ 9048, 2819},
+        { 9564, 2851},{10090, 2892},{10623, 2949},{11160, 3019},
+        {11622, 3075},{12056, 3100},{12474, 3110},{12827, 3115},
+        {13177, 3115},{13516, 3125},{13865, 3136},{14286, 3143}
       },
       /*Y'  qi=49  INTER*/
       {
-        {  178,   20},{  286, 1311},{ 1143, 2277},{ 2322, 2960},
-        { 3585, 3471},{ 4845, 3781},{ 6005, 3901},{ 6994, 3969},
-        { 7844, 4029},{ 8595, 4078},{ 9276, 4119},{ 9903, 4159},
-        {10478, 4192},{11015, 4220},{11516, 4244},{11993, 4265},
-        {12437, 4286},{12855, 4304},{13245, 4315},{13605, 4323},
-        {13951, 4327},{14265, 4323},{14553, 4318},{14827, 4314}
+        {   81,    6},{  170, 1302},{  526, 2440},{ 1109, 3372},
+        { 2297, 3899},{ 3841, 4077},{ 5271, 4071},{ 6435, 4038},
+        { 7407, 4014},{ 8247, 3997},{ 8994, 3985},{ 9676, 3977},
+        {10301, 3970},{10879, 3964},{11419, 3960},{11922, 3955},
+        {12401, 3948},{12860, 3943},{13295, 3941},{13705, 3942},
+        {14084, 3941},{14444, 3938},{14781, 3936},{15105, 3936}
       }
     },
     {
       /*Cb  qi=49  INTRA*/
       {
-        {   41,    3},{  227,  373},{  367,  741},{  481, 1097},
-        {  638, 1398},{  820, 1635},{ 1008, 1826},{ 1196, 1986},
-        { 1369, 2139},{ 1536, 2283},{ 1699, 2419},{ 1869, 2542},
-        { 2038, 2658},{ 2187, 2786},{ 2321, 2917},{ 2447, 3052},
-        { 2572, 3174},{ 2694, 3284},{ 2799, 3398},{ 2907, 3523},
-        { 3036, 3620},{ 3139, 3710},{ 3237, 3811},{ 3406, 3934}
+        {   32,   70},{  670, 1254},{ 1463, 1973},{ 2249, 2430},
+        { 2960, 2776},{ 3689, 3027},{ 4422, 3195},{ 5018, 3351},
+        { 5532, 3457},{ 6156, 3569},{ 6810, 3694},{ 7202, 3748},
+        { 7837, 3837},{ 8509, 3980},{ 8831, 4007},{ 9436, 4043},
+        { 9983, 4103},{10140, 4101},{10334, 4081},{10643, 4122},
+        {10622, 4086},{10871, 4066},{11356, 4137},{12004, 4251}
       },
       /*Cb  qi=49  INTER*/
       {
-        {  178,   60},{  189,  368},{  198,  680},{  226, 1025},
-        {  307, 1352},{  453, 1637},{  656, 1884},{  882, 2107},
-        { 1117, 2313},{ 1373, 2500},{ 1650, 2668},{ 1946, 2817},
-        { 2259, 2946},{ 2580, 3062},{ 2910, 3169},{ 3242, 3264},
-        { 3568, 3350},{ 3883, 3435},{ 4196, 3515},{ 4506, 3585},
-        { 4817, 3651},{ 5134, 3716},{ 5414, 3767},{ 5657, 3799}
+        {    1,   13},{  195, 1327},{  795, 2339},{ 1255, 3267},
+        { 2393, 3754},{ 3858, 3849},{ 3962, 4920},{ 4514, 5510},
+        { 5683, 5387},{ 6732, 5152},{ 7578, 4918},{ 8297, 4750},
+        { 8895, 4661},{ 9440, 4581},{10004, 4523},{10561, 4576},
+        {11120, 4637},{11802, 4671},{12227, 4645},{12576, 4626},
+        {12998, 4673},{13577, 4683},{14073, 4720},{14585, 4751}
       }
     },
     {
       /*Cr  qi=49  INTRA*/
       {
-        {   54,    7},{  226,  394},{  354,  771},{  488, 1124},
-        {  654, 1408},{  826, 1639},{ 1006, 1828},{ 1185, 1985},
-        { 1366, 2129},{ 1543, 2269},{ 1718, 2412},{ 1881, 2544},
-        { 2039, 2650},{ 2188, 2762},{ 2327, 2879},{ 2463, 2971},
-        { 2583, 3055},{ 2698, 3156},{ 2807, 3252},{ 2920, 3346},
-        { 3039, 3470},{ 3137, 3591},{ 3234, 3695},{ 3355, 3773}
+        {   25,  103},{  703, 1239},{ 1507, 1945},{ 2266, 2397},
+        { 2940, 2706},{ 3614, 2957},{ 4303, 3184},{ 4922, 3358},
+        { 5531, 3504},{ 6071, 3592},{ 6583, 3660},{ 6989, 3733},
+        { 7233, 3752},{ 7591, 3795},{ 7934, 3883},{ 8193, 3990},
+        { 9152, 4114},{ 9625, 4120},{ 9294, 4050},{ 9544, 4089},
+        { 9791, 4151},{10459, 4195},{10755, 4233},{11193, 4273}
       },
       /*Cr  qi=49  INTER*/
       {
-        {  170,   13},{  178,  368},{  186,  688},{  219, 1033},
-        {  301, 1355},{  434, 1642},{  609, 1906},{  820, 2147},
-        { 1065, 2353},{ 1343, 2524},{ 1644, 2672},{ 1953, 2813},
-        { 2252, 2953},{ 2547, 3093},{ 2856, 3217},{ 3178, 3318},
-        { 3509, 3394},{ 3841, 3441},{ 4170, 3455},{ 4490, 3460},
-        { 4794, 3463},{ 5069, 3459},{ 5317, 3465},{ 5535, 3515}
+        {   -8,   17},{  211, 1318},{  749, 2373},{ 1313, 3252},
+        { 2471, 3696},{ 3844, 3743},{ 4054, 4731},{ 4681, 5100},
+        { 5682, 4933},{ 6543, 4808},{ 7315, 4695},{ 7965, 4626},
+        { 8553, 4601},{ 9027, 4559},{ 9576, 4493},{ 9827, 4608},
+        {10326, 4673},{10746, 4702},{11251, 4697},{11664, 4709},
+        {12014, 4761},{12547, 4765},{12988, 4789},{13429, 4813}
       }
     }
   },
@@ -3158,61 +3158,61 @@
     {
       /*Y'  qi=50  INTRA*/
       {
-        {  189,   84},{  816, 1259},{ 1758, 1962},{ 2799, 2241},
-        { 3735, 2370},{ 4584, 2527},{ 5384, 2716},{ 6117, 2907},
-        { 6781, 3091},{ 7387, 3264},{ 7944, 3416},{ 8430, 3527},
-        { 8873, 3619},{ 9303, 3729},{ 9744, 3856},{10179, 3981},
-        {10578, 4088},{10985, 4183},{11348, 4259},{11640, 4311},
-        {11930, 4363},{12228, 4425},{12541, 4484},{12905, 4581}
+        {  101,  127},{  849, 1173},{ 1833, 1891},{ 3150, 2085},
+        { 4307, 2134},{ 5292, 2251},{ 6184, 2373},{ 6995, 2473},
+        { 7728, 2559},{ 8378, 2637},{ 8966, 2701},{ 9457, 2727},
+        { 9937, 2743},{10453, 2778},{10993, 2830},{11537, 2888},
+        {12015, 2931},{12493, 2957},{12941, 2969},{13289, 2972},
+        {13650, 2971},{14042, 2981},{14437, 2989},{14939, 3001}
       },
       /*Y'  qi=50  INTER*/
       {
-        {  162,   24},{  316, 1305},{ 1302, 2227},{ 2595, 2882},
-        { 3947, 3364},{ 5262, 3617},{ 6426, 3712},{ 7407, 3782},
-        { 8257, 3843},{ 9011, 3889},{ 9698, 3930},{10329, 3966},
-        {10911, 3997},{11456, 4025},{11962, 4048},{12437, 4069},
-        {12885, 4085},{13308, 4100},{13708, 4114},{14077, 4122},
-        {14414, 4126},{14740, 4127},{15029, 4125},{15307, 4117}
+        {   83,    7},{  200, 1287},{  551, 2425},{ 1280, 3289},
+        { 2690, 3717},{ 4361, 3815},{ 5816, 3772},{ 6982, 3735},
+        { 7960, 3711},{ 8817, 3692},{ 9586, 3677},{10292, 3663},
+        {10940, 3652},{11540, 3647},{12094, 3643},{12609, 3638},
+        {13100, 3632},{13575, 3630},{14025, 3627},{14442, 3624},
+        {14841, 3626},{15222, 3623},{15563, 3618},{15840, 3618}
       }
     },
     {
       /*Cb  qi=50  INTRA*/
       {
-        {   42,    3},{  233,  374},{  376,  739},{  497, 1086},
-        {  665, 1374},{  855, 1601},{ 1051, 1784},{ 1249, 1938},
-        { 1431, 2088},{ 1599, 2235},{ 1764, 2373},{ 1938, 2495},
-        { 2113, 2606},{ 2270, 2726},{ 2410, 2853},{ 2538, 2985},
-        { 2667, 3105},{ 2795, 3211},{ 2899, 3320},{ 3009, 3440},
-        { 3136, 3532},{ 3244, 3620},{ 3354, 3712},{ 3506, 3807}
+        {   33,   58},{  660, 1242},{ 1500, 1948},{ 2338, 2379},
+        { 3071, 2717},{ 3860, 2938},{ 4620, 3068},{ 5143, 3186},
+        { 5621, 3292},{ 6281, 3405},{ 6979, 3503},{ 7459, 3560},
+        { 8135, 3640},{ 8786, 3788},{ 8967, 3818},{ 9672, 3844},
+        {10380, 3904},{10321, 3891},{10426, 3860},{10845, 3919},
+        {10933, 3877},{11260, 3784},{11824, 3849},{12529, 3922}
       },
       /*Cb  qi=50  INTER*/
       {
-        {  177,   58},{  191,  368},{  204,  680},{  245, 1019},
-        {  347, 1338},{  524, 1613},{  760, 1848},{ 1015, 2058},
-        { 1277, 2252},{ 1563, 2429},{ 1875, 2585},{ 2206, 2724},
-        { 2548, 2846},{ 2895, 2954},{ 3242, 3050},{ 3588, 3137},
-        { 3932, 3212},{ 4272, 3279},{ 4590, 3361},{ 4903, 3430},
-        { 5225, 3476},{ 5529, 3526},{ 5816, 3566},{ 6057, 3612}
+        {  -21,   20},{  226, 1307},{  697, 2379},{ 1344, 3225},
+        { 2767, 3571},{ 4344, 3584},{ 4679, 4474},{ 4972, 5318},
+        { 6129, 5226},{ 7200, 4993},{ 8057, 4758},{ 8810, 4579},
+        { 9471, 4468},{10014, 4393},{10613, 4358},{11154, 4343},
+        {11796, 4335},{12435, 4303},{12908, 4343},{13450, 4303},
+        {13816, 4426},{14328, 4399},{14683, 4454},{15136, 4485}
       }
     },
     {
       /*Cr  qi=50  INTRA*/
       {
-        {   54,    7},{  230,  394},{  362,  767},{  505, 1109},
-        {  678, 1382},{  859, 1603},{ 1049, 1782},{ 1240, 1934},
-        { 1429, 2076},{ 1613, 2217},{ 1790, 2359},{ 1955, 2489},
-        { 2114, 2597},{ 2263, 2709},{ 2408, 2821},{ 2554, 2905},
-        { 2680, 2982},{ 2799, 3081},{ 2907, 3178},{ 3015, 3265},
-        { 3145, 3384},{ 3251, 3508},{ 3349, 3609},{ 3474, 3679}
+        {   18,   76},{  684, 1228},{ 1494, 1931},{ 2293, 2358},
+        { 3013, 2638},{ 3737, 2866},{ 4482, 3065},{ 5146, 3230},
+        { 5760, 3352},{ 6294, 3424},{ 6882, 3505},{ 7284, 3552},
+        { 7434, 3517},{ 7657, 3539},{ 8120, 3634},{ 8580, 3787},
+        { 9596, 3928},{10000, 3923},{ 9440, 3773},{ 9723, 3789},
+        {10123, 3868},{10683, 3913},{10903, 3918},{11259, 3945}
       },
       /*Cr  qi=50  INTER*/
       {
-        {  165,   13},{  181,  369},{  191,  687},{  237, 1027},
-        {  343, 1340},{  505, 1617},{  707, 1871},{  945, 2101},
-        { 1221, 2294},{ 1534, 2454},{ 1867, 2594},{ 2198, 2732},
-        { 2522, 2869},{ 2851, 2999},{ 3179, 3114},{ 3526, 3196},
-        { 3887, 3248},{ 4235, 3272},{ 4564, 3277},{ 4880, 3273},
-        { 5179, 3269},{ 5427, 3277},{ 5666, 3261},{ 5927, 3230}
+        {  -28,   19},{  234, 1304},{  680, 2389},{ 1395, 3211},
+        { 2824, 3526},{ 4309, 3499},{ 4748, 4258},{ 5152, 4896},
+        { 6161, 4727},{ 7032, 4625},{ 7812, 4559},{ 8471, 4488},
+        { 8991, 4402},{ 9577, 4336},{10171, 4313},{10739, 4283},
+        {11212, 4352},{11734, 4405},{12193, 4464},{12651, 4448},
+        {13172, 4511},{13584, 4549},{14075, 4577},{14578, 4602}
       }
     }
   },
@@ -3220,61 +3220,61 @@
     {
       /*Y'  qi=51  INTRA*/
       {
-        {  177,   88},{  843, 1254},{ 1819, 1948},{ 2894, 2216},
-        { 3850, 2334},{ 4717, 2482},{ 5531, 2659},{ 6276, 2837},
-        { 6951, 3012},{ 7570, 3175},{ 8137, 3319},{ 8632, 3423},
-        { 9083, 3513},{ 9518, 3625},{ 9965, 3746},{10404, 3864},
-        {10807, 3967},{11222, 4056},{11593, 4134},{11886, 4187},
-        {12178, 4232},{12481, 4291},{12801, 4351},{13171, 4448}
+        {  144,  105},{  824, 1197},{ 1891, 1872},{ 3198, 2028},
+        { 4261, 2072},{ 5192, 2187},{ 6019, 2309},{ 6771, 2445},
+        { 7614, 2621},{ 8393, 2759},{ 8992, 2827},{ 9474, 2849},
+        { 9933, 2865},{10438, 2904},{10984, 2962},{11540, 3030},
+        {12021, 3077},{12519, 3112},{12981, 3134},{13332, 3144},
+        {13676, 3150},{14068, 3170},{14532, 3183},{15097, 3189}
       },
       /*Y'  qi=51  INTER*/
       {
-        {  154,   27},{  327, 1302},{ 1401, 2196},{ 2781, 2825},
-        { 4202, 3268},{ 5558, 3479},{ 6732, 3559},{ 7722, 3622},
-        { 8584, 3678},{ 9352, 3722},{10049, 3758},{10691, 3791},
-        {11284, 3821},{11839, 3848},{12353, 3870},{12840, 3890},
-        {13299, 3909},{13730, 3923},{14142, 3936},{14503, 3942},
-        {14857, 3948},{15199, 3952},{15475, 3946},{15738, 3942}
+        {   73,   14},{  220, 1279},{  654, 2379},{ 1563, 3173},
+        { 3115, 3551},{ 4787, 3633},{ 6168, 3620},{ 7288, 3608},
+        { 8248, 3596},{ 9086, 3589},{ 9842, 3585},{10539, 3583},
+        {11175, 3579},{11765, 3576},{12314, 3572},{12836, 3568},
+        {13331, 3566},{13807, 3566},{14252, 3566},{14659, 3567},
+        {15056, 3567},{15432, 3565},{15759, 3564},{15997, 3563}
       }
     },
     {
       /*Cb  qi=51  INTRA*/
       {
-        {   43,    3},{  236,  374},{  382,  737},{  510, 1079},
-        {  686, 1360},{  884, 1581},{ 1087, 1759},{ 1292, 1909},
-        { 1478, 2057},{ 1648, 2206},{ 1815, 2344},{ 1992, 2464},
-        { 2169, 2570},{ 2324, 2689},{ 2463, 2819},{ 2592, 2952},
-        { 2724, 3068},{ 2849, 3176},{ 2955, 3285},{ 3073, 3399},
-        { 3203, 3492},{ 3303, 3586},{ 3409, 3673},{ 3588, 3746}
+        {   20,   66},{  731, 1216},{ 1615, 1904},{ 2449, 2348},
+        { 3157, 2707},{ 3833, 2996},{ 4494, 3190},{ 5015, 3327},
+        { 5460, 3445},{ 6012, 3560},{ 6577, 3681},{ 7039, 3780},
+        { 7680, 3898},{ 8159, 4014},{ 8398, 4025},{ 9137, 4092},
+        { 9657, 4159},{ 9532, 4082},{ 9718, 4025},{10341, 4149},
+        {10415, 4079},{10368, 3983},{10693, 4087},{10793, 4071}
       },
       /*Cb  qi=51  INTER*/
       {
-        {  176,   16},{  193,  367},{  205,  679},{  250, 1017},
-        {  364, 1331},{  559, 1600},{  814, 1828},{ 1091, 2030},
-        { 1378, 2217},{ 1687, 2387},{ 2026, 2536},{ 2382, 2666},
-        { 2742, 2782},{ 3101, 2886},{ 3459, 2977},{ 3820, 3051},
-        { 4172, 3120},{ 4515, 3184},{ 4859, 3250},{ 5181, 3315},
-        { 5502, 3367},{ 5826, 3408},{ 6125, 3442},{ 6438, 3475}
+        {  -19,   17},{  258, 1294},{  781, 2341},{ 1635, 3108},
+        { 3135, 3430},{ 3897, 4087},{ 4308, 4883},{ 5458, 4961},
+        { 6658, 4835},{ 7650, 4660},{ 8446, 4477},{ 9179, 4337},
+        { 9808, 4254},{10328, 4214},{10835, 4181},{11429, 4177},
+        {12153, 4205},{12726, 4187},{13216, 4205},{13803, 4179},
+        {14170, 4177},{14843, 4214},{14846, 4216},{15121, 4241}
       }
     },
     {
       /*Cr  qi=51  INTRA*/
       {
-        {   54,    7},{  231,  394},{  367,  765},{  519, 1101},
-        {  699, 1367},{  888, 1580},{ 1087, 1754},{ 1284, 1903},
-        { 1478, 2043},{ 1664, 2182},{ 1846, 2321},{ 2014, 2453},
-        { 2169, 2563},{ 2320, 2674},{ 2466, 2787},{ 2604, 2873},
-        { 2730, 2952},{ 2851, 3050},{ 2958, 3147},{ 3067, 3234},
-        { 3199, 3350},{ 3304, 3472},{ 3401, 3564},{ 3535, 3591}
+        {   12,   92},{  768, 1199},{ 1663, 1869},{ 2486, 2304},
+        { 3167, 2625},{ 3815, 2904},{ 4494, 3134},{ 5056, 3314},
+        { 5668, 3528},{ 6184, 3635},{ 6617, 3678},{ 6904, 3754},
+        { 7063, 3775},{ 7604, 3826},{ 8042, 3914},{ 8294, 4020},
+        { 9182, 4165},{ 9623, 4220},{ 9451, 4121},{ 9488, 4084},
+        { 9984, 4077},{10390, 4106},{10728, 4133},{11065, 4134}
       },
       /*Cr  qi=51  INTER*/
       {
-        {  175,   17},{  181,  370},{  193,  687},{  242, 1024},
-        {  360, 1333},{  537, 1604},{  758, 1852},{ 1019, 2073},
-        { 1323, 2258},{ 1665, 2409},{ 2021, 2544},{ 2367, 2679},
-        { 2709, 2810},{ 3054, 2933},{ 3407, 3031},{ 3767, 3098},
-        { 4129, 3142},{ 4480, 3165},{ 4806, 3172},{ 5117, 3161},
-        { 5410, 3153},{ 5681, 3160},{ 5934, 3153},{ 6166, 3158}
+        {  -42,   18},{  263, 1292},{  774, 2344},{ 1679, 3095},
+        { 3206, 3355},{ 3925, 4005},{ 4360, 4731},{ 5482, 4604},
+        { 6486, 4461},{ 7364, 4365},{ 8123, 4312},{ 8792, 4251},
+        { 9397, 4144},{ 9966, 4069},{10646, 3975},{11143, 4009},
+        {11605, 4069},{12059, 4107},{12592, 4204},{12891, 4150},
+        {13355, 4217},{13820, 4228},{14303, 4242},{14775, 4266}
       }
     }
   },
@@ -3282,61 +3282,61 @@
     {
       /*Y'  qi=52  INTRA*/
       {
-        {  170,   90},{  857, 1253},{ 1862, 1943},{ 2960, 2206},
-        { 3932, 2318},{ 4810, 2459},{ 5634, 2626},{ 6390, 2797},
-        { 7075, 2966},{ 7703, 3123},{ 8282, 3264},{ 8785, 3366},
-        { 9240, 3452},{ 9677, 3560},{10133, 3677},{10583, 3792},
-        {10992, 3892},{11404, 3975},{11771, 4046},{12062, 4095},
-        {12357, 4136},{12672, 4193},{12995, 4247},{13374, 4339}
+        {  135,  107},{  840, 1189},{ 1905, 1876},{ 3213, 2019},
+        { 4254, 2048},{ 5121, 2160},{ 5957, 2325},{ 6902, 2543},
+        { 7732, 2703},{ 8354, 2785},{ 8941, 2855},{ 9421, 2882},
+        { 9869, 2903},{10362, 2945},{10883, 3007},{11416, 3079},
+        {11888, 3129},{12372, 3166},{12819, 3191},{13159, 3206},
+        {13501, 3223},{13891, 3249},{14307, 3262},{14789, 3277}
       },
       /*Y'  qi=52  INTER*/
       {
-        {  146,   29},{  348, 1300},{ 1460, 2181},{ 2882, 2793},
-        { 4359, 3205},{ 5746, 3387},{ 6926, 3456},{ 7921, 3514},
-        { 8794, 3563},{ 9573, 3601},{10281, 3635},{10935, 3667},
-        {11537, 3694},{12100, 3716},{12627, 3737},{13120, 3756},
-        {13580, 3771},{14019, 3784},{14437, 3796},{14807, 3803},
-        {15160, 3807},{15502, 3809},{15791, 3807},{16106, 3809}
+        {   57,   20},{  224, 1281},{  720, 2354},{ 1730, 3114},
+        { 3379, 3461},{ 5081, 3527},{ 6469, 3507},{ 7592, 3496},
+        { 8544, 3492},{ 9379, 3492},{10133, 3495},{10827, 3497},
+        {11459, 3499},{12052, 3504},{12602, 3507},{13116, 3508},
+        {13608, 3510},{14085, 3512},{14538, 3513},{14948, 3515},
+        {15341, 3519},{15726, 3519},{16038, 3516},{16236, 3509}
       }
     },
     {
       /*Cb  qi=52  INTRA*/
       {
-        {   47,    4},{  239,  374},{  384,  737},{  515, 1077},
-        {  693, 1356},{  895, 1575},{ 1101, 1752},{ 1309, 1900},
-        { 1498, 2047},{ 1672, 2194},{ 1843, 2331},{ 2025, 2447},
-        { 2207, 2553},{ 2367, 2670},{ 2511, 2792},{ 2646, 2921},
-        { 2777, 3036},{ 2904, 3140},{ 3010, 3246},{ 3133, 3354},
-        { 3269, 3445},{ 3369, 3533},{ 3475, 3614},{ 3661, 3683}
+        {   25,   66},{  747, 1213},{ 1631, 1912},{ 2473, 2375},
+        { 3189, 2757},{ 3881, 3077},{ 4550, 3309},{ 5129, 3481},
+        { 5645, 3617},{ 6201, 3735},{ 6744, 3854},{ 7213, 3948},
+        { 7888, 4077},{ 8439, 4200},{ 8766, 4201},{ 9365, 4254},
+        { 9888, 4343},{10026, 4314},{10271, 4295},{10535, 4391},
+        {10519, 4326},{10639, 4250},{10951, 4350},{11338, 4471}
       },
       /*Cb  qi=52  INTER*/
       {
-        {  175,   12},{  192,  367},{  208,  679},{  257, 1016},
-        {  385, 1327},{  597, 1593},{  862, 1818},{ 1140, 2018},
-        { 1427, 2202},{ 1740, 2370},{ 2086, 2515},{ 2457, 2640},
-        { 2832, 2751},{ 3204, 2850},{ 3580, 2935},{ 3951, 3006},
-        { 4316, 3067},{ 4669, 3128},{ 5013, 3188},{ 5360, 3240},
-        { 5690, 3289},{ 6006, 3323},{ 6309, 3356},{ 6615, 3404}
+        {  -53,   42},{  263, 1293},{ 1329, 2152},{ 2888, 2695},
+        { 4584, 2950},{ 6159, 3059},{ 7504, 3145},{ 8564, 3197},
+        { 9389, 3202},{10055, 3202},{10654, 3214},{11253, 3226},
+        {11920, 3242},{12466, 3249},{12863, 3247},{13488, 3268},
+        {14168, 3299},{14624, 3331},{14943, 3380},{15365, 3416},
+        {15743, 3401},{16443, 3369},{17142, 3367},{17738, 3352}
       }
     },
     {
       /*Cr  qi=52  INTRA*/
       {
-        {   60,    8},{  235,  395},{  369,  764},{  523, 1099},
-        {  707, 1364},{  900, 1574},{ 1102, 1745},{ 1301, 1894},
-        { 1501, 2033},{ 1688, 2171},{ 1873, 2307},{ 2051, 2431},
-        { 2213, 2539},{ 2365, 2651},{ 2515, 2762},{ 2659, 2842},
-        { 2788, 2912},{ 2911, 3008},{ 3017, 3105},{ 3128, 3189},
-        { 3262, 3305},{ 3370, 3423},{ 3478, 3509},{ 3608, 3550}
+        {   15,   87},{  787, 1193},{ 1696, 1870},{ 2524, 2323},
+        { 3212, 2673},{ 3868, 2974},{ 4550, 3220},{ 5131, 3395},
+        { 5670, 3592},{ 6186, 3764},{ 6707, 3863},{ 7009, 3918},
+        { 7155, 3944},{ 7704, 3996},{ 8138, 4093},{ 8318, 4183},
+        { 9367, 4390},{ 9639, 4524},{10178, 4581},{10751, 4668},
+        {11217, 4644},{11771, 4717},{12152, 4733},{12677, 4796}
       },
       /*Cr  qi=52  INTER*/
       {
-        {  164,   14},{  180,  368},{  195,  687},{  249, 1022},
-        {  378, 1329},{  573, 1597},{  805, 1842},{ 1066, 2062},
-        { 1371, 2243},{ 1719, 2389},{ 2084, 2521},{ 2445, 2652},
-        { 2804, 2779},{ 3161, 2895},{ 3526, 2986},{ 3904, 3047},
-        { 4278, 3081},{ 4632, 3097},{ 4970, 3102},{ 5282, 3092},
-        { 5572, 3083},{ 5839, 3081},{ 6078, 3076},{ 6334, 3081}
+        {  -55,   44},{  283, 1284},{ 1288, 2182},{ 2819, 2739},
+        { 4546, 2920},{ 5992, 2916},{ 7045, 2927},{ 7961, 2970},
+        { 8814, 3025},{ 9499, 3076},{10229, 3112},{10854, 3134},
+        {11467, 3189},{11867, 3225},{12223, 3239},{12465, 3262},
+        {12941, 3260},{13332, 3270},{13677, 3267},{14270, 3234},
+        {14652, 3234},{15034, 3234},{15601, 3216},{16005, 3214}
       }
     }
   },
@@ -3344,61 +3344,61 @@
     {
       /*Y'  qi=53  INTRA*/
       {
-        {  150,   94},{  911, 1240},{ 1970, 1915},{ 3099, 2163},
-        { 4097, 2259},{ 5008, 2377},{ 5869, 2521},{ 6665, 2671},
-        { 7387, 2819},{ 8047, 2956},{ 8650, 3080},{ 9175, 3168},
-        { 9649, 3245},{10108, 3344},{10592, 3448},{11062, 3550},
-        {11490, 3634},{11924, 3705},{12303, 3767},{12603, 3808},
-        {12907, 3841},{13236, 3888},{13570, 3931},{13962, 3987}
+        {  133,  126},{ 1009, 1107},{ 2119, 1743},{ 3364, 2063},
+        { 4508, 2230},{ 5518, 2357},{ 6381, 2493},{ 7118, 2623},
+        { 7784, 2756},{ 8417, 2862},{ 9026, 2943},{ 9524, 2978},
+        { 9969, 2992},{10458, 3033},{11006, 3107},{11572, 3200},
+        {12047, 3253},{12517, 3288},{12937, 3316},{13274, 3332},
+        {13599, 3343},{13947, 3366},{14430, 3399},{15024, 3412}
       },
       /*Y'  qi=53  INTER*/
       {
-        {  136,   29},{  354, 1297},{ 1530, 2157},{ 3034, 2733},
-        { 4576, 3099},{ 5979, 3248},{ 7154, 3308},{ 8152, 3357},
-        { 9030, 3402},{ 9814, 3436},{10528, 3465},{11188, 3492},
-        {11797, 3515},{12371, 3537},{12907, 3556},{13406, 3571},
-        {13876, 3586},{14327, 3599},{14753, 3610},{15134, 3615},
-        {15499, 3621},{15849, 3624},{16142, 3623},{16375, 3620}
+        {   82,    7},{  179, 1297},{  657, 2384},{ 1757, 3105},
+        { 3403, 3460},{ 5092, 3539},{ 6476, 3528},{ 7593, 3524},
+        { 8541, 3526},{ 9373, 3530},{10126, 3538},{10819, 3544},
+        {11455, 3548},{12057, 3554},{12610, 3559},{13126, 3563},
+        {13624, 3568},{14101, 3570},{14553, 3573},{14972, 3579},
+        {15380, 3583},{15776, 3586},{16099, 3585},{16370, 3577}
       }
     },
     {
       /*Cb  qi=53  INTRA*/
       {
-        {   49,    4},{  243,  374},{  391,  734},{  536, 1071},
-        {  732, 1347},{  948, 1561},{ 1171, 1731},{ 1394, 1872},
-        { 1599, 2010},{ 1784, 2149},{ 1968, 2277},{ 2164, 2383},
-        { 2356, 2478},{ 2527, 2586},{ 2682, 2701},{ 2828, 2820},
-        { 2966, 2927},{ 3096, 3029},{ 3214, 3133},{ 3353, 3220},
-        { 3500, 3296},{ 3617, 3384},{ 3738, 3459},{ 3930, 3511}
+        {   12,   16},{  735, 1193},{ 1554, 1953},{ 2346, 2440},
+        { 3019, 2845},{ 3695, 3183},{ 4346, 3394},{ 4876, 3499},
+        { 5362, 3588},{ 5846, 3695},{ 6334, 3812},{ 6811, 3925},
+        { 7461, 4072},{ 7912, 4173},{ 8151, 4160},{ 8907, 4235},
+        { 9341, 4313},{ 9059, 4235},{ 9059, 4127},{ 9581, 4301},
+        { 9883, 4198},{ 9858, 4173},{10234, 4315},{10503, 4368}
       },
       /*Cb  qi=53  INTER*/
       {
-        {  173,   15},{  195,  365},{  210,  678},{  262, 1013},
-        {  395, 1321},{  615, 1584},{  892, 1805},{ 1185, 2000},
-        { 1490, 2178},{ 1823, 2338},{ 2190, 2474},{ 2574, 2594},
-        { 2963, 2698},{ 3350, 2789},{ 3736, 2867},{ 4122, 2931},
-        { 4499, 2988},{ 4870, 3041},{ 5224, 3091},{ 5569, 3134},
-        { 5901, 3174},{ 6208, 3206},{ 6513, 3238},{ 6852, 3284}
+        {   30,  -22},{  144, 1350},{  723, 2361},{ 1842, 3033},
+        { 3425, 3319},{ 5058, 3256},{ 6333, 3240},{ 7415, 3289},
+        { 8409, 3344},{ 9245, 3379},{ 9865, 3386},{10465, 3368},
+        {11051, 3349},{11548, 3357},{12046, 3358},{12611, 3344},
+        {13512, 3437},{14102, 3471},{14394, 3480},{14777, 3508},
+        {14984, 3498},{15585, 3519},{16132, 3524},{16592, 3544}
       }
     },
     {
       /*Cr  qi=53  INTRA*/
       {
-        {   62,    8},{  239,  394},{  380,  761},{  546, 1092},
-        {  747, 1351},{  959, 1553},{ 1180, 1715},{ 1393, 1856},
-        { 1604, 1989},{ 1807, 2117},{ 2008, 2242},{ 2193, 2360},
-        { 2355, 2470},{ 2521, 2576},{ 2687, 2673},{ 2834, 2746},
-        { 2969, 2809},{ 3104, 2899},{ 3220, 2994},{ 3337, 3072},
-        { 3483, 3170},{ 3600, 3280},{ 3710, 3363},{ 3840, 3399}
+        {    3,   26},{  729, 1193},{ 1558, 1929},{ 2352, 2405},
+        { 3018, 2768},{ 3669, 3090},{ 4381, 3360},{ 4987, 3550},
+        { 5594, 3747},{ 6112, 3842},{ 6575, 3887},{ 6822, 3913},
+        { 6981, 3915},{ 7449, 3972},{ 7846, 4076},{ 8176, 4183},
+        { 9068, 4355},{ 9385, 4495},{ 9719, 4546},{10096, 4581},
+        {10189, 4589},{10512, 4592},{10603, 4586},{10901, 4630}
       },
       /*Cr  qi=53  INTER*/
       {
-        {  166,   14},{  184,  369},{  197,  686},{  254, 1019},
-        {  389, 1323},{  590, 1589},{  832, 1831},{ 1109, 2046},
-        { 1434, 2221},{ 1801, 2361},{ 2183, 2486},{ 2558, 2609},
-        { 2932, 2730},{ 3312, 2833},{ 3695, 2914},{ 4084, 2969},
-        { 4459, 2993},{ 4818, 3001},{ 5156, 3000},{ 5458, 2998},
-        { 5745, 2987},{ 6002, 2978},{ 6251, 2973},{ 6482, 2956}
+        {    2,  -19},{  169, 1338},{  732, 2355},{ 1887, 3018},
+        { 3511, 3245},{ 5025, 3182},{ 6158, 3171},{ 7107, 3215},
+        { 8031, 3256},{ 8822, 3288},{ 9372, 3316},{ 9730, 3280},
+        {10261, 3253},{10879, 3267},{11493, 3238},{11993, 3213},
+        {12636, 3187},{13209, 3164},{13782, 3142},{14163, 3114},
+        {14711, 3091},{15258, 3068},{15806, 3045},{16353, 3023}
       }
     }
   },
@@ -3406,61 +3406,61 @@
     {
       /*Y'  qi=54  INTRA*/
       {
-        {  129,  101},{  972, 1233},{ 2105, 1899},{ 3305, 2128},
-        { 4341, 2205},{ 5272, 2311},{ 6155, 2441},{ 6970, 2579},
-        { 7707, 2717},{ 8381, 2848},{ 8997, 2967},{ 9524, 3052},
-        { 9999, 3126},{10468, 3217},{10958, 3313},{11431, 3412},
-        {11867, 3494},{12311, 3560},{12696, 3616},{13000, 3652},
-        {13314, 3686},{13646, 3733},{13983, 3770},{14389, 3817}
+        {  212,  138},{ 1067, 1106},{ 2341, 1674},{ 3641, 1962},
+        { 4669, 2199},{ 5600, 2400},{ 6472, 2546},{ 7242, 2665},
+        { 7917, 2760},{ 8533, 2846},{ 9129, 2932},{ 9611, 2968},
+        {10057, 2989},{10548, 3032},{11078, 3108},{11639, 3206},
+        {12119, 3262},{12606, 3301},{13045, 3334},{13360, 3354},
+        {13687, 3369},{14055, 3399},{14524, 3433},{15120, 3433}
       },
       /*Y'  qi=54  INTER*/
       {
-        {   95,   36},{  412, 1289},{ 1752, 2102},{ 3399, 2637},
-        { 5048, 2946},{ 6495, 3054},{ 7689, 3106},{ 8710, 3152},
-        { 9611, 3191},{10415, 3221},{11144, 3248},{11817, 3272},
-        {12439, 3294},{13021, 3312},{13565, 3329},{14078, 3343},
-        {14561, 3354},{15027, 3365},{15459, 3372},{15848, 3380},
-        {16226, 3386},{16574, 3387},{16878, 3383},{17133, 3368}
+        {   86,    7},{  177, 1295},{  664, 2376},{ 1800, 3083},
+        { 3485, 3413},{ 5190, 3473},{ 6577, 3453},{ 7700, 3444},
+        { 8657, 3442},{ 9498, 3444},{10261, 3447},{10963, 3451},
+        {11609, 3454},{12210, 3458},{12766, 3464},{13285, 3466},
+        {13787, 3466},{14276, 3470},{14742, 3476},{15158, 3480},
+        {15556, 3484},{15971, 3486},{16308, 3483},{16534, 3476}
       }
     },
     {
       /*Cb  qi=54  INTRA*/
       {
-        {   52,    4},{  251,  374},{  403,  732},{  557, 1061},
-        {  765, 1327},{  990, 1535},{ 1220, 1701},{ 1454, 1838},
-        { 1666, 1974},{ 1855, 2113},{ 2042, 2240},{ 2244, 2345},
-        { 2440, 2435},{ 2614, 2538},{ 2777, 2648},{ 2925, 2763},
-        { 3064, 2871},{ 3198, 2969},{ 3317, 3069},{ 3457, 3162},
-        { 3610, 3234},{ 3726, 3314},{ 3846, 3383},{ 4052, 3419}
+        {   16,   17},{  763, 1189},{ 1619, 1928},{ 2421, 2416},
+        { 3115, 2848},{ 3824, 3210},{ 4518, 3433},{ 5069, 3543},
+        { 5496, 3580},{ 5986, 3652},{ 6520, 3783},{ 6938, 3875},
+        { 7503, 3995},{ 7980, 4096},{ 8233, 4110},{ 8978, 4202},
+        { 9492, 4297},{ 9333, 4242},{ 9592, 4226},{10132, 4364},
+        {10372, 4309},{10335, 4213},{10721, 4318},{10911, 4308}
       },
       /*Cb  qi=54  INTER*/
       {
-        {  180,   18},{  195,  366},{  215,  677},{  287, 1006},
-        {  459, 1305},{  728, 1556},{ 1040, 1766},{ 1361, 1949},
-        { 1702, 2115},{ 2077, 2261},{ 2486, 2387},{ 2911, 2496},
-        { 3335, 2589},{ 3751, 2667},{ 4168, 2730},{ 4578, 2783},
-        { 4975, 2827},{ 5356, 2869},{ 5712, 2913},{ 6069, 2955},
-        { 6414, 2986},{ 6725, 3011},{ 7032, 3037},{ 7371, 3065}
+        {   27,  -29},{  142, 1350},{  723, 2360},{ 1866, 3020},
+        { 3495, 3280},{ 5161, 3216},{ 6434, 3216},{ 7506, 3238},
+        { 8422, 3264},{ 9253, 3280},{ 9986, 3284},{10568, 3270},
+        {11201, 3248},{11773, 3257},{12297, 3233},{12874, 3295},
+        {13539, 3344},{13805, 3388},{14153, 3408},{14421, 3384},
+        {14971, 3354},{15493, 3352},{16001, 3334},{16432, 3328}
       }
     },
     {
       /*Cr  qi=54  INTRA*/
       {
-        {   68,    9},{  246,  394},{  390,  757},{  569, 1079},
-        {  779, 1329},{  999, 1525},{ 1230, 1682},{ 1454, 1820},
-        { 1673, 1950},{ 1883, 2076},{ 2088, 2199},{ 2277, 2316},
-        { 2442, 2422},{ 2610, 2524},{ 2778, 2617},{ 2930, 2685},
-        { 3066, 2746},{ 3201, 2833},{ 3318, 2925},{ 3437, 3004},
-        { 3587, 3094},{ 3708, 3197},{ 3823, 3291},{ 3950, 3342}
+        {    8,   26},{  792, 1168},{ 1673, 1872},{ 2470, 2354},
+        { 3139, 2736},{ 3793, 3065},{ 4520, 3335},{ 5128, 3524},
+        { 5718, 3705},{ 6257, 3797},{ 6762, 3857},{ 7021, 3910},
+        { 7112, 3951},{ 7696, 4009},{ 8155, 4093},{ 8458, 4178},
+        { 9567, 4383},{ 9782, 4498},{10301, 4596},{10862, 4718},
+        {11422, 4841},{11982, 4964},{12542, 5087},{13103, 5210}
       },
       /*Cr  qi=54  INTER*/
       {
-        {  167,   13},{  188,  370},{  203,  685},{  277, 1012},
-        {  451, 1307},{  696, 1562},{  972, 1793},{ 1283, 1995},
-        { 1653, 2154},{ 2068, 2281},{ 2490, 2398},{ 2906, 2513},
-        { 3320, 2620},{ 3730, 2709},{ 4141, 2772},{ 4548, 2806},
-        { 4928, 2823},{ 5279, 2827},{ 5617, 2820},{ 5930, 2810},
-        { 6217, 2798},{ 6475, 2794},{ 6722, 2797},{ 6968, 2809}
+        {   18,  -29},{  169, 1337},{  736, 2353},{ 1915, 3005},
+        { 3563, 3213},{ 5053, 3152},{ 6192, 3128},{ 7177, 3155},
+        { 8139, 3181},{ 8866, 3213},{ 9353, 3265},{ 9916, 3177},
+        {10602, 3212},{11201, 3178},{11845, 3151},{12248, 3140},
+        {12838, 3120},{13385, 3111},{13960, 3092},{14454, 3093},
+        {15018, 3077},{15582, 3060},{16146, 3044},{16710, 3027}
       }
     }
   },
@@ -3468,61 +3468,61 @@
     {
       /*Y'  qi=55  INTRA*/
       {
-        {  114,  103},{ 1030, 1222},{ 2214, 1873},{ 3445, 2091},
-        { 4497, 2158},{ 5448, 2250},{ 6354, 2365},{ 7196, 2488},
-        { 7964, 2612},{ 8662, 2729},{ 9301, 2834},{ 9845, 2904},
-        {10335, 2970},{10825, 3052},{11337, 3138},{11833, 3228},
-        {12288, 3301},{12746, 3357},{13143, 3407},{13462, 3437},
-        {13781, 3463},{14124, 3503},{14483, 3535},{14916, 3572}
+        {  203,  139},{ 1135, 1090},{ 2463, 1649},{ 3744, 1954},
+        { 4761, 2185},{ 5727, 2368},{ 6613, 2520},{ 7380, 2646},
+        { 8034, 2744},{ 8638, 2835},{ 9225, 2927},{ 9695, 2967},
+        {10135, 2988},{10609, 3036},{11130, 3120},{11705, 3229},
+        {12190, 3294},{12660, 3335},{13087, 3373},{13400, 3395},
+        {13732, 3412},{14091, 3443},{14544, 3480},{15120, 3480}
       },
       /*Y'  qi=55  INTER*/
       {
-        {   90,   37},{  420, 1287},{ 1844, 2073},{ 3585, 2565},
-        { 5291, 2829},{ 6746, 2915},{ 7941, 2958},{ 8970, 2996},
-        { 9881, 3029},{10698, 3055},{11440, 3077},{12126, 3097},
-        {12758, 3115},{13349, 3132},{13905, 3145},{14431, 3156},
-        {14928, 3167},{15414, 3179},{15863, 3188},{16269, 3194},
-        {16654, 3198},{17018, 3201},{17353, 3201},{17692, 3202}
+        {   74,    9},{  180, 1293},{  710, 2357},{ 1898, 3050},
+        { 3595, 3387},{ 5273, 3471},{ 6632, 3475},{ 7747, 3476},
+        { 8699, 3482},{ 9536, 3489},{10294, 3498},{10988, 3505},
+        {11632, 3511},{12231, 3517},{12785, 3521},{13311, 3524},
+        {13812, 3526},{14303, 3532},{14755, 3540},{15163, 3544},
+        {15582, 3548},{15976, 3548},{16290, 3547},{16482, 3545}
       }
     },
     {
       /*Cb  qi=55  INTRA*/
       {
-        {   51,    4},{  252,  374},{  411,  732},{  580, 1060},
-        {  808, 1322},{ 1056, 1523},{ 1308, 1681},{ 1561, 1811},
-        { 1789, 1941},{ 1990, 2074},{ 2189, 2195},{ 2405, 2293},
-        { 2615, 2379},{ 2804, 2477},{ 2977, 2580},{ 3132, 2689},
-        { 3285, 2788},{ 3431, 2883},{ 3570, 2974},{ 3725, 3048},
-        { 3882, 3116},{ 4014, 3194},{ 4152, 3259},{ 4367, 3289}
+        {   14,   17},{  783, 1181},{ 1649, 1916},{ 2440, 2416},
+        { 3109, 2868},{ 3795, 3253},{ 4418, 3466},{ 4919, 3550},
+        { 5387, 3623},{ 5858, 3737},{ 6303, 3871},{ 6745, 4009},
+        { 7316, 4149},{ 7739, 4235},{ 8037, 4240},{ 8787, 4320},
+        { 9187, 4422},{ 9034, 4368},{ 9284, 4331},{ 9863, 4524},
+        {10263, 4478},{10191, 4354},{10680, 4524},{10933, 4522}
       },
       /*Cb  qi=55  INTER*/
       {
-        {  197,   15},{  199,  365},{  220,  676},{  290, 1004},
-        {  472, 1300},{  755, 1547},{ 1087, 1751},{ 1431, 1927},
-        { 1794, 2084},{ 2188, 2223},{ 2613, 2341},{ 3054, 2442},
-        { 3494, 2528},{ 3925, 2601},{ 4358, 2658},{ 4778, 2697},
-        { 5178, 2730},{ 5563, 2770},{ 5939, 2803},{ 6298, 2826},
-        { 6633, 2855},{ 6967, 2885},{ 7278, 2904},{ 7597, 2943}
+        {   25,  -20},{  148, 1347},{  776, 2335},{ 1971, 2979},
+        { 3198, 3497},{ 4095, 4090},{ 5038, 4478},{ 6341, 4450},
+        { 7497, 4344},{ 8433, 4196},{ 9241, 4072},{ 9919, 4000},
+        {10560, 3929},{11130, 3889},{11655, 3887},{12357, 3894},
+        {13014, 3870},{13357, 3915},{13647, 3947},{14347, 3957},
+        {14978, 3885},{15295, 3955},{15486, 3963},{15878, 3972}
       }
     },
     {
       /*Cr  qi=55  INTRA*/
       {
-        {   66,    8},{  248,  394},{  401,  758},{  596, 1078},
-        {  825, 1324},{ 1066, 1512},{ 1317, 1662},{ 1559, 1794},
-        { 1797, 1918},{ 2020, 2039},{ 2234, 2154},{ 2435, 2264},
-        { 2614, 2367},{ 2791, 2466},{ 2971, 2552},{ 3134, 2616},
-        { 3277, 2670},{ 3429, 2750},{ 3561, 2838},{ 3688, 2911},
-        { 3844, 2990},{ 3976, 3084},{ 4104, 3168},{ 4243, 3212}
+        {    8,   27},{  813, 1159},{ 1711, 1860},{ 2492, 2357},
+        { 3135, 2757},{ 3767, 3109},{ 4454, 3401},{ 5042, 3604},
+        { 5612, 3812},{ 6136, 3905},{ 6639, 3976},{ 6950, 4043},
+        { 7036, 4085},{ 7556, 4122},{ 7972, 4219},{ 8251, 4317},
+        { 9378, 4570},{ 9578, 4664},{10099, 4760},{10660, 4884},
+        {11221, 5008},{11782, 5132},{12343, 5256},{12904, 5380}
       },
       /*Cr  qi=55  INTER*/
       {
-        {  167,   13},{  189,  369},{  205,  684},{  281, 1010},
-        {  463, 1303},{  722, 1554},{ 1016, 1779},{ 1350, 1973},
-        { 1741, 2125},{ 2175, 2244},{ 2617, 2356},{ 3054, 2462},
-        { 3489, 2556},{ 3922, 2633},{ 4344, 2687},{ 4743, 2717},
-        { 5126, 2726},{ 5477, 2724},{ 5810, 2716},{ 6117, 2709},
-        { 6387, 2703},{ 6667, 2699},{ 6928, 2698},{ 7217, 2712}
+        {    6,  -23},{  173, 1332},{  786, 2330},{ 2016, 2968},
+        { 3188, 3502},{ 4046, 4086},{ 5062, 4288},{ 6240, 4133},
+        { 7238, 4037},{ 8117, 3984},{ 8896, 3953},{ 9537, 3893},
+        {10147, 3855},{10778, 3853},{11453, 3836},{11872, 3832},
+        {12456, 3919},{12937, 3944},{13463, 4026},{13719, 4014},
+        {14111, 4099},{14564, 4130},{15035, 4160},{15493, 4199}
       }
     }
   },
@@ -3530,61 +3530,61 @@
     {
       /*Y'  qi=56  INTRA*/
       {
-        {  100,  108},{ 1066, 1219},{ 2311, 1862},{ 3587, 2070},
-        { 4665, 2128},{ 5635, 2212},{ 6559, 2319},{ 7414, 2435},
-        { 8195, 2551},{ 8909, 2664},{ 9556, 2762},{10103, 2827},
-        {10602, 2888},{11106, 2966},{11626, 3048},{12127, 3132},
-        {12585, 3201},{13058, 3252},{13469, 3297},{13783, 3325},
-        {14108, 3349},{14456, 3386},{14813, 3414},{15235, 3445}
+        {   89,  143},{ 1251, 1057},{ 2558, 1669},{ 3809, 2017},
+        { 4940, 2194},{ 5993, 2299},{ 6911, 2423},{ 7699, 2542},
+        { 8367, 2640},{ 8967, 2729},{ 9560, 2823},{10033, 2865},
+        {10459, 2893},{10922, 2949},{11450, 3033},{12033, 3145},
+        {12515, 3211},{12999, 3256},{13426, 3299},{13752, 3326},
+        {14075, 3343},{14439, 3380},{14923, 3426},{15478, 3435}
       },
       /*Y'  qi=56  INTER*/
       {
-        {   30,   38},{  479, 1282},{ 1966, 2045},{ 3780, 2511},
-        { 5536, 2746},{ 7005, 2817},{ 8211, 2855},{ 9255, 2889},
-        {10178, 2918},{10999, 2940},{11743, 2958},{12424, 2975},
-        {13044, 2990},{13623, 3003},{14166, 3013},{14678, 3023},
-        {15160, 3032},{15623, 3042},{16066, 3049},{16473, 3052},
-        {16854, 3055},{17214, 3056},{17540, 3056},{17843, 3064}
+        {   23,   32},{  215, 1278},{ 1018, 2249},{ 2568, 2840},
+        { 4465, 3093},{ 6100, 3158},{ 7388, 3177},{ 8471, 3185},
+        { 9410, 3199},{10244, 3215},{11007, 3231},{11714, 3242},
+        {12360, 3249},{12961, 3259},{13518, 3266},{14042, 3274},
+        {14550, 3280},{15041, 3288},{15502, 3297},{15911, 3301},
+        {16326, 3307},{16730, 3309},{17072, 3309},{17319, 3314}
       }
     },
     {
       /*Cb  qi=56  INTRA*/
       {
-        {   54,    4},{  257,  374},{  417,  731},{  593, 1054},
-        {  829, 1310},{ 1085, 1506},{ 1345, 1660},{ 1604, 1785},
-        { 1837, 1911},{ 2044, 2041},{ 2247, 2160},{ 2463, 2255},
-        { 2678, 2336},{ 2873, 2428},{ 3053, 2526},{ 3213, 2633},
-        { 3368, 2729},{ 3514, 2821},{ 3652, 2907},{ 3813, 2979},
-        { 3981, 3040},{ 4120, 3110},{ 4257, 3175},{ 4472, 3208}
+        {   21,   19},{  832, 1172},{ 1727, 1889},{ 2535, 2381},
+        { 3201, 2830},{ 3860, 3194},{ 4481, 3409},{ 4993, 3515},
+        { 5465, 3605},{ 5946, 3724},{ 6416, 3858},{ 6839, 3966},
+        { 7429, 4104},{ 7867, 4212},{ 8099, 4210},{ 8864, 4304},
+        { 9270, 4408},{ 8969, 4311},{ 8998, 4221},{ 9524, 4442},
+        {10024, 4355},{10045, 4307},{10484, 4460},{10782, 4480}
       },
       /*Cb  qi=56  INTER*/
       {
-        {  188,   14},{  202,  365},{  225,  676},{  317, 1000},
-        {  532, 1290},{  832, 1531},{ 1163, 1732},{ 1510, 1903},
-        { 1888, 2055},{ 2306, 2187},{ 2758, 2298},{ 3229, 2391},
-        { 3691, 2473},{ 4136, 2539},{ 4575, 2587},{ 5002, 2622},
-        { 5406, 2648},{ 5786, 2678},{ 6155, 2712},{ 6518, 2740},
-        { 6856, 2759},{ 7167, 2779},{ 7488, 2802},{ 7779, 2811}
+        {   54,   21},{  205, 1314},{ 1098, 2217},{ 2617, 2776},
+        { 3763, 3357},{ 4657, 3915},{ 5957, 4014},{ 7252, 3961},
+        { 8341, 3880},{ 9217, 3778},{ 9962, 3697},{10639, 3651},
+        {11245, 3614},{11824, 3591},{12445, 3595},{13017, 3615},
+        {13608, 3624},{14130, 3634},{14722, 3637},{15435, 3624},
+        {15966, 3620},{16418, 3657},{16565, 3715},{16846, 3781}
       }
     },
     {
       /*Cr  qi=56  INTRA*/
       {
-        {   71,    9},{  253,  394},{  406,  756},{  608, 1071},
-        {  845, 1310},{ 1095, 1493},{ 1355, 1639},{ 1603, 1767},
-        { 1845, 1888},{ 2073, 2004},{ 2290, 2116},{ 2493, 2222},
-        { 2682, 2321},{ 2864, 2416},{ 3044, 2499},{ 3210, 2557},
-        { 3358, 2611},{ 3514, 2688},{ 3650, 2770},{ 3783, 2842},
-        { 3938, 2916},{ 4069, 3004},{ 4208, 3086},{ 4355, 3132}
+        {   27,   26},{  870, 1149},{ 1796, 1830},{ 2587, 2328},
+        { 3237, 2728},{ 3876, 3074},{ 4571, 3367},{ 5149, 3579},
+        { 5725, 3788},{ 6259, 3887},{ 6732, 3953},{ 6997, 4005},
+        { 7168, 4067},{ 7698, 4125},{ 7990, 4226},{ 8307, 4306},
+        { 9435, 4548},{ 9653, 4637},{10177, 4728},{10748, 4844},
+        {11318, 4961},{11888, 5078},{12459, 5195},{13029, 5312}
       },
       /*Cr  qi=56  INTER*/
       {
-        {  176,   13},{  195,  370},{  215,  683},{  307, 1006},
-        {  518, 1292},{  794, 1538},{ 1090, 1761},{ 1430, 1950},
-        { 1840, 2094},{ 2298, 2210},{ 2765, 2314},{ 3228, 2414},
-        { 3685, 2504},{ 4135, 2571},{ 4566, 2614},{ 4967, 2640},
-        { 5345, 2644},{ 5696, 2637},{ 6018, 2631},{ 6322, 2624},
-        { 6608, 2619},{ 6883, 2619},{ 7141, 2621},{ 7428, 2636}
+        {   29,   24},{  245, 1293},{ 1112, 2212},{ 2665, 2756},
+        { 3773, 3334},{ 4617, 3881},{ 5877, 3848},{ 7012, 3736},
+        { 7999, 3680},{ 8877, 3651},{ 9718, 3628},{10443, 3608},
+        {11043, 3604},{11694, 3594},{12337, 3537},{12671, 3534},
+        {13332, 3623},{13767, 3674},{14118, 3786},{14514, 3748},
+        {14684, 3773},{15126, 3834},{15504, 3881},{15882, 3927}
       }
     }
   },
@@ -3592,61 +3592,61 @@
     {
       /*Y'  qi=57  INTRA*/
       {
-        {   86,  110},{ 1103, 1215},{ 2392, 1848},{ 3703, 2040},
-        { 4797, 2082},{ 5787, 2154},{ 6733, 2245},{ 7613, 2343},
-        { 8419, 2442},{ 9155, 2537},{ 9823, 2622},{10388, 2676},
-        {10904, 2726},{11431, 2793},{11973, 2863},{12495, 2934},
-        {12972, 2996},{13455, 3040},{13882, 3075},{14210, 3097},
-        {14555, 3117},{14926, 3146},{15297, 3166},{15747, 3188}
+        {  180,  158},{ 1306, 1056},{ 2682, 1676},{ 4003, 2069},
+        { 5253, 2212},{ 6341, 2268},{ 7242, 2367},{ 8016, 2475},
+        { 8684, 2567},{ 9296, 2651},{ 9897, 2738},{10372, 2772},
+        {10794, 2794},{11247, 2843},{11777, 2924},{12383, 3032},
+        {12870, 3095},{13360, 3138},{13792, 3177},{14109, 3202},
+        {14441, 3219},{14794, 3249},{15264, 3285},{15850, 3287}
       },
       /*Y'  qi=57  INTER*/
       {
-        {   17,   44},{  498, 1277},{ 2101, 2010},{ 4024, 2434},
-        { 5848, 2624},{ 7342, 2674},{ 8568, 2702},{ 9629, 2726},
-        {10566, 2747},{11398, 2763},{12148, 2777},{12834, 2790},
-        {13460, 2801},{14048, 2811},{14594, 2820},{15109, 2828},
-        {15596, 2836},{16066, 2841},{16509, 2845},{16929, 2849},
-        {17329, 2851},{17704, 2853},{18061, 2857},{18404, 2860}
+        {   51,   20},{  202, 1281},{ 1074, 2230},{ 2785, 2765},
+        { 4813, 2950},{ 6515, 2968},{ 7831, 2973},{ 8926, 2984},
+        { 9881, 2998},{10736, 3011},{11511, 3025},{12228, 3036},
+        {12885, 3045},{13487, 3053},{14042, 3059},{14573, 3065},
+        {15083, 3074},{15578, 3081},{16055, 3086},{16477, 3092},
+        {16884, 3096},{17290, 3100},{17642, 3099},{17887, 3091}
       }
     },
     {
       /*Cb  qi=57  INTRA*/
       {
-        {   54,    4},{  260,  375},{  427,  730},{  617, 1048},
-        {  870, 1298},{ 1140, 1489},{ 1414, 1637},{ 1693, 1753},
-        { 1943, 1871},{ 2164, 1997},{ 2384, 2110},{ 2618, 2197},
-        { 2844, 2271},{ 3051, 2355},{ 3246, 2446},{ 3425, 2547},
-        { 3595, 2636},{ 3751, 2719},{ 3903, 2796},{ 4081, 2855},
-        { 4263, 2906},{ 4413, 2967},{ 4572, 3027},{ 4789, 3061}
+        {   18,   21},{  911, 1148},{ 1877, 1838},{ 2729, 2317},
+        { 3447, 2750},{ 4184, 3111},{ 4889, 3348},{ 5461, 3496},
+        { 5912, 3572},{ 6394, 3650},{ 6953, 3761},{ 7393, 3834},
+        { 7949, 3945},{ 8408, 4053},{ 8668, 4074},{ 9516, 4174},
+        { 9899, 4240},{ 9402, 4105},{ 9460, 4022},{ 9915, 4184},
+        {10134, 4084},{10100, 4027},{10485, 4169},{10729, 4210}
       },
       /*Cb  qi=57  INTER*/
       {
-        {  191,   12},{  203,  367},{  226,  676},{  324,  997},
-        {  553, 1282},{  878, 1516},{ 1240, 1709},{ 1618, 1873},
-        { 2022, 2018},{ 2466, 2143},{ 2948, 2245},{ 3444, 2332},
-        { 3926, 2404},{ 4387, 2460},{ 4832, 2497},{ 5266, 2522},
-        { 5679, 2542},{ 6075, 2561},{ 6466, 2591},{ 6828, 2617},
-        { 7160, 2636},{ 7495, 2659},{ 7824, 2676},{ 8152, 2706}
+        {   -3,   11},{  186, 1321},{ 1161, 2193},{ 2836, 2689},
+        { 4792, 2783},{ 6392, 2735},{ 7665, 2762},{ 8770, 2801},
+        { 9680, 2820},{10520, 2871},{11300, 2883},{11907, 2876},
+        {12654, 2874},{13233, 2855},{13640, 2859},{14239, 2890},
+        {15033, 2940},{15554, 2972},{15794, 2965},{16073, 2961},
+        {16542, 2988},{17150, 3026},{17541, 3010},{17974, 3022}
       }
     },
     {
       /*Cr  qi=57  INTRA*/
       {
-        {   71,    9},{  256,  395},{  417,  755},{  633, 1064},
-        {  885, 1297},{ 1149, 1474},{ 1429, 1612},{ 1697, 1735},
-        { 1956, 1849},{ 2201, 1959},{ 2430, 2065},{ 2646, 2165},
-        { 2846, 2258},{ 3041, 2346},{ 3238, 2418},{ 3418, 2468},
-        { 3573, 2518},{ 3737, 2586},{ 3892, 2660},{ 4041, 2725},
-        { 4207, 2793},{ 4363, 2873},{ 4516, 2944},{ 4667, 2986}
+        {   29,   28},{  950, 1124},{ 1944, 1786},{ 2783, 2265},
+        { 3465, 2642},{ 4132, 2971},{ 4855, 3245},{ 5461, 3431},
+        { 6056, 3615},{ 6600, 3705},{ 7092, 3756},{ 7335, 3826},
+        { 7572, 3888},{ 8197, 3950},{ 8539, 4029},{ 8839, 4112},
+        { 9950, 4323},{10199, 4434},{10742, 4531},{11322, 4654},
+        {11901, 4777},{12480, 4899},{13060, 5022},{13639, 5145}
       },
       /*Cr  qi=57  INTER*/
       {
-        {  172,   15},{  194,  369},{  217,  682},{  315, 1002},
-        {  540, 1283},{  840, 1523},{ 1167, 1737},{ 1542, 1917},
-        { 1988, 2053},{ 2472, 2163},{ 2962, 2263},{ 3447, 2355},
-        { 3924, 2430},{ 4390, 2485},{ 4825, 2521},{ 5232, 2536},
-        { 5612, 2537},{ 5962, 2529},{ 6287, 2521},{ 6592, 2513},
-        { 6878, 2510},{ 7161, 2509},{ 7436, 2507},{ 7687, 2514}
+        {  -36,   15},{  231, 1299},{ 1182, 2190},{ 2882, 2676},
+        { 4799, 2720},{ 6274, 2671},{ 7422, 2677},{ 8390, 2701},
+        { 9289, 2730},{10058, 2748},{10753, 2784},{11294, 2795},
+        {11894, 2802},{12342, 2786},{12950, 2812},{13316, 2847},
+        {13808, 2874},{14299, 2889},{14791, 2904},{15283, 2918},
+        {15774, 2933},{16266, 2948},{16758, 2963},{17250, 2978}
       }
     }
   },
@@ -3654,61 +3654,61 @@
     {
       /*Y'  qi=58  INTRA*/
       {
-        {   95,  113},{ 1165, 1212},{ 2480, 1835},{ 3807, 2017},
-        { 4906, 2052},{ 5908, 2115},{ 6876, 2199},{ 7781, 2289},
-        { 8612, 2381},{ 9368, 2469},{10051, 2545},{10629, 2593},
-        {11161, 2639},{11702, 2701},{12256, 2764},{12795, 2829},
-        {13289, 2885},{13789, 2924},{14229, 2957},{14568, 2979},
-        {14920, 2996},{15303, 3022},{15683, 3038},{16122, 3056}
+        {  164,  166},{ 1412, 1040},{ 2822, 1630},{ 4183, 1961},
+        { 5449, 2077},{ 6521, 2161},{ 7451, 2296},{ 8239, 2430},
+        { 8898, 2526},{ 9497, 2613},{10090, 2706},{10560, 2742},
+        {10996, 2766},{11452, 2820},{11983, 2904},{12601, 3012},
+        {13102, 3080},{13584, 3124},{14006, 3164},{14321, 3187},
+        {14635, 3202},{14994, 3243},{15489, 3283},{16079, 3301}
       },
       /*Y'  qi=58  INTER*/
       {
-        {  -18,   46},{  535, 1272},{ 2219, 1981},{ 4234, 2364},
-        { 6111, 2520},{ 7619, 2556},{ 8858, 2576},{ 9934, 2594},
-        {10882, 2610},{11720, 2622},{12477, 2633},{13167, 2643},
-        {13794, 2651},{14385, 2660},{14934, 2667},{15455, 2673},
-        {15959, 2680},{16434, 2684},{16882, 2688},{17302, 2692},
-        {17715, 2696},{18099, 2697},{18453, 2695},{18778, 2694}
+        {   26,   31},{  222, 1276},{ 1258, 2178},{ 3082, 2712},
+        { 5155, 2905},{ 6875, 2915},{ 8182, 2925},{ 9282, 2928},
+        {10221, 2921},{11046, 2919},{11800, 2933},{12489, 2951},
+        {13112, 2965},{13684, 2976},{14207, 2984},{14706, 2991},
+        {15183, 2997},{15642, 3005},{16082, 3013},{16475, 3021},
+        {16859, 3024},{17247, 3026},{17573, 3024},{17779, 3019}
       }
     },
     {
       /*Cb  qi=58  INTRA*/
       {
-        {   54,    4},{  260,  375},{  428,  729},{  620, 1047},
-        {  874, 1295},{ 1147, 1484},{ 1425, 1630},{ 1708, 1743},
-        { 1963, 1858},{ 2191, 1980},{ 2417, 2088},{ 2658, 2170},
-        { 2892, 2240},{ 3105, 2319},{ 3307, 2403},{ 3493, 2499},
-        { 3668, 2586},{ 3832, 2666},{ 3993, 2738},{ 4180, 2790},
-        { 4370, 2836},{ 4524, 2894},{ 4683, 2947},{ 4899, 2976}
+        {   21,   21},{  932, 1139},{ 1907, 1825},{ 2757, 2307},
+        { 3474, 2741},{ 4209, 3101},{ 4917, 3337},{ 5451, 3470},
+        { 5880, 3538},{ 6387, 3625},{ 6929, 3738},{ 7345, 3819},
+        { 7835, 3936},{ 8292, 4045},{ 8584, 4048},{ 9330, 4138},
+        { 9822, 4224},{ 9615, 4149},{ 9817, 4108},{10323, 4267},
+        {10497, 4170},{10535, 4118},{10933, 4218},{11155, 4214}
       },
       /*Cb  qi=58  INTER*/
       {
-        {  177,   11},{  204,  363},{  231,  674},{  338,  994},
-        {  589, 1275},{  929, 1507},{ 1296, 1697},{ 1683, 1857},
-        { 2104, 1995},{ 2573, 2111},{ 3085, 2206},{ 3607, 2284},
-        { 4111, 2347},{ 4589, 2391},{ 5048, 2417},{ 5484, 2435},
-        { 5892, 2452},{ 6298, 2473},{ 6691, 2489},{ 7071, 2512},
-        { 7419, 2526},{ 7759, 2534},{ 8104, 2555},{ 8359, 2558}
+        {   14,   18},{  216, 1305},{ 1343, 2139},{ 3154, 2605},
+        { 4479, 3086},{ 5521, 3524},{ 6917, 3561},{ 8221, 3507},
+        { 9345, 3425},{10289, 3323},{11127, 3249},{11860, 3215},
+        {12513, 3155},{13064, 3136},{13610, 3146},{14188, 3158},
+        {14869, 3143},{15410, 3184},{15906, 3166},{16425, 3199},
+        {16944, 3154},{17616, 3171},{17944, 3165},{18452, 3155}
       }
     },
     {
       /*Cr  qi=58  INTRA*/
       {
-        {   70,    9},{  256,  395},{  418,  755},{  636, 1063},
-        {  889, 1295},{ 1156, 1469},{ 1441, 1605},{ 1713, 1724},
-        { 1978, 1834},{ 2231, 1939},{ 2467, 2039},{ 2688, 2135},
-        { 2893, 2225},{ 3096, 2310},{ 3301, 2379},{ 3479, 2426},
-        { 3638, 2470},{ 3814, 2531},{ 3974, 2601},{ 4122, 2666},
-        { 4288, 2730},{ 4456, 2802},{ 4616, 2871},{ 4771, 2908}
+        {   35,   28},{  972, 1116},{ 1974, 1776},{ 2808, 2258},
+        { 3486, 2631},{ 4145, 2960},{ 4864, 3231},{ 5467, 3409},
+        { 6064, 3600},{ 6592, 3692},{ 7063, 3741},{ 7305, 3803},
+        { 7557, 3875},{ 8173, 3944},{ 8527, 4027},{ 8837, 4113},
+        { 9954, 4322},{10203, 4431},{10747, 4526},{11327, 4646},
+        {11908, 4766},{12488, 4886},{13069, 5006},{13649, 5127}
       },
       /*Cr  qi=58  INTER*/
       {
-        {  177,   13},{  196,  368},{  219,  682},{  329,  999},
-        {  573, 1277},{  887, 1514},{ 1222, 1725},{ 1609, 1900},
-        { 2074, 2030},{ 2584, 2132},{ 3103, 2224},{ 3617, 2305},
-        { 4112, 2371},{ 4591, 2413},{ 5034, 2436},{ 5444, 2450},
-        { 5823, 2447},{ 6169, 2436},{ 6506, 2430},{ 6818, 2423},
-        { 7099, 2421},{ 7379, 2419},{ 7632, 2415},{ 7887, 2427}
+        {  -21,   32},{  270, 1281},{ 1363, 2138},{ 3214, 2584},
+        { 4482, 3064},{ 5466, 3465},{ 6797, 3363},{ 7951, 3267},
+        { 8981, 3215},{ 9907, 3174},{10741, 3157},{11324, 3160},
+        {11845, 3105},{12522, 3122},{13298, 3079},{13845, 3114},
+        {14506, 3173},{15014, 3226},{15564, 3275},{16103, 3303},
+        {16556, 3308},{17007, 3349},{17591, 3380},{18149, 3412}
       }
     }
   },
@@ -3716,61 +3716,61 @@
     {
       /*Y'  qi=59  INTRA*/
       {
-        {   77,  118},{ 1211, 1206},{ 2606, 1813},{ 3987, 1974},
-        { 5104, 1996},{ 6120, 2050},{ 7101, 2124},{ 8017, 2205},
-        { 8864, 2288},{ 9640, 2368},{10337, 2439},{10924, 2485},
-        {11464, 2528},{12016, 2583},{12584, 2641},{13134, 2702},
-        {13634, 2755},{14139, 2791},{14586, 2819},{14935, 2839},
-        {15293, 2855},{15680, 2880},{16067, 2895},{16497, 2916}
+        {  144,  165},{ 1437, 1030},{ 2672, 1550},{ 3675, 1759},
+        { 4595, 1838},{ 5515, 1917},{ 6914, 2101},{ 8356, 2317},
+        { 9157, 2428},{ 9769, 2512},{10380, 2602},{10845, 2633},
+        {11272, 2657},{11744, 2709},{12293, 2792},{12924, 2898},
+        {13415, 2960},{13886, 3001},{14347, 3041},{14670, 3062},
+        {14968, 3077},{15339, 3115},{15845, 3148},{16475, 3170}
       },
       /*Y'  qi=59  INTER*/
       {
-        {  -97,   52},{  615, 1265},{ 2448, 1926},{ 4597, 2262},
-        { 6529, 2387},{ 8051, 2415},{ 9307, 2430},{10397, 2444},
-        {11355, 2456},{12199, 2465},{12962, 2472},{13659, 2479},
-        {14294, 2486},{14890, 2493},{15450, 2499},{15975, 2503},
-        {16478, 2509},{16958, 2513},{17413, 2516},{17838, 2520},
-        {18260, 2521},{18653, 2521},{19009, 2521},{19314, 2518}
+        {   21,   34},{  228, 1273},{ 1370, 2146},{ 3381, 2619},
+        { 5569, 2751},{ 7297, 2747},{ 8612, 2753},{ 9720, 2749},
+        {10675, 2743},{11508, 2748},{12268, 2763},{12956, 2777},
+        {13574, 2787},{14152, 2798},{14683, 2806},{15177, 2812},
+        {15656, 2818},{16131, 2827},{16570, 2833},{16967, 2838},
+        {17373, 2844},{17757, 2848},{18083, 2846},{18311, 2838}
       }
     },
     {
       /*Cb  qi=59  INTRA*/
       {
-        {   57,    4},{  268,  375},{  442,  727},{  644, 1037},
-        {  911, 1277},{ 1196, 1461},{ 1484, 1603},{ 1777, 1710},
-        { 2040, 1820},{ 2273, 1940},{ 2509, 2045},{ 2755, 2123},
-        { 2992, 2188},{ 3211, 2264},{ 3415, 2346},{ 3607, 2436},
-        { 3787, 2518},{ 3956, 2595},{ 4123, 2666},{ 4314, 2716},
-        { 4506, 2758},{ 4679, 2809},{ 4842, 2859},{ 5040, 2887}
+        {   13,   28},{  950, 1129},{ 1953, 1806},{ 2833, 2270},
+        { 3589, 2685},{ 4343, 3026},{ 4995, 3213},{ 5460, 3319},
+        { 5895, 3391},{ 6393, 3506},{ 6999, 3671},{ 7501, 3754},
+        { 7966, 3856},{ 8436, 4004},{ 8812, 4058},{ 9414, 4106},
+        { 9820, 4160},{ 9953, 4172},{10280, 4185},{10795, 4250},
+        {11107, 4149},{11040, 4075},{11621, 4301},{12087, 4524}
       },
       /*Cb  qi=59  INTER*/
       {
-        {  206,   13},{  214,  364},{  248,  673},{  387,  987},
-        {  670, 1261},{ 1029, 1483},{ 1425, 1663},{ 1854, 1810},
-        { 2319, 1936},{ 2832, 2041},{ 3382, 2125},{ 3931, 2197},
-        { 4457, 2250},{ 4945, 2284},{ 5403, 2306},{ 5846, 2319},
-        { 6267, 2332},{ 6673, 2345},{ 7073, 2364},{ 7440, 2380},
-        { 7801, 2397},{ 8163, 2409},{ 8496, 2415},{ 8729, 2411}
+        {   20,   28},{  235, 1296},{ 1459, 2098},{ 3450, 2494},
+        { 4842, 2939},{ 5945, 3320},{ 7382, 3319},{ 8685, 3268},
+        { 9816, 3188},{10726, 3102},{11582, 3051},{12323, 3009},
+        {13019, 2996},{13721, 2989},{14392, 2982},{15068, 3046},
+        {15712, 3058},{16386, 3070},{17085, 3091},{17615, 3099},
+        {18116, 3145},{18915, 3158},{19565, 3168},{20270, 3181}
       }
     },
     {
       /*Cr  qi=59  INTRA*/
       {
-        {   76,   10},{  261,  397},{  428,  753},{  657, 1053},
-        {  922, 1277},{ 1204, 1445},{ 1501, 1575},{ 1782, 1690},
-        { 2054, 1797},{ 2312, 1898},{ 2553, 1996},{ 2777, 2091},
-        { 2989, 2179},{ 3200, 2259},{ 3409, 2322},{ 3588, 2366},
-        { 3745, 2409},{ 3928, 2465},{ 4100, 2533},{ 4256, 2597},
-        { 4424, 2654},{ 4587, 2720},{ 4753, 2783},{ 4918, 2813}
+        {   28,   43},{  976, 1124},{ 1989, 1774},{ 2866, 2224},
+        { 3568, 2563},{ 4245, 2875},{ 4966, 3139},{ 5549, 3328},
+        { 6163, 3581},{ 6669, 3680},{ 7021, 3673},{ 7314, 3732},
+        { 7564, 3764},{ 8153, 3852},{ 8536, 3959},{ 8757, 4026},
+        { 9438, 4126},{ 9718, 4193},{ 9890, 4178},{10196, 4176},
+        {10500, 4197},{11032, 4219},{11189, 4247},{11490, 4269}
       },
       /*Cr  qi=59  INTER*/
       {
-        {  179,   12},{  204,  368},{  234,  680},{  374,  993},
-        {  650, 1263},{  983, 1492},{ 1344, 1694},{ 1776, 1856},
-        { 2289, 1973},{ 2846, 2064},{ 3401, 2146},{ 3943, 2218},
-        { 4462, 2272},{ 4941, 2305},{ 5382, 2322},{ 5794, 2329},
-        { 6170, 2328},{ 6513, 2316},{ 6831, 2309},{ 7127, 2307},
-        { 7424, 2308},{ 7726, 2310},{ 7981, 2305},{ 8214, 2307}
+        {  -15,   31},{  290, 1271},{ 1488, 2097},{ 3499, 2481},
+        { 4830, 2916},{ 5881, 3248},{ 7217, 3153},{ 8398, 3083},
+        { 9471, 3053},{10455, 3053},{11379, 3082},{12192, 3096},
+        {12893, 3114},{13489, 3128},{14171, 3088},{14444, 3083},
+        {14947, 3089},{15319, 3126},{15745, 3123},{16276, 3130},
+        {16650, 3138},{17061, 3162},{17511, 3172},{17933, 3182}
       }
     }
   },
@@ -3778,61 +3778,61 @@
     {
       /*Y'  qi=60  INTRA*/
       {
-        {   79,  120},{ 1292, 1198},{ 2759, 1784},{ 4168, 1930},
-        { 5290, 1944},{ 6327, 1987},{ 7340, 2048},{ 8296, 2114},
-        { 9182, 2180},{ 9993, 2245},{10718, 2303},{11331, 2338},
-        {11896, 2369},{12474, 2412},{13067, 2459},{13645, 2507},
-        {14171, 2553},{14697, 2583},{15169, 2602},{15533, 2614},
-        {15907, 2626},{16321, 2646},{16736, 2658},{17204, 2683}
+        {  107,  161},{ 1583, 1003},{ 3155, 1594},{ 4629, 1938},
+        { 5967, 2015},{ 7073, 2063},{ 8016, 2168},{ 8815, 2284},
+        { 9477, 2367},{10095, 2442},{10719, 2528},{11187, 2560},
+        {11618, 2582},{12100, 2630},{12677, 2710},{13308, 2811},
+        {13804, 2872},{14324, 2909},{14785, 2939},{15091, 2963},
+        {15428, 2985},{15830, 3022},{16315, 3051},{16951, 3087}
       },
       /*Y'  qi=60  INTER*/
       {
-        { -152,   60},{  668, 1259},{ 2600, 1890},{ 4845, 2186},
-        { 6826, 2281},{ 8373, 2295},{ 9654, 2299},{10764, 2303},
-        {11734, 2307},{12588, 2310},{13359, 2312},{14068, 2315},
-        {14714, 2318},{15316, 2321},{15883, 2323},{16421, 2327},
-        {16931, 2330},{17412, 2330},{17873, 2331},{18305, 2334},
-        {18723, 2335},{19134, 2335},{19493, 2334},{19833, 2338}
+        {   20,   34},{  231, 1271},{ 1503, 2114},{ 3677, 2538},
+        { 5937, 2625},{ 7667, 2604},{ 8999, 2606},{10107, 2613},
+        {11052, 2614},{11874, 2616},{12622, 2628},{13314, 2641},
+        {13943, 2653},{14526, 2664},{15061, 2671},{15567, 2677},
+        {16055, 2684},{16519, 2689},{16963, 2695},{17384, 2701},
+        {17789, 2705},{18170, 2707},{18505, 2710},{18803, 2713}
       }
     },
     {
       /*Cb  qi=60  INTRA*/
       {
-        {   57,    4},{  274,  375},{  460,  727},{  688, 1035},
-        {  991, 1271},{ 1311, 1448},{ 1629, 1580},{ 1948, 1676},
-        { 2237, 1776},{ 2501, 1883},{ 2768, 1975},{ 3041, 2041},
-        { 3303, 2096},{ 3548, 2163},{ 3782, 2235},{ 4007, 2313},
-        { 4211, 2383},{ 4407, 2450},{ 4595, 2511},{ 4801, 2552},
-        { 5014, 2580},{ 5210, 2615},{ 5386, 2660},{ 5575, 2707}
+        {   18,   25},{ 1058, 1106},{ 2130, 1760},{ 3045, 2223},
+        { 3818, 2641},{ 4595, 2978},{ 5331, 3197},{ 5876, 3330},
+        { 6325, 3402},{ 6895, 3483},{ 7499, 3594},{ 7986, 3667},
+        { 8617, 3767},{ 9128, 3901},{ 9333, 3907},{10212, 3992},
+        {10880, 4086},{10824, 4009},{10879, 3948},{11349, 4092},
+        {11476, 4041},{11598, 3998},{12029, 4139},{12352, 4192}
       },
       /*Cb  qi=60  INTER*/
       {
-        {  205,   11},{  219,  362},{  258,  671},{  422,  982},
-        {  728, 1252},{ 1099, 1470},{ 1504, 1645},{ 1950, 1786},
-        { 2442, 1904},{ 2985, 2001},{ 3565, 2079},{ 4138, 2143},
-        { 4670, 2188},{ 5160, 2212},{ 5624, 2225},{ 6074, 2233},
-        { 6503, 2238},{ 6918, 2248},{ 7343, 2261},{ 7740, 2269},
-        { 8098, 2280},{ 8455, 2291},{ 8792, 2296},{ 9110, 2311}
+        {  -24,   21},{  235, 1294},{ 1599, 2061},{ 3725, 2418},
+        { 5818, 2414},{ 7382, 2401},{ 8781, 2442},{ 9969, 2471},
+        {10951, 2482},{11840, 2497},{12639, 2496},{13316, 2484},
+        {14129, 2511},{14785, 2522},{15297, 2514},{15941, 2543},
+        {16795, 2559},{17320, 2587},{17790, 2591},{18432, 2583},
+        {18730, 2570},{19482, 2602},{19993, 2601},{20546, 2608}
       }
     },
     {
       /*Cr  qi=60  INTRA*/
       {
-        {   76,   10},{  268,  396},{  449,  751},{  710, 1047},
-        { 1009, 1268},{ 1321, 1431},{ 1646, 1553},{ 1956, 1658},
-        { 2258, 1752},{ 2549, 1842},{ 2822, 1930},{ 3076, 2013},
-        { 3314, 2086},{ 3549, 2154},{ 3780, 2203},{ 3977, 2240},
-        { 4152, 2280},{ 4347, 2328},{ 4531, 2388},{ 4702, 2438},
-        { 4886, 2485},{ 5069, 2540},{ 5245, 2595},{ 5431, 2626}
+        {   33,   33},{ 1098, 1083},{ 2194, 1706},{ 3087, 2173},
+        { 3811, 2535},{ 4497, 2842},{ 5243, 3093},{ 5878, 3256},
+        { 6510, 3430},{ 7081, 3519},{ 7602, 3570},{ 7849, 3647},
+        { 8053, 3697},{ 8592, 3739},{ 8892, 3814},{ 9226, 3969},
+        {10485, 4158},{10825, 4235},{11456, 4318},{12141, 4427},
+        {12827, 4536},{13512, 4645},{14198, 4754},{14883, 4863}
       },
       /*Cr  qi=60  INTER*/
       {
-        {  190,   10},{  216,  366},{  247,  678},{  406,  988},
-        {  706, 1254},{ 1052, 1478},{ 1426, 1674},{ 1880, 1829},
-        { 2423, 1938},{ 3009, 2023},{ 3594, 2096},{ 4157, 2158},
-        { 4685, 2204},{ 5171, 2229},{ 5615, 2239},{ 6019, 2240},
-        { 6395, 2238},{ 6737, 2232},{ 7045, 2224},{ 7359, 2218},
-        { 7648, 2217},{ 7929, 2212},{ 8197, 2210},{ 8324, 2206}
+        {  -73,   31},{  296, 1269},{ 1635, 2060},{ 3786, 2396},
+        { 5801, 2373},{ 7278, 2354},{ 8479, 2370},{ 9548, 2395},
+        {10518, 2397},{11369, 2415},{12146, 2480},{12780, 2492},
+        {13447, 2481},{14047, 2461},{14715, 2489},{15441, 2484},
+        {15990, 2472},{16616, 2467},{17242, 2462},{17868, 2457},
+        {18421, 2428},{19039, 2420},{19656, 2412},{20273, 2404}
       }
     }
   },
@@ -3840,61 +3840,61 @@
     {
       /*Y'  qi=61  INTRA*/
       {
-        {  151,  132},{ 1420, 1188},{ 2960, 1744},{ 4401, 1874},
-        { 5526, 1881},{ 6583, 1914},{ 7630, 1960},{ 8628, 2009},
-        { 9560, 2057},{10413, 2103},{11184, 2144},{11827, 2167},
-        {12420, 2187},{13035, 2218},{13663, 2251},{14277, 2288},
-        {14839, 2325},{15391, 2346},{15880, 2356},{16265, 2364},
-        {16665, 2372},{17107, 2386},{17537, 2393},{18014, 2419}
+        {   98,  151},{ 1698,  979},{ 3484, 1497},{ 5078, 1774},
+        { 6429, 1842},{ 7560, 1896},{ 8547, 2008},{ 9300, 2130},
+        { 9872, 2208},{10474, 2266},{11093, 2327},{11541, 2344},
+        {11978, 2363},{12486, 2404},{13067, 2464},{13701, 2543},
+        {14241, 2602},{14801, 2639},{15318, 2666},{15670, 2684},
+        {16018, 2700},{16472, 2736},{16993, 2755},{17662, 2799}
       },
       /*Y'  qi=61  INTER*/
       {
-        { -211,   68},{  714, 1252},{ 2759, 1850},{ 5090, 2104},
-        { 7114, 2170},{ 8687, 2171},{ 9997, 2164},{11137, 2158},
-        {12139, 2154},{13026, 2149},{13826, 2146},{14560, 2144},
-        {15240, 2142},{15879, 2141},{16473, 2140},{17037, 2140},
-        {17568, 2139},{18077, 2137},{18561, 2136},{19019, 2136},
-        {19467, 2137},{19886, 2136},{20271, 2135},{20658, 2137}
+        {    6,   31},{  253, 1262},{ 1751, 2055},{ 4229, 2381},
+        { 6615, 2397},{ 8345, 2374},{ 9705, 2372},{10856, 2373},
+        {11833, 2372},{12678, 2371},{13444, 2373},{14151, 2378},
+        {14798, 2384},{15402, 2391},{15966, 2396},{16494, 2401},
+        {17003, 2405},{17499, 2406},{17965, 2409},{18382, 2413},
+        {18813, 2415},{19219, 2416},{19561, 2418},{19890, 2419}
       }
     },
     {
       /*Cb  qi=61  INTRA*/
       {
-        {   52,    4},{  273,  374},{  469,  726},{  718, 1030},
-        { 1036, 1261},{ 1370, 1431},{ 1709, 1553},{ 2050, 1638},
-        { 2365, 1726},{ 2661, 1820},{ 2953, 1899},{ 3246, 1954},
-        { 3527, 1998},{ 3796, 2053},{ 4049, 2115},{ 4289, 2182},
-        { 4515, 2243},{ 4746, 2297},{ 4956, 2345},{ 5166, 2377},
-        { 5392, 2396},{ 5602, 2426},{ 5797, 2465},{ 6007, 2505}
+        {   -2,   42},{ 1013, 1113},{ 2149, 1724},{ 3146, 2127},
+        { 3990, 2472},{ 4793, 2733},{ 5544, 2874},{ 6127, 2959},
+        { 6602, 3051},{ 7209, 3137},{ 7878, 3229},{ 8420, 3303},
+        { 9053, 3391},{ 9555, 3502},{ 9783, 3538},{10561, 3571},
+        {11101, 3594},{10826, 3576},{10982, 3582},{11837, 3668},
+        {12349, 3665},{12509, 3608},{13044, 3736},{13391, 3760}
       },
       /*Cb  qi=61  INTER*/
       {
-        {  195,   12},{  218,  359},{  258,  669},{  431,  979},
-        {  756, 1245},{ 1153, 1457},{ 1585, 1626},{ 2054, 1760},
-        { 2569, 1870},{ 3138, 1959},{ 3738, 2031},{ 4325, 2086},
-        { 4865, 2122},{ 5368, 2139},{ 5848, 2147},{ 6307, 2150},
-        { 6752, 2151},{ 7182, 2157},{ 7616, 2166},{ 8027, 2168},
-        { 8408, 2174},{ 8789, 2185},{ 9148, 2186},{ 9552, 2191}
+        {    3,   36},{  270, 1278},{ 1824, 1999},{ 4086, 2317},
+        { 5524, 2759},{ 6828, 3005},{ 8382, 2977},{ 9756, 2921},
+        {10901, 2839},{11888, 2756},{12810, 2705},{13559, 2665},
+        {14275, 2644},{14977, 2620},{15565, 2606},{16269, 2633},
+        {17002, 2628},{17424, 2626},{18067, 2593},{18685, 2598},
+        {19303, 2628},{19738, 2629},{20134, 2618},{20682, 2618}
       }
     },
     {
       /*Cr  qi=61  INTRA*/
       {
-        {   71,    9},{  269,  395},{  463,  749},{  743, 1041},
-        { 1054, 1256},{ 1380, 1412},{ 1726, 1525},{ 2058, 1619},
-        { 2385, 1704},{ 2698, 1783},{ 2999, 1858},{ 3282, 1927},
-        { 3538, 1990},{ 3789, 2046},{ 4033, 2083},{ 4247, 2112},
-        { 4437, 2144},{ 4649, 2186},{ 4857, 2233},{ 5038, 2275},
-        { 5231, 2319},{ 5444, 2360},{ 5643, 2396},{ 5856, 2402}
+        {    9,   64},{ 1056, 1097},{ 2190, 1695},{ 3167, 2088},
+        { 3957, 2376},{ 4718, 2626},{ 5529, 2836},{ 6270, 3003},
+        { 6941, 3147},{ 7466, 3212},{ 7964, 3257},{ 8313, 3303},
+        { 8598, 3294},{ 8989, 3327},{ 9333, 3426},{ 9664, 3565},
+        {10715, 3696},{11194, 3682},{10744, 3545},{10975, 3557},
+        {11279, 3581},{11828, 3606},{12086, 3625},{12414, 3636}
       },
       /*Cr  qi=61  INTER*/
       {
-        {  182,   11},{  213,  364},{  247,  677},{  415,  985},
-        {  735, 1247},{ 1107, 1466},{ 1508, 1655},{ 1991, 1801},
-        { 2558, 1903},{ 3165, 1981},{ 3770, 2047},{ 4348, 2099},
-        { 4885, 2131},{ 5382, 2148},{ 5832, 2159},{ 6244, 2163},
-        { 6618, 2156},{ 6956, 2149},{ 7279, 2145},{ 7598, 2142},
-        { 7900, 2139},{ 8193, 2136},{ 8471, 2136},{ 8674, 2148}
+        {  -33,   40},{  339, 1251},{ 1864, 2002},{ 4133, 2306},
+        { 5470, 2759},{ 6722, 2935},{ 8105, 2818},{ 9284, 2752},
+        {10368, 2713},{11311, 2683},{12228, 2656},{12952, 2644},
+        {13594, 2614},{14398, 2603},{15048, 2613},{15687, 2627},
+        {16234, 2649},{16767, 2684},{17193, 2729},{17686, 2679},
+        {18000, 2702},{18601, 2744},{19197, 2769},{19730, 2787}
       }
     }
   },
@@ -3902,61 +3902,61 @@
     {
       /*Y'  qi=62  INTRA*/
       {
-        {  212,  140},{ 1522, 1182},{ 3130, 1716},{ 4593, 1835},
-        { 5717, 1837},{ 6787, 1865},{ 7859, 1904},{ 8888, 1946},
-        { 9847, 1987},{10727, 2026},{11526, 2060},{12190, 2079},
-        {12807, 2094},{13442, 2118},{14095, 2146},{14735, 2176},
-        {15318, 2208},{15889, 2228},{16397, 2238},{16802, 2242},
-        {17221, 2248},{17683, 2261},{18137, 2267},{18658, 2281}
+        {   72,  153},{ 1765,  965},{ 3685, 1487},{ 5434, 1730},
+        { 6917, 1759},{ 8084, 1805},{ 9095, 1882},{ 9962, 1956},
+        {10688, 2004},{11367, 2045},{12055, 2101},{12554, 2121},
+        {13023, 2131},{13562, 2158},{14199, 2208},{14921, 2275},
+        {15482, 2319},{16024, 2347},{16523, 2361},{16888, 2370},
+        {17274, 2384},{17734, 2407},{18255, 2423},{18923, 2472}
       },
       /*Y'  qi=62  INTER*/
       {
-        { -316,   78},{  799, 1240},{ 2994, 1795},{ 5432, 2010},
-        { 7508, 2055},{ 9112, 2049},{10456, 2037},{11634, 2027},
-        {12673, 2019},{13595, 2013},{14436, 2007},{15205, 2003},
-        {15915, 2000},{16587, 1999},{17214, 1996},{17813, 1995},
-        {18382, 1994},{18929, 1992},{19448, 1990},{19927, 1989},
-        {20389, 1988},{20829, 1987},{21237, 1987},{21680, 1987}
+        {   -1,   35},{  275, 1254},{ 2024, 1982},{ 4787, 2194},
+        { 7204, 2173},{ 8917, 2164},{10344, 2148},{11561, 2127},
+        {12581, 2114},{13470, 2107},{14280, 2105},{15029, 2104},
+        {15711, 2102},{16341, 2102},{16926, 2103},{17474, 2103},
+        {17991, 2103},{18500, 2102},{18982, 2103},{19418, 2105},
+        {19849, 2104},{20273, 2106},{20620, 2106},{20907, 2110}
       }
     },
     {
       /*Cb  qi=62  INTRA*/
       {
-        {   49,    4},{  277,  374},{  486,  724},{  756, 1024},
-        { 1095, 1249},{ 1451, 1413},{ 1813, 1529},{ 2175, 1607},
-        { 2508, 1688},{ 2826, 1774},{ 3137, 1846},{ 3445, 1896},
-        { 3737, 1936},{ 4017, 1986},{ 4290, 2041},{ 4552, 2099},
-        { 4789, 2154},{ 5024, 2202},{ 5243, 2246},{ 5471, 2275},
-        { 5706, 2292},{ 5914, 2317},{ 6119, 2348},{ 6348, 2368}
+        {    8,   31},{ 1327, 1048},{ 2650, 1617},{ 3782, 1994},
+        { 4774, 2326},{ 5715, 2574},{ 6518, 2688},{ 7130, 2745},
+        { 7600, 2794},{ 8130, 2811},{ 8777, 2856},{ 9293, 2891},
+        { 9999, 2980},{10659, 3100},{10924, 3120},{11829, 3144},
+        {12418, 3163},{11987, 3187},{12053, 3189},{12884, 3221},
+        {13135, 3149},{13057, 3100},{13477, 3211},{13646, 3230}
       },
       /*Cb  qi=62  INTER*/
       {
-        {  192,    9},{  221,  357},{  266,  667},{  454,  974},
-        {  819, 1231},{ 1256, 1434},{ 1720, 1594},{ 2219, 1720},
-        { 2763, 1820},{ 3362, 1901},{ 3994, 1963},{ 4605, 2010},
-        { 5163, 2039},{ 5673, 2054},{ 6161, 2059},{ 6635, 2056},
-        { 7087, 2055},{ 7538, 2057},{ 7986, 2059},{ 8400, 2061},
-        { 8816, 2062},{ 9215, 2070},{ 9567, 2075},{ 9845, 2067}
+        {   29,   39},{  340, 1249},{ 2031, 1942},{ 4024, 2373},
+        { 5741, 2762},{ 7305, 2874},{ 8918, 2836},{10340, 2780},
+        {11507, 2715},{12459, 2652},{13344, 2603},{14111, 2575},
+        {14853, 2551},{15497, 2525},{16196, 2515},{16992, 2507},
+        {17633, 2516},{18239, 2529},{18872, 2508},{19519, 2516},
+        {19999, 2503},{20436, 2536},{20847, 2537},{21336, 2555}
       }
     },
     {
       /*Cr  qi=62  INTRA*/
       {
-        {   72,   10},{  274,  397},{  482,  747},{  784, 1033},
-        { 1113, 1244},{ 1462, 1394},{ 1831, 1499},{ 2184, 1587},
-        { 2527, 1665},{ 2858, 1738},{ 3175, 1808},{ 3472, 1871},
-        { 3747, 1927},{ 4020, 1977},{ 4271, 2010},{ 4490, 2036},
-        { 4689, 2063},{ 4905, 2099},{ 5122, 2141},{ 5315, 2182},
-        { 5514, 2222},{ 5732, 2258},{ 5948, 2294},{ 6134, 2309}
+        {   18,   43},{ 1373, 1025},{ 2723, 1565},{ 3824, 1941},
+        { 4709, 2230},{ 5552, 2464},{ 6445, 2641},{ 7193, 2767},
+        { 7924, 2875},{ 8519, 2918},{ 8986, 2930},{ 9363, 2955},
+        { 9817, 2968},{10388, 3046},{10750, 3129},{11028, 3234},
+        {12640, 3360},{13236, 3372},{14063, 3401},{14986, 3451},
+        {15908, 3501},{16830, 3551},{17752, 3601},{18674, 3651}
       },
       /*Cr  qi=62  INTER*/
       {
-        {  191,   12},{  219,  363},{  254,  675},{  441,  979},
-        {  796, 1233},{ 1207, 1444},{ 1646, 1623},{ 2161, 1758},
-        { 2759, 1852},{ 3402, 1920},{ 4039, 1976},{ 4641, 2017},
-        { 5193, 2043},{ 5697, 2059},{ 6155, 2066},{ 6571, 2067},
-        { 6944, 2065},{ 7280, 2061},{ 7617, 2056},{ 7921, 2051},
-        { 8215, 2050},{ 8528, 2050},{ 8834, 2045},{ 9092, 2042}
+        {   -4,   45},{  410, 1225},{ 2084, 1944},{ 4057, 2377},
+        { 5664, 2777},{ 7115, 2822},{ 8451, 2735},{ 9623, 2688},
+        {10719, 2658},{11702, 2629},{12647, 2600},{13532, 2572},
+        {14266, 2561},{14804, 2555},{15636, 2523},{16126, 2540},
+        {16905, 2527},{17445, 2508},{17807, 2521},{17795, 2582},
+        {18328, 2562},{19155, 2557},{19619, 2564},{20083, 2571}
       }
     }
   },
@@ -3964,61 +3964,61 @@
     {
       /*Y'  qi=63  INTRA*/
       {
-        {  189,  144},{ 1625, 1169},{ 3329, 1679},{ 4820, 1783},
-        { 5949, 1778},{ 7038, 1796},{ 8150, 1821},{ 9231, 1847},
-        {10239, 1873},{11165, 1896},{12008, 1915},{12714, 1922},
-        {13364, 1928},{14032, 1942},{14719, 1959},{15400, 1979},
-        {16023, 1998},{16624, 2011},{17158, 2017},{17589, 2018},
-        {18034, 2018},{18533, 2025},{19024, 2028},{19594, 2037}
+        {  154,  104},{ 1979,  930},{ 4248, 1309},{ 6003, 1437},
+        { 7351, 1494},{ 8544, 1544},{ 9592, 1600},{10479, 1647},
+        {11284, 1680},{12081, 1710},{12823, 1739},{13394, 1751},
+        {13948, 1757},{14568, 1773},{15251, 1802},{15967, 1835},
+        {16621, 1860},{17256, 1876},{17815, 1883},{18230, 1884},
+        {18687, 1886},{19250, 1895},{19797, 1899},{20520, 1921}
       },
       /*Y'  qi=63  INTER*/
       {
-        { -370,   83},{  845, 1235},{ 3132, 1766},{ 5639, 1953},
-        { 7759, 1979},{ 9395, 1961},{10771, 1939},{11982, 1920},
-        {13057, 1905},{14013, 1892},{14885, 1881},{15690, 1873},
-        {16431, 1865},{17127, 1858},{17777, 1853},{18396, 1847},
-        {18986, 1843},{19560, 1839},{20099, 1834},{20609, 1831},
-        {21083, 1830},{21530, 1828},{21962, 1828},{22387, 1829}
+        {   18,   30},{  294, 1247},{ 2183, 1941},{ 4883, 2157},
+        { 7264, 2158},{ 9143, 2109},{10717, 2052},{12082, 2005},
+        {13276, 1967},{14345, 1928},{15318, 1889},{16190, 1854},
+        {16963, 1828},{17659, 1814},{18298, 1804},{18906, 1795},
+        {19481, 1790},{20048, 1786},{20583, 1781},{21054, 1779},
+        {21531, 1778},{21979, 1775},{22368, 1775},{22724, 1782}
       }
     },
     {
       /*Cb  qi=63  INTRA*/
       {
-        {   50,    4},{  279,  374},{  496,  723},{  795, 1017},
-        { 1170, 1235},{ 1557, 1392},{ 1947, 1497},{ 2340, 1564},
-        { 2714, 1630},{ 3071, 1700},{ 3421, 1757},{ 3757, 1795},
-        { 4077, 1822},{ 4389, 1859},{ 4691, 1901},{ 4987, 1944},
-        { 5261, 1984},{ 5523, 2020},{ 5767, 2058},{ 6010, 2077},
-        { 6255, 2086},{ 6494, 2102},{ 6730, 2121},{ 6950, 2148}
+        { -246,  155},{ 1464, 1018},{ 3078, 1447},{ 4437, 1684},
+        { 5630, 1861},{ 6683, 1981},{ 7533, 2036},{ 8188, 2064},
+        { 8825, 2093},{ 9499, 2116},{10159, 2132},{10750, 2158},
+        {11615, 2227},{12397, 2299},{12871, 2319},{13879, 2348},
+        {14570, 2364},{14302, 2347},{14530, 2362},{15285, 2371},
+        {15230, 2312},{14388, 2248},{15016, 2298},{16713, 2387}
       },
       /*Cb  qi=63  INTER*/
       {
-        {  193,   11},{  220,  356},{  263,  667},{  459,  972},
-        {  846, 1226},{ 1313, 1425},{ 1801, 1580},{ 2314, 1700},
-        { 2871, 1796},{ 3485, 1872},{ 4132, 1928},{ 4757, 1969},
-        { 5322, 1993},{ 5843, 2004},{ 6342, 2005},{ 6830, 2000},
-        { 7302, 1994},{ 7775, 1991},{ 8227, 1989},{ 8660, 1985},
-        { 9087, 1983},{ 9484, 1984},{ 9870, 1980},{10254, 1985}
+        {  -23,   53},{  387, 1239},{ 2143, 1928},{ 4558, 2202},
+        { 6858, 2213},{ 8863, 2164},{10584, 2122},{11998, 2080},
+        {13137, 2043},{14077, 2010},{14971, 1988},{15784, 1973},
+        {16609, 1958},{17300, 1944},{17921, 1934},{18803, 1921},
+        {19452, 1920},{20133, 1933},{20814, 1937},{21447, 1924},
+        {22022, 1949},{22317, 1951},{23370, 1916},{24941, 1915}
       }
     },
     {
       /*Cr  qi=63  INTRA*/
       {
-        {   70,    9},{  277,  395},{  498,  743},{  826, 1023},
-        { 1189, 1227},{ 1569, 1371},{ 1968, 1468},{ 2351, 1545},
-        { 2726, 1608},{ 3094, 1666},{ 3449, 1719},{ 3783, 1767},
-        { 4093, 1812},{ 4389, 1849},{ 4658, 1872},{ 4895, 1890},
-        { 5120, 1910},{ 5354, 1937},{ 5585, 1972},{ 5805, 2002},
-        { 6034, 2035},{ 6276, 2064},{ 6515, 2084},{ 6707, 2081}
+        { -248,  180},{ 1514,  997},{ 3111, 1426},{ 4440, 1652},
+        { 5477, 1802},{ 6452, 1913},{ 7414, 1992},{ 8301, 2060},
+        { 9280, 2145},{ 9941, 2187},{10422, 2193},{10892, 2230},
+        {11328, 2256},{12069, 2280},{12548, 2315},{12773, 2332},
+        {13406, 2345},{13953, 2355},{14412, 2355},{14866, 2387},
+        {15167, 2410},{15876, 2414},{16071, 2426},{15606, 2420}
       },
       /*Cr  qi=63  INTER*/
       {
-        {  187,   12},{  215,  363},{  252,  675},{  448,  977},
-        {  828, 1227},{ 1272, 1432},{ 1734, 1606},{ 2265, 1736},
-        { 2877, 1825},{ 3533, 1890},{ 4183, 1940},{ 4798, 1975},
-        { 5362, 1996},{ 5876, 2007},{ 6343, 2013},{ 6757, 2013},
-        { 7133, 2009},{ 7483, 2005},{ 7809, 2000},{ 8132, 1997},
-        { 8440, 1994},{ 8752, 1990},{ 9050, 1987},{ 9270, 1989}
+        {  -39,   58},{  460, 1218},{ 2175, 1935},{ 4581, 2207},
+        { 6762, 2210},{ 8447, 2142},{ 9788, 2095},{11003, 2066},
+        {12158, 2041},{13135, 2014},{14073, 2004},{14963, 2000},
+        {15629, 1975},{16352, 1950},{17284, 1957},{17690, 1963},
+        {18267, 1944},{18584, 1924},{19123, 1954},{19910, 1979},
+        {20417, 2002},{21016, 1994},{21786, 2002},{22392, 2011}
       }
     }
   }

Modified: branches/theora-gumboot/lib/enc/rate.c
===================================================================
--- branches/theora-gumboot/lib/enc/rate.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/rate.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -19,13 +19,38 @@
 #include "encint.h"
 
 
+/*Search for the quantizer that matches the target most closely.
+  We don't assume a linear ordering, but when there are ties we pick the
+   quantizer closest to the old one.*/
+int oc_enc_find_qi_for_target(oc_enc_ctx *_enc,int _qti,int _qi_old,
+ int _qi_min,ogg_int64_t _log_qtarget){
+  ogg_int64_t best_qdiff;
+  int         best_qi;
+  int         qi;
+  best_qi=_qi_min;
+  best_qdiff=_enc->log_qavg[_qti][best_qi]-_log_qtarget;
+  best_qdiff=best_qdiff+OC_SIGNMASK(best_qdiff)^OC_SIGNMASK(best_qdiff);
+  for(qi=_qi_min+1;qi<64;qi++){
+    ogg_int64_t qdiff;
+    qdiff=_enc->log_qavg[_qti][qi]-_log_qtarget;
+    qdiff=qdiff+OC_SIGNMASK(qdiff)^OC_SIGNMASK(qdiff);
+    if(qdiff<best_qdiff||
+     qdiff==best_qdiff&&abs(qi-_qi_old)<abs(best_qi-_qi_old)){
+      best_qi=qi;
+      best_qdiff=qdiff;
+    }
+  }
+  return best_qi;
+}
 
-void oc_enc_calc_lambda(oc_enc_ctx *_enc,int _frame_type){
+void oc_enc_calc_lambda(oc_enc_ctx *_enc,int _qti){
   ogg_int64_t lq;
   int         qi;
+  int         qi1;
+  int         nqis;
   /*For now, lambda is fixed depending on the qi value and frame type:
       lambda=qscale*(qavg[qti][qi]**2),
-     where qscale=0.31.
+     where qscale=0.2125.
     This was derived by exhaustively searching for the optimal quantizer for
      the AC coefficients in each block from a number of test sequences for a
      number of fixed lambda values and fitting the peaks of the resulting
@@ -38,9 +63,38 @@
      to reach, and give the rate control a semblance of "fractional qi"
      precision.*/
   if(_enc->state.info.target_bitrate>0)lq=_enc->rc.log_qtarget;
-  else lq=_enc->log_qavg[_frame_type][qi];
+  else lq=_enc->log_qavg[_qti][qi];
   /*The resulting lambda value is less than 0x500000.*/
-  _enc->lambda=(int)oc_bexp64(2*lq-0x3611B1986AB1180LL);
+  _enc->lambda=(int)oc_bexp64(2*lq-0x4780BD468D6B62BLL);
+  /*Select additional quantizers.
+    The R-D optimal block AC quantizer statistics suggest that the distribution
+     is roughly Gaussian-like with a slight positive skew.
+    K-means clustering on log_qavg to select 3 quantizers produces cluster
+     centers of {log_qavg-0.6,log_qavg,log_qavg+0.7}.
+    Experiments confirm these are relatively good choices.
+
+    Although we do greedy R-D optimization of the qii flags to avoid switching
+     too frequently, this becomes ineffective at low rates, either because we
+     do a poor job of predicting the actual R-D cost, or the greedy
+     optimization is not sufficient.
+    Therefore adaptive quantization is disabled above an (experimentally
+     suggested) threshold of log_qavg=7.00 (e.g., below INTRA qi=12 or
+     INTER qi=20 with current matrices).
+    This may need to be revised if the R-D cost estimation or qii flag
+     optimization strategies change.*/
+  nqis=1;
+  if(lq<(OC_Q57(56)>>3)&&!_enc->vp3_compatible){
+    qi1=oc_enc_find_qi_for_target(_enc,_qti,OC_MAXI(qi-1,0),0,
+     lq+(OC_Q57(7)+5)/10);
+    if(qi1!=qi)_enc->state.qis[nqis++]=qi1;
+    qi1=oc_enc_find_qi_for_target(_enc,_qti,OC_MINI(qi+1,63),0,
+     lq-(OC_Q57(6)+5)/10);
+    if(qi1!=qi&&qi1!=_enc->state.qis[nqis-1])_enc->state.qis[nqis++]=qi1;
+  }
+  /*printf("%i %.3f:",_qti,oc_bexp64(lq+OC_Q57(3))*0.125);
+  for(qi=0;qi<nqis;qi++)printf(" %2i",_enc->state.qis[qi]);
+  printf("\n");*/
+  _enc->state.nqis=nqis;
 }
 
 
@@ -106,15 +160,28 @@
   _rc->log_drop_scale=OC_Q57(0);
 }
 
-void oc_enc_update_rc_state(oc_enc_ctx *_enc,
- long _bits,int _qti,int _qi,int _trial){
+int oc_enc_update_rc_state(oc_enc_ctx *_enc,
+ long _bits,int _qti,int _qi,int _trial,int _droppable){
   /*Note, setting OC_SCALE_SMOOTHING[1] to 0x80 (0.5), which one might expect
      to be a reasonable value, actually causes a feedback loop with, e.g., 12
      fps content encoded at 24 fps; use values near 0 or near 1 for now.
     TODO: Should probably revisit using an exponential moving average in the
      first place at some point; dup tracking should help as well.*/
   static const unsigned OC_SCALE_SMOOTHING[2]={0x13,0x00};
-  if(_bits>0){
+  ogg_int64_t buf_delta;
+  int         dropped;
+  dropped=0;
+  buf_delta=_enc->rc.bits_per_frame*(1+_enc->dup_count);
+  if(_bits<=0){
+    /*We didn't code any blocks in this frame.
+      Add it to the previous frame's dup count.*/
+    _enc->rc.prev_drop_count+=1+_enc->dup_count;
+    /*If this was the first frame of this type, lower the expected scale, but
+       don't set it to zero outright.*/
+    if(_trial)_enc->rc.log_scale[_qti]>>=1;
+    _bits=0;
+  }
+  else{
     ogg_int64_t log_scale;
     ogg_int64_t log_bits;
     ogg_int64_t log_qexp;
@@ -126,30 +193,34 @@
     /*Use it to set that factor directly if this was a trial.*/
     if(_trial)_enc->rc.log_scale[_qti]=log_scale;
     else{
-      /*Otherwise update an exponential moving average.*/
+      /*Otherwise update an exponential moving average for log_scale,
+         regardless of whether or not we dropped this frame.*/
       _enc->rc.log_scale[_qti]=log_scale
        +(_enc->rc.log_scale[_qti]-log_scale+128>>8)*OC_SCALE_SMOOTHING[_qti];
-      /*And update a simple exponential moving average to estimate the "real"
-         frame rate taking drops and duplicates into account.*/
-      _enc->rc.log_drop_scale=_enc->rc.log_drop_scale
-       +oc_blog64(_enc->rc.prev_drop_count+1)>>1;
-      _enc->rc.prev_drop_count=_enc->dup_count;
+      /*If this frame busts our budget, it must be dropped.*/
+      if(_droppable&&_enc->rc.fullness+buf_delta<_bits){
+        _enc->rc.prev_drop_count+=1+_enc->dup_count;
+        _bits=0;
+        dropped=1;
+      }
+      else{
+        /*Update a simple exponential moving average to estimate the "real"
+           frame rate taking drops and duplicates into account.
+          This is only done if the frame is coded, as it needs the final count
+           of dropped frames.*/
+        _enc->rc.log_drop_scale=_enc->rc.log_drop_scale
+         +oc_blog64(_enc->rc.prev_drop_count+1)>>1;
+        _enc->rc.prev_drop_count=_enc->dup_count;
+      }
     }
   }
-  else{
-    /*We dropped this frame.*/
-    /*Add it to the previous frame's dup count.*/
-    _enc->rc.prev_drop_count+=1+_enc->dup_count;
-    /*If this was the first frame of this type, lower the expected scale, but
-       don't set it to zero outright.*/
-    if(_trial)_enc->rc.log_scale[_qti]>>=1;
-  }
   if(!_trial){
     /*And update the buffer fullness level.*/
-    _enc->rc.fullness+=_enc->rc.bits_per_frame*(1+_enc->dup_count)-_bits;
+    _enc->rc.fullness+=buf_delta-_bits;
     /*If we're too quick filling the buffer, that rate is lost forever.*/
     if(_enc->rc.fullness>_enc->rc.max)_enc->rc.fullness=_enc->rc.max;
   }
+  return dropped;
 }
 
 int oc_enc_select_qi(oc_enc_ctx *_enc,int _qti,int _clamp){
@@ -158,8 +229,7 @@
   int          nframes[2];
   int          buf_delay;
   ogg_int64_t  log_qtarget;
-  int          best_qi;
-  ogg_int64_t  best_qdiff;
+  ogg_int64_t  log_scale0;
   int          old_qi;
   int          qi;
   /*Figure out how to re-distribute bits so that we hit our fullness target
@@ -170,8 +240,8 @@
   nframes[0]=(_enc->rc.buf_delay-OC_MINI(next_key_frame,_enc->rc.buf_delay)
    +_enc->keyframe_frequency_force-1)/_enc->keyframe_frequency_force;
   if(nframes[0]+_qti>1){
-    buf_delay=next_key_frame+(nframes[0]-1)*_enc->keyframe_frequency_force;
     nframes[0]--;
+    buf_delay=next_key_frame+nframes[0]*_enc->keyframe_frequency_force;
   }
   else buf_delay=_enc->rc.buf_delay;
   nframes[1]=buf_delay-nframes[0];
@@ -190,18 +260,17 @@
     }
     else nframes[1]=!!nframes[1];
   }
+  log_scale0=_enc->rc.log_scale[_qti]+_enc->rc.log_npixels;
   /*If there aren't enough bits to achieve our desired fullness level, use the
      minimum quality permitted.*/
   if(rate_total<=buf_delay)log_qtarget=OC_QUANT_MAX_LOG;
   else{
     static const unsigned char KEY_RATIO[2]={32,17};
-    ogg_int64_t   log_scale0;
     ogg_int64_t   log_scale1;
     ogg_int64_t   prevr;
     ogg_int64_t   curr;
     ogg_int64_t   realr;
     int           i;
-    log_scale0=_enc->rc.log_scale[_qti]+_enc->rc.log_npixels;
     log_scale1=_enc->rc.log_scale[1-_qti]+_enc->rc.log_npixels;
     curr=(rate_total+(buf_delay>>1))/buf_delay;
     realr=curr*KEY_RATIO[_qti]+16>>5;
@@ -245,23 +314,29 @@
     log_qmax=_enc->log_qavg[_qti][old_qi]+0x00A4D3C25E68DC58LL;
     log_qtarget=OC_CLAMPI(log_qmin,log_qtarget,log_qmax);
   }
-  /*Search for the quantizer that matches the target most closely.
-    We don't assume a linear ordering, but when there are ties we do pick the
-     quantizer closest to the current one.*/
-  best_qi=_enc->state.info.quality;
-  best_qdiff=_enc->log_qavg[_qti][best_qi]-log_qtarget;
-  best_qdiff=best_qdiff+OC_SIGNMASK(best_qdiff)^OC_SIGNMASK(best_qdiff);
-  for(qi=_enc->state.info.quality+1;qi<64;qi++){
-    ogg_int64_t qdiff;
-    qdiff=_enc->log_qavg[_qti][qi]-log_qtarget;
-    qdiff=qdiff+OC_SIGNMASK(qdiff)^OC_SIGNMASK(qdiff);
-    if(qdiff<best_qdiff||
-     qdiff==best_qdiff&&abs(qi-old_qi)<abs(best_qi-old_qi)){
-      best_qi=qi;
-      best_qdiff=qdiff;
+  /*The above allocation looks only at the total rate we'll accumulate in the
+     next buf_delay frames.
+    However, we could bust the budget on the very next frame, so check for that
+     here.*/
+  {
+    ogg_int64_t log_hard_limit;
+    ogg_int64_t log_qexp;
+    int         exp0;
+    /*Allow 50% of the rate for a single frame for prediction error.
+      This may not be enough for keyframes or sudden changes in complexity.*/
+    log_hard_limit=oc_blog64(_enc->rc.fullness+(_enc->rc.bits_per_frame>>1));
+    exp0=_enc->rc.exp[_qti];
+    log_qexp=log_qtarget-OC_Q57(2);
+    log_qexp=(log_qtarget-OC_Q57(2)>>6)*exp0;
+    if(log_scale0-log_qexp>log_hard_limit){
+      log_qexp=log_scale0-log_hard_limit;
+      log_qtarget=((log_qexp+(exp0>>1))/exp0<<6)+OC_Q57(2);
+      log_qtarget=OC_MINI(log_qtarget,OC_QUANT_MAX_LOG);
     }
   }
+  qi=oc_enc_find_qi_for_target(_enc,_qti,old_qi,
+   _enc->state.info.quality,log_qtarget);
   /*Save the quantizer target for lambda calculations.*/
   _enc->rc.log_qtarget=log_qtarget;
-  return best_qi;
+  return qi;
 }

Modified: branches/theora-gumboot/lib/enc/tokenize.c
===================================================================
--- branches/theora-gumboot/lib/enc/tokenize.c	2009-07-22 20:19:38 UTC (rev 16319)
+++ branches/theora-gumboot/lib/enc/tokenize.c	2009-07-23 00:51:02 UTC (rev 16320)
@@ -254,11 +254,11 @@
   for(zzi=OC_MINI(_zzi,63);zzi>0;zzi--){
     ogg_int32_t  lambda;
     ogg_uint32_t best_cost;
-    int          best_bits;
-    int          best_next;
-    int          best_token;
-    int          best_eb;
-    int          best_qc;
+    int          best_bits=best_bits;
+    int          best_next=best_next;
+    int          best_token=best_token;
+    int          best_eb=best_eb;
+    int          best_qc=best_qc;
     int          flush_bits;
     ogg_uint32_t d2;
     int          dq;
@@ -321,7 +321,7 @@
           bits=flush_bits+oc_token_bits(_enc,huffi,zzi,token);
           d2=sum_d2-d2_accum[zzj];
           cost=d2+lambda*bits+tokens[zzj][1].cost;
-          if(cost<best_cost){
+          if(cost<=best_cost){
             best_next=(zzj<<1)+1;
             best_token=token;
             best_eb=nzeros-1;
@@ -333,24 +333,6 @@
             val=_qdct[zzj];
             val_s=-(val<0);
             val=val+val_s^val_s;
-            if(nzeros<2+dc_reserve&&2<=val&&val<=4){
-              /*Try a +/- 2/3 combo token.*/
-              cat=nzeros>>1;
-              token=OC_DCT_RUN_CAT2A+cat;
-              bits=flush_bits+oc_token_bits(_enc,huffi,zzi,token);
-              val=2+((val+val_s^val_s)>2);
-              e=(_dct[zzj]+val_s^val_s)-_dequant[zzj]*val;
-              d2=e*(ogg_int32_t)e+sum_d2-d2_accum[zzj];
-              cost=d2+lambda*bits+tokens[zzk][tk].cost;
-              if(cost<=best_cost){
-                best_cost=cost;
-                best_bits=bits+tokens[zzk][tk].bits;
-                best_next=next;
-                best_token=token;
-                best_eb=(-val_s<<1+cat)+(val-2<<cat)+(nzeros-1>>1);
-                best_qc=val+val_s^val_s;
-              }
-            }
             if(val<=2){
               /*Try a +/- 1 combo token.*/
               if(nzeros<6){
@@ -375,6 +357,24 @@
                 best_qc=1+val_s^val_s;
               }
             }
+            if(nzeros<2+dc_reserve&&2<=val&&val<=4){
+              /*Try a +/- 2/3 combo token.*/
+              cat=nzeros>>1;
+              token=OC_DCT_RUN_CAT2A+cat;
+              bits=flush_bits+oc_token_bits(_enc,huffi,zzi,token);
+              val=2+((val+val_s^val_s)>2);
+              e=(_dct[zzj]+val_s^val_s)-_dequant[zzj]*val;
+              d2=e*(ogg_int32_t)e+sum_d2-d2_accum[zzj];
+              cost=d2+lambda*bits+tokens[zzk][tk].cost;
+              if(cost<=best_cost){
+                best_cost=cost;
+                best_bits=bits+tokens[zzk][tk].bits;
+                best_next=next;
+                best_token=token;
+                best_eb=(-val_s<<1+cat)+(val-2<<cat)+(nzeros-1>>1);
+                best_qc=val+val_s^val_s;
+              }
+            }
           }
           /*zzj can't be coded as a zero, so stop trying to extend the run.*/
           if(!(zflags>>zzj&1))break;
@@ -677,8 +677,7 @@
     eob=eob_run[zzi];
     if(tokens[zzi][ti].token<OC_NDCT_EOB_TOKEN_MAX){
       if(++eob>=4095){
-        token=oc_make_eob_token_full(eob,&eb);
-        oc_enc_token_log(_enc,_pli,zzi,token,eb);
+        oc_enc_eob_log(_enc,_pli,zzi,eob);
         eob=0;
       }
       eob_run[zzi]=eob;
@@ -718,7 +717,6 @@
   ptrdiff_t                fragi;
   int                     *pred_last;
   int                      nhfrags;
-  int                      nvfrags;
   int                      fragx;
   int                      fragy;
   fplane=_enc->state.fplanes+_pli;
@@ -726,7 +724,6 @@
   frag_dc=_enc->frag_dc;
   pred_last=_enc->dc_pred_last[_pli];
   nhfrags=fplane->nhfrags;
-  nvfrags=fplane->nvfrags;
   fragi=fplane->froffset+_fragy0*nhfrags;
   for(fragy=_fragy0;fragy<_frag_yend;fragy++){
     for(fragx=0;fragx<nhfrags;fragx++,fragi++){
@@ -756,10 +753,8 @@
   int                neobs1;
   int                token;
   int                eb;
-  /*eb1 and token1 are always initialized before use; if your compiler thinks
-     otherwise, it is dumb.*/
-  int                token1;
-  int                eb1;
+  int                token1=token1;
+  int                eb1=eb1;
   /*Return immediately if there are no coded fragments; otherwise we'd flush
      any trailing EOB run into the AC 1 list and never read it back out.*/
   if(_ncoded_fragis<=0)return;
@@ -998,9 +993,7 @@
     int       new_eb;
     int       zzj;
     int       plj;
-    /*ti is always initialized before use; if your compiler thinks otherwise,
-       it is dumb.*/
-    ptrdiff_t ti;
+    ptrdiff_t ti=ti;
     int       run_count;
     /*Make sure this coefficient has tokens at all.*/
     if(_enc->ndct_tokens[pli][zzi]<=0)continue;



More information about the commits mailing list