[xiph-commits] r14381 - branches/theora-thusnelda/lib/enc

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Jan 8 15:41:27 PST 2008


Author: xiphmont
Date: 2008-01-08 15:41:13 -0800 (Tue, 08 Jan 2008)
New Revision: 14381

Added:
   branches/theora-thusnelda/lib/enc/mcenc.c
   branches/theora-thusnelda/lib/enc/mode.c
   branches/theora-thusnelda/lib/enc/mode_select.h
Removed:
   branches/theora-thusnelda/lib/enc/mcomp.c
Modified:
   branches/theora-thusnelda/lib/enc/codec_internal.h
   branches/theora-thusnelda/lib/enc/encode.c
   branches/theora-thusnelda/lib/enc/encoder_lookup.h
   branches/theora-thusnelda/lib/enc/frinit.c
Log:
Move in-progress work to repository to avoid losing work



Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h	2008-01-08 16:57:35 UTC (rev 14380)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h	2008-01-08 23:41:13 UTC (rev 14381)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2005                *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2008                *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -114,9 +114,30 @@
   /* the blocks comprising this macroblock */
   int yuv[3][4]; /* [Y,U,V][raster order] */
 
+  int cneighbors[4];      
+  int ncneighbors;
+  int pneighbors[4];
+  int npneighbors; 
+
   coding_mode_t mode;
+
+  /* per-block final motion vectors */
   mv_t mv[4];
 
+  /* Motion vectors for a macro block for the current frame and the
+     previous two frames.
+
+     Each is a set of 2 vectors against the previous frame and against
+     the golden frame, which can be used to judge constant velocity
+     and constant acceleration.
+
+     Uninitialized MVs are (0,0).*/
+  mv_t   analysis_mv[3][2]; /* [cur,prev,prev2][frame,golden] */
+  /*Minimum motion estimation error from the analysis stage.*/
+  int    aerror;
+  /*Minimum 4V motion estimation error from the analysis stage.*/
+  int    aerror4mv;
+
   char coded;
 } macroblock_t;
 
@@ -132,6 +153,27 @@
 typedef ogg_int32_t    iquant_table[64];
 typedef iquant_table   iquant_tables[64];
 
+struct oc_mode_scheme_chooser{
+  const int          *mode_bits[8];
+  /*Pointers to the a list containing the index of each mode in the mode
+    alphabet used by each scheme.
+    The first entry points to the dynamic scheme0_ranks, while the remaining
+    7 point to the constant entries stored in OC_MODE_SCHEMES.*/
+  const int          *mode_ranks[8];
+  /*The ranks for each mode when coded with scheme 0.
+    These are optimized so that the more frequent modes have lower ranks.*/
+  int                 scheme0_ranks[OC_NMODES];
+  /*The list of modes, sorted in descending order of frequency, that
+    corresponds to the ranks above.*/
+  int                 scheme0_list[OC_NMODES];
+  /*The number of times each mode has been chosen so far.*/
+  int                 mode_counts[OC_NMODES];
+  /*The list of mode coding schemes, sorted in ascending order of bit cost.*/
+  int                 scheme_list[8];
+  /*The number of bits used by each mode coding scheme.*/
+  int                 scheme_bits[8];
+};
+
 /* Encoder (Compressor) instance -- installed in a theora_state */
 typedef struct CP_INSTANCE {
   /*This structure must be first.
@@ -205,7 +247,7 @@
   ogg_uint32_t     dc_bits[2][DC_HUFF_CHOICES];
   ogg_uint32_t     ac_bits[2][AC_HUFF_CHOICES];
 
-  ogg_int32_t      ModeCount[MAX_MODES]; /* Frequency count of modes */
+  oc_mode_scheme_chooser chooser;
 
   ogg_uint32_t     MVBits_0; /* count of bits used by MV coding mode 0 */
   ogg_uint32_t     MVBits_1; /* count of bits used by MV coding mode 1 */
@@ -219,29 +261,6 @@
   int              InterPrediction;
   int              MotionCompensation;
 
-  /* Controlling Block Selection */
-  ogg_uint32_t     MVChangeFactor;
-  ogg_uint32_t     FourMvChangeFactor;
-  ogg_uint32_t     MinImprovementForNewMV;
-  ogg_uint32_t     ExhaustiveSearchThresh;
-  ogg_uint32_t     MinImprovementForFourMV;
-  ogg_uint32_t     FourMVThreshold;
-
-  /*********************************************************************/
-
-  ogg_int32_t      MVPixelOffsetY[MAX_SEARCH_SITES];
-  ogg_uint32_t     InterTripOutThresh;
-  unsigned char    MVEnabled;
-  ogg_uint32_t     MotionVectorSearchCount;
-  ogg_uint32_t     FrameMVSearcOunt;
-  ogg_int32_t      MVSearchSteps;
-  ogg_int32_t      MVOffsetX[MAX_SEARCH_SITES];
-  ogg_int32_t      MVOffsetY[MAX_SEARCH_SITES];
-  ogg_int32_t      HalfPixelRef2Offset[9]; /* Offsets for half pixel
-                                               compensation */
-  signed char      HalfPixelXOffset[9];    /* Half pixel MV offsets for X */
-  signed char      HalfPixelYOffset[9];    /* Half pixel MV offsets for Y */
-
   /* hufftables and quant setup ****************************************/
 
   HUFF_ENTRY      *HuffRoot_VP3x[NUM_HUFF_TABLES];
@@ -290,40 +309,10 @@
 
 extern void PackAndWriteDFArray( CP_INSTANCE *cpi );
 
-extern void InitMotionCompensation ( CP_INSTANCE *cpi );
-
-extern ogg_uint32_t GetMBIntraError (CP_INSTANCE *cpi, 
-				     macroblock_t *mp );
-
-extern ogg_uint32_t GetMBInterError (CP_INSTANCE *cpi,
-                                     unsigned char *SrcPtr,
-                                     unsigned char *RefPtr,
-				     macroblock_t *mp,
-                                     ogg_int32_t LastXMV,
-                                     ogg_int32_t LastYMV );
-
 extern void WriteFrameHeader( CP_INSTANCE *cpi) ;
 
-extern ogg_uint32_t GetMBMVInterError (CP_INSTANCE *cpi,
-                                       unsigned char *RefFramePtr,
-				       macroblock_t *mp,
-                                       ogg_int32_t *MVPixelOffset,
-                                       mv_t *MV );
-
-extern ogg_uint32_t GetMBMVExhaustiveSearch (CP_INSTANCE *cpi,
-                                             unsigned char *RefFramePtr,
-					     macroblock_t *mp,
-                                             mv_t *MV );
-
-extern ogg_uint32_t GetFOURMVExhaustiveSearch (CP_INSTANCE *cpi,
-                                               unsigned char *RefFramePtr,
-					       macroblock_t *mp,
-                                               mv_t *MV ) ;
-
 extern void EncodeData(CP_INSTANCE *cpi);
 
-extern ogg_uint32_t PickIntra( CP_INSTANCE *cpi );
-
 extern ogg_uint32_t PickModes(CP_INSTANCE *cpi,
                               ogg_uint32_t *InterError,
                               ogg_uint32_t *IntraError);

Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c	2008-01-08 16:57:35 UTC (rev 14380)
+++ branches/theora-thusnelda/lib/enc/encode.c	2008-01-08 23:41:13 UTC (rev 14381)
@@ -480,344 +480,6 @@
   dsp_restore_fpu (cpi->dsp);
 }
 
-ogg_uint32_t PickIntra( CP_INSTANCE *cpi ){
-
-  int i;
-  for(i=0;i<cpi->frag_total;i++)
-    cpi->frag_coded[i] = 1;
-
-  for(i=0;i<cpi->macro_total;i++)
-    cpi->macro[i].mode = CODE_INTRA;
-
-  return 0;
-}
-
-static void CountMotionVector(CP_INSTANCE *cpi, mv_t *mv) {
-  cpi->MVBits_0 += MvBits[mv->x];
-  cpi->MVBits_0 += MvBits[mv->y];
-  cpi->MVBits_1 += 12; /* Simple six bits per mv component fallback */
-}
-
-static void SetMBMotionVectorsAndMode(CP_INSTANCE *cpi,
-				      macroblock_t *mp,
-				      mv_t *mv,
-				      int mode){
-  mp->mode = mode;
-  mp->mv[0] = *mv;
-  mp->mv[1] = *mv;
-  mp->mv[2] = *mv;
-  mp->mv[3] = *mv;
-}
-
-ogg_uint32_t PickModes(CP_INSTANCE *cpi,
-                       ogg_uint32_t *InterError, ogg_uint32_t *IntraError) {
-  
-  ogg_uint32_t  SB, MB, B; 
-  ogg_uint32_t  MBIntraError;           /* Intra error for macro block */
-  ogg_uint32_t  MBGFError;              /* Golden frame macro block error */
-  ogg_uint32_t  MBGF_MVError;           /* Golden frame plus MV error */
-  ogg_uint32_t  LastMBGF_MVError;       /* Golden frame error with
-                                           last used GF motion
-                                           vector. */
-  ogg_uint32_t  MBInterError;           /* Inter no MV macro block error */
-  ogg_uint32_t  MBLastInterError;       /* Inter with last used MV */
-  ogg_uint32_t  MBPriorLastInterError;  /* Inter with prior last MV */
-  ogg_uint32_t  MBInterMVError;         /* Inter MV macro block error */
-  ogg_uint32_t  MBInterMVExError;       /* Inter MV (exhaustive
-                                           search) macro block error */
-  ogg_uint32_t  MBInterFOURMVError;     /* Inter MV error when using 4
-                                           motion vectors per macro
-                                           block */
-  ogg_uint32_t  BestError;              /* Best error so far. */
-
-  mv_t          FourMVect[4] = {{0,0},{0,0},{0,0},{0,0}};
-  mv_t          LastInterMVect = {0,0};
-  mv_t          PriorLastInterMVect = {0,0};
-  mv_t          TmpMVect = {0,0};  
-  mv_t          LastGFMVect = {0,0};
-  mv_t          InterMVect = {0,0};
-  mv_t          InterMVectEx = {0,0};
-  mv_t          GFMVect = {0,0};
-  mv_t          ZeroVect = {0,0};
-
-  unsigned char QIndex = cpi->BaseQ; // temporary
-
-  unsigned char *cp = cpi->frag_coded;
-
-  /* initialize error scores */
-  *InterError = 0;
-  *IntraError = 0;
-  cpi->MVBits_0 = 0;
-  cpi->MVBits_1 = 0;
-  
-  /* change the quatization matrix to the one at best Q to compute the
-     new error score */
-  cpi->MinImprovementForNewMV = (MvThreshTable[QIndex] << 12);
-  cpi->InterTripOutThresh = (5000<<12);
-  cpi->MVChangeFactor = MVChangeFactorTable[QIndex]; /* 0.9 */
-
-  if ( cpi->info.quick_p ) {
-    cpi->ExhaustiveSearchThresh = (1000<<12);
-    cpi->FourMVThreshold = (2500<<12);
-  } else {
-    cpi->ExhaustiveSearchThresh = (250<<12);
-    cpi->FourMVThreshold = (500<<12);
-  }
-  cpi->MinImprovementForFourMV = cpi->MinImprovementForNewMV * 4;
-
-  if(cpi->MinImprovementForFourMV < (40<<12))
-    cpi->MinImprovementForFourMV = (40<<12);
-
-  cpi->FourMvChangeFactor = 8; /* cpi->MVChangeFactor - 0.05;  */
-
-  /* decide what block type and motion vectors to use on all of the frames */
-  for ( SB=0 ; SB < cpi->super_n[0]; SB++ ){
-    superblock_t *sp = &cpi->super[0][SB];
-    /* Check its four Macro-Blocks */
-    for ( MB=0; MB<4; MB++ ) {
-      macroblock_t *mbp = &cpi->macro[sp->m[MB]];      
-      int fi = mbp->yuv[0][0];
-
-      for ( B=1; !cp[fi] && B<4; B++ ) fi = mbp->yuv[0][B];
-      
-      /* This one isn't coded go to the next one */
-      if(!cp[fi]) continue;
-      
-      /**************************************************************
-       Find the block choice with the lowest error
-
-       NOTE THAT if U or V is coded but no Y from a macro block then
-       the mode will be CODE_INTER_NO_MV as this is the default
-       state to which the mode data structure is initialised in
-       encoder and decoder at the start of each frame. */
-
-      BestError = HUGE_ERROR;
-      
-      
-      /* Look at the intra coding error. */
-      MBIntraError = GetMBIntraError( cpi, mbp );
-      BestError = (BestError > MBIntraError) ? MBIntraError : BestError;
-      
-      /* Get the golden frame error */
-      MBGFError = GetMBInterError( cpi, cpi->frame, cpi->golden, 
-				   mbp, 0, 0 );
-      BestError = (BestError > MBGFError) ? MBGFError : BestError;
-      
-      /* Calculate the 0,0 case. */
-      MBInterError = GetMBInterError( cpi, cpi->frame,
-				      cpi->lastrecon,
-				      mbp, 0, 0 );
-      BestError = (BestError > MBInterError) ? MBInterError : BestError;
-      
-      /* Measure error for last MV */
-      MBLastInterError =  GetMBInterError( cpi, cpi->frame,
-					   cpi->lastrecon,
-					   mbp, LastInterMVect.x,
-					   LastInterMVect.y );
-      BestError = (BestError > MBLastInterError) ?
-	MBLastInterError : BestError;
-      
-      /* Measure error for prior last MV */
-      MBPriorLastInterError =  GetMBInterError( cpi, cpi->frame,
-						cpi->lastrecon,
-						mbp, PriorLastInterMVect.x,
-						PriorLastInterMVect.y );
-      BestError = (BestError > MBPriorLastInterError) ?
-	MBPriorLastInterError : BestError;
-
-      /* Temporarily force usage of no motionvector blocks */
-      MBInterMVError = HUGE_ERROR;
-      InterMVect.x = 0;  /* Set 0,0 motion vector */
-      InterMVect.y = 0;
-
-      /* If the best error is above the required threshold search
-	 for a new inter MV */
-      if ( BestError > cpi->MinImprovementForNewMV && cpi->MotionCompensation) {
-	/* Use a mix of heirachical and exhaustive searches for
-	   quick mode. */
-	if ( cpi->info.quick_p ) {
-	  MBInterMVError = GetMBMVInterError( cpi, cpi->lastrecon,
-					      mbp,
-					      cpi->MVPixelOffsetY,
-					      &InterMVect );
-
-	  /* If we still do not have a good match try an exhaustive
-	     MBMV search */
-	  if ( (MBInterMVError > cpi->ExhaustiveSearchThresh) &&
-	       (BestError > cpi->ExhaustiveSearchThresh) ) {
-
-	    MBInterMVExError =
-	      GetMBMVExhaustiveSearch( cpi, cpi->lastrecon,
-				       mbp,
-				       &InterMVectEx );
-
-	    /* Is the Variance measure for the EX search
-	       better... If so then use it. */
-	    if ( MBInterMVExError < MBInterMVError ) {
-	      MBInterMVError = MBInterMVExError;
-	      InterMVect.x = InterMVectEx.x;
-	      InterMVect.y = InterMVectEx.y;
-	    }
-	  }
-	}else{
-	  /* Use an exhaustive search */
-	  MBInterMVError =
-	    GetMBMVExhaustiveSearch( cpi, cpi->lastrecon,
-				     mbp,
-				     &InterMVect );
-	}
-
-
-	/* Is the improvement, if any, good enough to justify a new MV */
-	if ( (16 * MBInterMVError < (BestError * cpi->MVChangeFactor)) &&
-	     ((MBInterMVError + cpi->MinImprovementForNewMV) < BestError) ){
-	  BestError = MBInterMVError;
-	}
-
-      }
-
-      /* If the best error is still above the required threshold
-	 search for a golden frame MV */
-      MBGF_MVError = HUGE_ERROR;
-      GFMVect.x = 0; /* Set 0,0 motion vector */
-      GFMVect.y = 0;
-      if ( BestError > cpi->MinImprovementForNewMV && cpi->MotionCompensation) {
-	/* Do an MV search in the golden reference frame */
-	MBGF_MVError = GetMBMVInterError( cpi, cpi->golden,
-					  mbp,
-					  cpi->MVPixelOffsetY, &GFMVect );
-
-	/* Measure error for last GFMV */
-	LastMBGF_MVError =  GetMBInterError( cpi, cpi->frame,
-					     cpi->golden,
-					     mbp,
-					     LastGFMVect.x,
-					     LastGFMVect.y );
-
-	/* Check against last GF motion vector and reset if the
-	   search has thrown a worse result. */
-	if ( LastMBGF_MVError < MBGF_MVError ) {
-	  GFMVect.x = LastGFMVect.x;
-	  GFMVect.y = LastGFMVect.y;
-	  MBGF_MVError = LastMBGF_MVError;
-	}else{
-	  LastGFMVect.x = GFMVect.x;
-	  LastGFMVect.y = GFMVect.y;
-	}
-
-	/* Is the improvement, if any, good enough to justify a new MV */
-	if ( (16 * MBGF_MVError < (BestError * cpi->MVChangeFactor)) &&
-	     ((MBGF_MVError + cpi->MinImprovementForNewMV) < BestError) ) {
-	  BestError = MBGF_MVError;
-	}
-      }
-
-      /* Finally... If the best error is still to high then consider
-	 the 4MV mode */
-      MBInterFOURMVError = HUGE_ERROR;
-      if ( BestError > cpi->FourMVThreshold && cpi->MotionCompensation) {
-	/* Get the 4MV error. */
-	MBInterFOURMVError =
-	  GetFOURMVExhaustiveSearch( cpi, cpi->lastrecon,
-				     mbp,
-				     FourMVect );
-
-	/* If the improvement is great enough then use the four MV mode */
-	if ( ((MBInterFOURMVError + cpi->MinImprovementForFourMV) <
-	      BestError) && (16 * MBInterFOURMVError <
-			     (BestError * cpi->FourMvChangeFactor))) {
-	  BestError = MBInterFOURMVError;
-	}
-      }
-
-      /********************************************************
-         end finding the best error
-         *******************************************************
-
-         Figure out what to do with the block we chose
-
-         Over-ride and force intra if error high and Intra error similar
-         Now choose a mode based on lowest error (with bias towards no MV) */
-
-      if ( (BestError > cpi->InterTripOutThresh) &&
-	   (10 * BestError > MBIntraError * 7 ) ) {
-	SetMBMotionVectorsAndMode(cpi,mbp,&ZeroVect,CODE_INTRA);
-      } else if ( BestError == MBInterError ) {
-	SetMBMotionVectorsAndMode(cpi,mbp,&ZeroVect,CODE_INTER_NO_MV);
-      } else if ( BestError == MBGFError ) {
-	SetMBMotionVectorsAndMode(cpi,mbp,&ZeroVect,CODE_USING_GOLDEN);
-      } else if ( BestError == MBLastInterError ) {
-	SetMBMotionVectorsAndMode(cpi,mbp,&LastInterMVect,CODE_INTER_LAST_MV);
-      } else if ( BestError == MBPriorLastInterError ) {
-	SetMBMotionVectorsAndMode(cpi,mbp,&PriorLastInterMVect,CODE_INTER_PRIOR_LAST);
-
-	/* Swap the prior and last MV cases over */
-	TmpMVect = PriorLastInterMVect;
-	PriorLastInterMVect = LastInterMVect;
-	LastInterMVect = TmpMVect;
-
-      } else if ( BestError == MBInterMVError ) {
-
-	SetMBMotionVectorsAndMode(cpi,mbp,&InterMVect,CODE_INTER_PLUS_MV);
-
-	/* Update Prior last mv with last mv */
-	PriorLastInterMVect.x = LastInterMVect.x;
-	PriorLastInterMVect.y = LastInterMVect.y;
-
-	/* Note last inter MV for future use */
-	LastInterMVect.x = InterMVect.x;
-	LastInterMVect.y = InterMVect.y;
-
-	CountMotionVector( cpi, &InterMVect);
-
-      } else if ( BestError == MBGF_MVError ) {
-
-	SetMBMotionVectorsAndMode(cpi,mbp,&GFMVect,CODE_GOLDEN_MV);
-
-	/* Note last inter GF MV for future use */
-	LastGFMVect.x = GFMVect.x;
-	LastGFMVect.y = GFMVect.y;
-
-	CountMotionVector( cpi, &GFMVect);
-      } else if ( BestError == MBInterFOURMVError ) {
-
-	mbp->mode = CODE_INTER_FOURMV;
-	mbp->mv[0] = FourMVect[0];
-	mbp->mv[1] = FourMVect[1];
-	mbp->mv[2] = FourMVect[2];
-	mbp->mv[3] = FourMVect[3];
-
-	/* Note the four MVs values for current macro-block. */
-	CountMotionVector( cpi, &FourMVect[0]);
-	CountMotionVector( cpi, &FourMVect[1]);
-	CountMotionVector( cpi, &FourMVect[2]);
-	CountMotionVector( cpi, &FourMVect[3]);
-
-	/* Update Prior last mv with last mv */
-	PriorLastInterMVect = LastInterMVect;
-
-	/* Note last inter MV for future use */
-	LastInterMVect = FourMVect[3];
-
-      } else {
-
-	SetMBMotionVectorsAndMode(cpi, mbp,&ZeroVect,CODE_INTRA);
-
-      }
-
-      /* setting up mode specific block types
-         *******************************************************/
-
-      *InterError += (BestError>>8);
-      *IntraError += (MBIntraError>>8);
-
-    }
-  }
-
-  /* Return number of pixels coded */
-  return 0;
-}
-
 void WriteFrameHeader( CP_INSTANCE *cpi) {
   oggpack_buffer *opb=cpi->oggbuffer;
 

Modified: branches/theora-thusnelda/lib/enc/encoder_lookup.h
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_lookup.h	2008-01-08 16:57:35 UTC (rev 14380)
+++ branches/theora-thusnelda/lib/enc/encoder_lookup.h	2008-01-08 23:41:13 UTC (rev 14381)
@@ -80,10 +80,13 @@
 static const ogg_uint32_t ModeBitPatterns[MAX_MODES] = {
   0x00, 0x02, 0x06, 0x0E, 0x1E, 0x3E, 0x7E, 0x7F };
 
-static const ogg_int32_t ModeBitLengths[MAX_MODES] =  {
+static const int ModeBitLengths[MAX_MODES] =  {
   1,    2,    3,    4,    5,    6,    7,    7 };
 
-static const unsigned char ModeSchemes[MODE_METHODS-2][MAX_MODES] =  {
+static const int ModeBitLengthsD[MAX_MODES] =  {
+  3,    3,    3,    3,    3,    3,    3,    3 };
+
+static const unsigned char ModeSchemes[MODE_METHODS-1][MAX_MODES] =  {
   /* Last Mv dominates */
   { 3,    4,    2,    0,    1,    5,    6,    7 },    /* L P  M N I G GM 4 */
   { 2,    4,    3,    0,    1,    5,    6,    7 },    /* L P  N M I G GM 4 */
@@ -93,7 +96,9 @@
   /* No MV dominates */
   { 0,    4,    3,    1,    2,    5,    6,    7 },    /* N L  P M I G GM 4 */
   { 0,    5,    4,    2,    3,    1,    6,    7 },    /* N G  L P M I GM 4 */
-
+  
+  /* fallback */
+  { 0,    1,    2,    3,    4,    5,    6,    7 }
 };
 
 static const ogg_uint32_t MvThreshTable[Q_TABLE_SIZE] = {

Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c	2008-01-08 16:57:35 UTC (rev 14380)
+++ branches/theora-thusnelda/lib/enc/frinit.c	2008-01-08 23:41:13 UTC (rev 14381)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2008                *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -266,12 +266,51 @@
     }
   }
 
+  /* fill in macroblock neighbor information for MC analysis */
+  {
+    int row,col,frag;
+    int scanx[4] = {0,1,0,1};
+    int scany[4] = {0,0,1,1};
+
+    for(row=0;row<cpi->macro_v;row++){
+      for(col=0;col<cpi->macro_h;col++){
+	int macroindex = row*cpi->macro_h + col;
+	int count=0;
+
+	/* cneighbors are of four possible already-filled-in neighbors from the eight-neighbor square */
+	if(col)
+	  cpi->macro[macroindex].cneighbors[count++]=macroindex-1;
+	if(col && row)
+	  cpi->macro[macroindex].cneighbors[count++]=macroindex-macro_h-1;
+	if(row)
+	  cpi->macro[macroindex].cneighbors[count++]=macroindex-macro_h;
+	if(row && col+1<macro_h)
+	  cpi->macro[macroindex].cneighbors[count++]=macroindex-macro_h+1;
+	cpi->macro[macroindex].ncneighbors=count;
+
+	/* pneighbors are of the four possible direct neighbors (plus pattern), not the same as cneighbors */
+	count=0;
+	if(col)
+	  cpi->macro[macroindex].pneighbors[count++]=macroindex-1;
+	if(row)
+	  cpi->macro[macroindex].pneighbors[count++]=macroindex-macro_h;
+	if(col+1<macro_h)
+	  cpi->macro[macroindex].pneighbors[count++]=macroindex+1;
+	if(row+1<macro_v)
+	  cpi->macro[macroindex].pneighbors[count++]=macroindex+macro_h;
+	cpi->macro[macroindex].npneighbors=count;
+      }
+    }
+  }
+
   /* fill in 'invalid' macroblock */
   {
     int p,f;
     for(p=0;p<3;p++)
       for(f=0;f<4;f++)
 	cpi->macro[cpi->macro_total].yuv[p][f] = cpi->frag_total;
+    cpi->macro[cpi->macro_total].ncneighbors=0;
+    cpi->macro[cpi->macro_total].npneighbors=0;
   }
 
   /* allocate frames */

Added: branches/theora-thusnelda/lib/enc/mcenc.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mcenc.c	                        (rev 0)
+++ branches/theora-thusnelda/lib/enc/mcenc.c	2008-01-08 23:41:13 UTC (rev 14381)
@@ -0,0 +1,692 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2008                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function:
+  last mod: $Id$
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+#include "codec_internal.h"
+
+typedef struct {
+  int                candidates[12][2];
+  int                setb0;
+  int                ncandidates;
+  ogg_int32_t        mvapw1[2];
+  ogg_int32_t        mvapw2[2];
+} mc_state;
+
+/*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
+   computing the second maximum Y plane SAD threshold.*/
+#define OC_YSAD_THRESH2_SCALE_BITS (3)
+/*The amount to add to the second maximum Y plane threshold when inflating
+   it.*/
+#define OC_YSAD_THRESH2_OFFSET     (128)
+
+/*The vector offsets in the X direction for each search site in the square
+   pattern.*/
+static const int OC_SQUARE_DX[9]={-1,0,1,-1,0,1,-1,0,1};
+/*The vector offsets in the Y direction for each search site in the square
+   pattern.*/
+static const int OC_SQUARE_DY[9]={-1,-1,-1,0,0,0,1,1,1};
+/*The number of sites to search for each boundary condition in the square
+   pattern.
+  Bit flags for the boundary conditions are as follows:
+  1: -16==dx
+  2:      dx==15(.5)
+  4: -16==dy
+  8:      dy==15(.5)*/
+static const int OC_SQUARE_NSITES[11]={8,5,5,0,5,3,3,0,5,3,3};
+/*The list of sites to search for each boundary condition in the square
+   pattern.*/
+static const int OC_SQUARE_SITES[11][8]={
+  /* -15.5<dx<31,       -15.5<dy<15(.5)*/
+  {0,1,2,3,5,6,7,8},
+  /*-15.5==dx,          -15.5<dy<15(.5)*/
+  {1,2,5,7,8},
+  /*     dx==15(.5),    -15.5<dy<15(.5)*/
+  {0,1,3,6,7},
+  /*-15.5==dx==15(.5),  -15.5<dy<15(.5)*/
+  {-1},
+  /* -15.5<dx<15(.5),  -15.5==dy*/
+  {3,5,6,7,8},
+  /*-15.5==dx,         -15.5==dy*/
+  {5,7,8},
+  /*     dx==15(.5),   -15.5==dy*/
+  {3,6,7},
+  /*-15.5==dx==15(.5), -15.5==dy*/
+  {-1},
+  /*-15.5dx<15(.5),           dy==15(.5)*/
+  {0,1,2,3,5},
+  /*-15.5==dx,                dy==15(.5)*/
+  {1,2,5},
+  /*       dx==15(.5),        dy==15(.5)*/
+  {0,1,3}
+};
+
+/*Swaps two integers _a and _b if _a>_b.*/
+#define OC_SORT2I(_a,_b)\
+  if((_a)>(_b)){\
+    int t__;\
+    t__=(_a);\
+    (_a)=(_b);\
+    (_b)=t__;\
+  }
+
+
+#define OC_MAXI(_a,_b)      ((_a)<(_b)?(_b):(_a))
+#define OC_MINI(_a,_b)      ((_a)>(_b)?(_b):(_a))
+/*Clamps an integer into the given range.
+  If _a>_c, then the lower bound _a is respected over the upper bound _c (this
+   behavior is required to meet our documented API behavior).
+  _a: The lower bound.
+  _b: The value to clamp.
+  _c: The upper boud.*/
+#define OC_CLAMPI(_a,_b,_c) (OC_MAXI(_a,OC_MINI(_b,_c)))
+
+/*Divides an integer by a power of two, truncating towards 0.
+  _dividend: The integer to divide.
+  _shift:    The non-negative power of two to divide by.
+  _rmask:    (1<<_shift)-1*/
+#define OC_DIV_POW2(_dividend,_shift,_rmask)\
+  ((_dividend)+(((_dividend)>>sizeof(_dividend)*8-1)&(_rmask))>>(_shift))
+/*Divides _x by 65536, truncating towards 0.*/
+#define OC_DIV2_16(_x) OC_DIV_POW2(_x,16,0xFFFF)
+/*Divides _x by 2, truncating towards 0.*/
+#define OC_DIV2(_x) OC_DIV_POW2(_x,1,0x1)
+
+/*Right shifts _dividend by _shift, adding _rval, and subtracting one for
+   negative dividends first..
+  When _rval is (1<<_shift-1), this is equivalent to division with rounding
+   ties towards positive infinity.*/
+#define OC_DIV_ROUND_POW2(_dividend,_shift,_rval)\
+  ((_dividend)+((_dividend)>>sizeof(_dividend)*8-1)+(_rval)>>(_shift))
+
+static void oc_mcenc_find_candidates(CP_INSTANCE *cpi, 
+				     mc_state *_mcenc,
+				     int _mbi,
+				     int _which_frame){
+  macroblock_t *nemb;
+  macroblock_t *emb;
+  ogg_int32_t   mvapw1;
+  ogg_int32_t   mvapw2;
+  mv_t          a[3];
+  int           ncandidates;
+  int           i;
+  emb=_mcenc->enc->mbinfo+_mbi;
+  if(emb->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;
+    for(i=0;i<emb->ncneighbors;i++){
+      nemb=cpi->macro[emb->cneighbors[i]];
+      _mcenc->candidates[ncandidates].x=nemb->analysis_mv[0][_which_frame].x;
+      _mcenc->candidates[ncandidates].y=nemb->analysis_mv[0][_which_frame].y;
+      ncandidates++;
+    }
+    /*Add a few additional vectors to set A: the vector used in the previous
+       frame and the (0,0) vector.*/
+    _mcenc->candidates[ncandidates].x=emb->analysis_mv[1][_which_frame].x;
+    _mcenc->candidates[ncandidates].y=emb->analysis_mv[1][_which_frame].y;
+    ncandidates++;
+    _mcenc->candidates[ncandidates].x=0;
+    _mcenc->candidates[ncandidates].y=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].x,a[1].x);
+    OC_SORT2I(a[0].y,a[1].y);
+    OC_SORT2I(a[1].x,a[2].x);
+    OC_SORT2I(a[1].y,a[2].y);
+    OC_SORT2I(a[0].x,a[1].x);
+    OC_SORT2I(a[0].y,a[1].y);
+    _mcenc->candidates[0].x=a[1].x;
+    _mcenc->candidates[0].y=a[1].y;
+  }
+  /*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.*/
+  else{
+    _mcenc->candidates[0].x=0;
+    _mcenc->candidates[0].y=0;
+    _mcenc->candidates[1].x=emb->analysis_mv[1][_which_frame].x;
+    _mcenc->candidates[1].y=emb->analysis_mv[1][_which_frame].y;
+    ncandidates=2;
+  }
+  /*Fill in set B: accelerated predictors for this and adjacent macro
+     blocks.*/
+  _mcenc->setb0=ncandidates;
+  mvapw1=_mcenc->mvapw1[_which_frame];
+  mvapw2=_mcenc->mvapw2[_which_frame];
+  /*The first time through the loop use the current macro block.*/
+  nemb=emb;
+  for(i=0;;i++){
+    _mcenc->candidates[ncandidates].x =
+      OC_DIV_ROUND_POW2(nemb->analysis_mv[1][_which_frame].x*mvapw1-
+			nemb->analysis_mv[2][_which_frame].x*mvapw2,16,0x8000);
+    _mcenc->candidates[ncandidates].y =
+      OC_DIV_ROUND_POW2(nemb->analysis_mv[1][_which_frame].y*mvapw1-
+			nemb->analysis_mv[2][_which_frame].y*mvapw2,16,0x8000);
+    _mcenc->candidates[ncandidates].x = OC_CLAMPI(-31,_mcenc->candidates[ncandidates].x,31);
+    _mcenc->candidates[ncandidates].y = OC_CLAMPI(-31,_mcenc->candidates[ncandidates].y,31);
+    ncandidates++;
+    if(i>=emb->npneighbors)break;
+    nemb=cpi->macro[emb->pneighbors[i]];
+  }
+  /*Truncate to full-pel positions.*/
+  for(i=0;i<ncandidates;i++){
+    _mcenc->candidates[i].x=OC_DIV2(_mcenc->candidates[i].x);
+    _mcenc->candidates[i].y=OC_DIV2(_mcenc->candidates[i].y);
+  }
+  _mcenc->ncandidates=ncandidates;
+}
+
+static int oc_sad8_halfpel(const unsigned char *_cur,
+			   const unsigned char *_ref0,
+			   const unsigned char *_ref1,
+			   int _stride){
+  int i;
+  int j;
+  int err;
+  err=0;
+  for(i=0;i<8;i++){
+    for(j=0;j<8;j++)
+      err+=abs(_cur[j]-((int)_ref0[j]+_ref1[j]>>1));
+    _cur+=_stride;
+    _ref0+=_stride;
+    _ref1+=_stride;
+  }
+  return err;
+}
+
+static int oc_sad8_fullpel(const unsigned char *_cur,
+			   const unsigned char *_ref,
+			   int _stride){
+  int i;
+  int j;
+  int err;
+  err=0;
+  for(i=0;i<8;i++){
+    for(j=0;j<8;j++)
+      err+=abs(_cur[j]-(int)_ref[j]);
+    _cur+=_stride;
+    _ref+=_stride;
+  }
+  return err;
+}
+
+static int oc_sad16_halfpel(CP_INSTANCE *cpi, 
+			    int mbi,
+			    int _mvoffset0,
+			    int _mvoffset1,
+			    int _goldenp){
+
+  macroblock_t *mbi = cpi->macro[mbi];
+  int err;
+  int i;
+  err=0;
+  for(i=0;i<4;i++){
+    int fi = mbi->y[i];
+    if(fi < cpi->frag_total){ /* last fragment is the 'invalid fragment' */
+      ogg_uint32_t base_offset = cpi->frag_buffer_index[fi];
+      const unsigned char *cur = cpi->frame + base_offset;
+      const unsigned char *ref = (_goldenp ? cpi->golden : cpi->recon) + base_offset;
+      
+      err+=oc_sad8_halfpel(cur, ref+_mvoffset0, ref+_mvoffset1, cpi->stride[0]);
+
+    }
+  }
+  
+  return err;
+}
+
+static int oc_mcenc_ysad_check_mbcandidate_fullpel(CP_INSTANCE *cpi, 
+						   mc_state *_mcenc,
+						   int _mbi,
+						   mv_t _delta,
+						   int _goldenp,
+						   int _block_err[4]){
+  int                      stride;
+  int                      mvoffset;
+  int                      err;
+  int                      bi;
+  macroblock_t            *mb = &cpi->macro[_mbi];
+  /*TODO: customize error function for speed/(quality+size) tradeoff.*/
+  stride=cpi->stride[0];
+  mvoffset=_delta.x+_delta.y*stride;
+  err=0;
+  for(bi=0;bi<4;bi++){
+    int fi = mbi->y[i];
+    if(fi < cpi->frag_total){ /* last fragment is the 'invalid fragment' */
+      ogg_uint32_t base_offset = cpi->frag_buffer_index[fi];
+      const unsigned char *cur = cpi->frame + base_offset;
+      const unsigned char *ref = (_goldenp ? cpi->golden : cpi->recon) + base_offset;
+      
+      _block_err[bi]=oc_sad8_fullpel(cur,ref+mvoffset,stride);
+      err+=_block_err[bi];
+    }
+  }
+  return err;
+}
+
+static int oc_mcenc_ysad_halfpel_mbrefine(CP_INSTANCE *cpi, 
+					  mc_state *_mcenc,
+					  int _mbi,
+					  mv_t *_vec,
+					  int _best_err,
+					  int _goldenp){
+  int                      offset_y[9];
+  int                      stride;
+  int                      mvoffset_base;
+  int                      best_site;
+  int                      sitei;
+  int                      err;
+
+  stride=cpi->stride[0];
+  mvoffset_base=_vec->x+_vec->y*stride;
+  offset_y[0]=offset_y[1]=offset_y[2]=-stride;
+  offset_y[3]=offset_y[5]=0;
+  offset_y[6]=offset_y[7]=offset_y[8]=stride;
+  err=_best_err;
+  best_site=4;
+  for(sitei=0;sitei<8;sitei++){
+    int site;
+    int xmask;
+    int ymask;
+    int dx;
+    int dy;
+    int mvoffset0;
+    int mvoffset1;
+
+    site=OC_SQUARE_SITES[0][sitei];
+    dx=OC_SQUARE_DX[site];
+    dy=OC_SQUARE_DY[site];
+    /*The following code SHOULD be equivalent to
+      oc_state_get_mv_offsets(&_mcenc->enc.state,&mvoffset0,&mvoffset1,
+       (_vec->x<<1)+dx,(_vec->y<<1)+dy,ref_ystride,0);
+      However, it should also be much faster, as it involves no multiplies and
+       doesn't have to handle chroma vectors.*/
+    xmask=-((((_vec->x<<1)+dx)^dx)<0);
+    ymask=-((((_vec->y<<1)+dy)^dy)<0);
+    mvoffset0=mvoffset_base+(dx&xmask)+(offset_y[site]&ymask);
+    mvoffset1=mvoffset_base+(dx&~xmask)+(offset_y[site]&~ymask);
+
+    err=oc_sad16_halfpel(cpi,_mbi,mvoffset0,mvoffset1,_goldenp);
+    if(err<_best_err){
+      _best_err=err;
+      best_site=site;
+    }
+  }
+  _vec->x=(_vec->x<<1)+OC_SQUARE_DX[best_site];
+  _vec->y=(_vec->y<<1)+OC_SQUARE_DY[best_site];
+  return _best_err;
+}
+
+static int oc_mcenc_ysad_halfpel_brefine(CP_INSTANCE *cpi, 
+					 mc_state *_mcenc,
+					 int _mbi,
+					 int _bi,
+					 mv *_vec,
+					 int _best_err,
+					 int _goldenp){
+  macroblock_t *mb = &cpi->macro[mbi];
+  int offset_y[9];
+  int stride = cpi->stride[0];
+  int mvoffset_base;
+  int best_site;
+  int sitei;
+  int err;
+  int fi = mb->y[bi];
+
+  if(fi == frag_total) return _best_err;
+
+  mvoffset_base=_vec->x+_vec->y*stride;
+  offset_y[0]=offset_y[1]=offset_y[2]=-ref_ystride;
+  offset_y[3]=offset_y[5]=0;
+  offset_y[6]=offset_y[7]=offset_y[8]=ref_ystride;
+  err=_best_err;
+  best_site=4;
+
+  for(sitei=0;sitei<8;sitei++){
+    int site;
+    int xmask;
+    int ymask;
+    int dx;
+    int dy;
+    int mvoffset0;
+    int mvoffset1;
+
+    ogg_uint32_t base_offset = cpi->frag_buffer_index[fi];
+    const unsigned char *cur = cpi->frame + base_offset;
+    const unsigned char *ref = (_goldenp ? cpi->golden : cpi->recon) + base_offset;
+
+    site=OC_SQUARE_SITES[0][sitei];
+    dx=OC_SQUARE_DX[site];
+    dy=OC_SQUARE_DY[site];
+    /*The following code SHOULD be equivalent to
+      oc_state_get_mv_offsets(&_mcenc->enc.state,&mvoffset0,&mvoffset1,
+       (_vec[0]<<1)+dx,(_vec[1]<<1)+dy,ref_ystride,0);
+      However, it should also be much faster, as it involves no multiplies and
+       doesn't have to handle chroma vectors.*/
+    xmask=-((((_vec->x<<1)+dx)^dx)<0);
+    ymask=-((((_vec->y<<1)+dy)^dy)<0);
+    mvoffset0=mvoffset_base+(dx&xmask)+(offset_y[site]&ymask);
+    mvoffset1=mvoffset_base+(dx&~xmask)+(offset_y[site]&~ymask);
+
+    err=oc_sad8_halfpel(cur, ref+mvoffset0, ref+mvoffset1,stride);
+
+    if(err<_best_err){
+      _best_err=err;
+      best_site=site;
+    }
+  }
+  _vec->x=(_vec->x<<1)+OC_SQUARE_DX[best_site];
+  _vec->y=(_vec->y<<1)+OC_SQUARE_DY[best_site];
+  return _best_err;
+}
+
+/* Perform a motion vector search for this macro block against a single
+   reference frame.
+  
+   As a bonus, individual block motion vectors are computed as well, as much of
+   the work can be shared.
+  
+   The actual motion vector is stored in the appropriate place in the
+   oc_mb_enc_info structure.
+  
+   _mcenc:    The motion compensation context.
+   _mbi:      The macro block index.
+   _frame:    The frame to search, either OC_FRAME_PREV or OC_FRAME_GOLD.
+   _bmvs:     Returns the individual block motion vectors.
+   _error:    Returns the prediction error for the macro block motion vector.
+   _error4mv: Returns sum of the prediction error for the individual block
+              motion vectors.*/
+void oc_mcenc_search(CP_INSTANCE *cpi, 
+		     mc_state *_mcenc,
+		     int _mbi,
+		     int _goldenp,
+		     mv_t *_bmvs,
+		     int *_error,
+		     int *_error4mv){
+  
+  /*TODO: customize error function for speed/(quality+size) tradeoff.*/
+
+  ogg_int32_t     hit_cache[31];
+  ogg_int32_t     hitbit;
+  int             block_err[4];
+  int             best_block_err[4];
+  mv_t            best_block_vec[4];
+  mv_t            best_vec;
+  int             best_err;
+  mv_t            cand;
+  int             ref_framei;
+  int             bi;
+  macroblock_t   *mb = &cpi->macro[_mbi];
+
+  /*Find some candidate motion vectors.*/
+  oc_mcenc_find_candidates(cpi,_mcenc,_mbi,_goldenp);
+
+  /*Clear the cache of locations we've examined.*/
+  memset(hit_cache,0,sizeof(hit_cache));
+
+  /*Start with the median predictor.*/
+  cand=_mcenc->candidates[0];
+  hit_cache[cand.y+15]|=(ogg_int32_t)1<<cand.x+15;
+  best_err=oc_mcenc_ysad_check_mbcandidate_fullpel(cpi,_mcenc,_mbi,cand,
+						   _goldenp,block_err);
+  best_vec=cand;
+  for(bi=0;bi<4;bi++){
+    best_block_err[bi]=block_err[bi];
+    best_block_vec[bi]=cand;
+  }
+
+  /*If this predictor fails, move on to set A.*/
+  if(best_err>OC_YSAD_THRESH1){
+    int err;
+    int ci;
+    int ncs;
+    int t2;
+    /*Compute the early termination threshold for set A.*/
+    t2=mb->aerror;
+    ncs=OC_MINI(3,mb->ncneighbors);
+    for(ci=0;ci<ncs;ci++)
+      t2=OC_MAXI(t2,cpi->macro[mb->cneighbors[ci]].aerror);
+    t2=t2+(t2>>OC_YSAD_THRESH2_SCALE_BITS)+OC_YSAD_THRESH2_OFFSET;
+
+    /*Examine the candidates in set A.*/
+    for(ci=1;ci<_mcenc->setb0;ci++){
+      cand=_mcenc->candidates[ci];
+
+      /*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<<cand.x+15;
+      if(hit_cache[cand.y+15]&hitbit)continue;
+      hit_cache[cand.y+15]|=hitbit;
+      err=oc_mcenc_ysad_check_mbcandidate_fullpel(cpi,_mcenc,_mbi,cand,_goldenp,block_err);
+      if(err<best_err){
+        best_err=err;
+        best_vec=cand;
+      }
+      for(bi=0;bi<4;bi++)
+	if(block_err[bi]<best_block_err[bi]){
+	  best_block_err[bi]=block_err[bi];
+	  best_block_vec[bi]=cand;
+	}
+    }
+
+    if(best_err>t2){
+      /*Examine the candidates in set B.*/
+      for(;ci<_mcenc->ncandidates;ci++){
+        cand=_mcenc->candidates[ci];
+        hitbit=(ogg_int32_t)1<<cand.x+15;
+        if(hit_cache[cand.y+15]&hitbit)continue;
+        hit_cache[cand.y+15]|=hitbit;
+        err=oc_mcenc_ysad_check_mbcandidate_fullpel(cpi,_mcenc,_mbi,cand,_goldenp,block_err);
+        if(err<best_err){
+          best_err=err;
+          best_vec=cand;
+        }
+        for(bi=0;bi<4;bi++)
+	  if(block_err[bi]<best_block_err[bi]){
+	    best_block_err[bi]=block_err[bi];
+	    best_block_vec[bi]=cand;
+	  }
+      }
+
+      /*Use the same threshold for set B as in set A.*/
+      if(best_err>t2){
+        int best_site;
+        int nsites;
+        int sitei;
+        int site;
+        int b;
+        /*Square pattern search.*/
+        for(;;){
+          best_site=4;
+          /*Compose the bit flags for boundary conditions.*/
+          b=OC_DIV16(-best_vec.x+1)|OC_DIV16(best_vec.x+1)<<1|
+	    OC_DIV16(-best_vec.y+1)<<2|OC_DIV16(best_vec.y+1)<<3;
+          nsites=OC_SQUARE_NSITES[b];
+          for(sitei=0;sitei<nsites;sitei++){
+            site=OC_SQUARE_SITES[b][sitei];
+            cand.x=best_vec.x+OC_SQUARE_DX[site];
+            cand.y=best_vec.y+OC_SQUARE_DY[site];
+            hitbit=(ogg_int32_t)1<<cand.x+15;
+            if(hit_cache[cand.y+15]&hitbit)continue;
+            hit_cache[cand.y+15]|=hitbit;
+            err=oc_mcenc_ysad_check_mbcandidate_fullpel(cpi,_mcenc,_mbi,cand,_goldenp,block_err);
+            if(err<best_err){
+              best_err=err;
+              best_site=site;
+            }
+            for(bi=0;bi<4;bi++)
+	      if(block_err[bi]<best_block_err[bi]){
+		best_block_err[bi]=block_err[bi];
+		best_block_vec[bi]=cand;
+	      }
+          }
+          if(best_site==4)break;
+          best_vec.x+=OC_SQUARE_DX[best_site];
+          best_vec.y+=OC_SQUARE_DY[best_site];
+        }
+
+        /*Final 4-MV search.*/
+        /*Simply use 1/4 of the macro block set A and B threshold as the
+           individual block threshold.*/
+	if(_bmvs && _error4mv){
+	  t2>>=2;
+	  for(bi=0;bi<4;bi++)
+	    if(best_block_err[bi]>t2){
+	      /*Square pattern search. We do this in a slightly interesting manner.
+		We continue to check the SAD of all four blocks in the macroblock.
+		This gives us two things:
+		
+ 	        1) We can continue to use the hit_cache to avoid
+		   duplicate checks.  Otherwise we could continue to
+		   read it, but not write to it without saving and
+		   restoring it for each block.  Note that we could
+		   still eliminate a large number of duplicate checks
+		   by taking into account the site we came from when
+		   choosing the site list.  We can still do that to
+		   avoid extra hit_cache queries, and it might even be
+		   a speed win.
+
+		2) It gives us a slightly better chance of escaping local minima.
+		   We would not be here if we weren't doing a fairly bad job in
+		   finding a good vector, and checking these vectors can save us
+		   from 100 to several thousand points off our SAD 1 in 15
+		   times.
+
+		TODO: Is this a good idea?
+		Who knows. It needs more testing.*/
+
+	      for(;;){
+		mv_t best;
+		int bj;
+		best=best_block_vec[bi];
+		/*Compose the bit flags for boundary conditions.*/
+		b=OC_DIV16(-best.x+1)|OC_DIV16(best.x+1)<<1|
+		  OC_DIV16(-best.y+1)<<2|OC_DIV16(best.y+1)<<3;
+		nsites=OC_SQUARE_NSITES[b];
+		for(sitei=0;sitei<nsites;sitei++){
+		  site=OC_SQUARE_SITES[b][sitei];
+		  cand.x=best.x+OC_SQUARE_DX[site];
+		  cand.y=best.y+OC_SQUARE_DY[site];
+		  hitbit=(ogg_int32_t)1<<cand.x+15;
+		  if(hit_cache[cand.y+15]&hitbit)continue;
+		  hit_cache[cand.y+15]|=hitbit;
+		  err=oc_mcenc_ysad_check_mbcandidate_fullpel(cpi,_mcenc,_mbi,cand,_goldenp,block_err);
+		  if(err<best_err){
+		    best_err=err;
+		    best_vec=cand;
+		  }
+		  for(bj=0;bj<4;bj++)
+		    if(block_err[bj]<best_block_err[bj]){
+		      best_block_err[bj]=block_err[bj];
+		      best_block_vec[bj]=cand;
+		    }
+		  
+		}
+		if(best_block_vec[bi].x==best.x && best_block_vec[bi].y==best.y) break;
+	      }
+	    }
+	}
+      }
+    }
+  }
+
+  *_error=oc_mcenc_ysad_halfpel_mbrefine(cpi,_mcenc,_mbi,&best_vec,best_err,ref_framei);
+  mb->analysis_mv[0][_goldenp]=best_vec;
+  if(_bmvs && _error4mv){
+    *_error4mv=0;
+    for(bi=0;bi<4;bi++){
+      (*_error4mv)+=oc_mcenc_ysad_halfpel_brefine(cpi,_mcenc,_mbi,bi,
+						  &best_block_vec[bi],
+						  best_block_err[bi],
+						  _goldenp);
+      _bmvs[bi]=best_block_vec[bi];
+    }
+  }
+}
+
+
+static void oc_mcenc_start(CP_INSTANCE *cpi, 
+			  mc_state *_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=cpi->LastKeyFrame;
+
+  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 int oc_mcenc_pipe_process(oc_enc_pipe_stage *_stage,int _y_avail[3]){
+  oc_mcenc_ctx   *mcenc;
+  int             pli;
+  mcenc=_stage->enc->mcenc;
+  /*For now we ignore the chroma planes.*/
+  for(pli=1;pli<3;pli++)_stage->y_procd[pli]=_y_avail[pli];
+  /*Only do motion analysis if there is a previous frame; otherwise every
+     vector has already been initialized to (0,0).*/
+  if(mcenc->enc->state.ref_frame_idx[OC_FRAME_PREV]>=0){
+    int             y_avail;
+    y_avail=_y_avail[0];
+    /*Round to a super-block row, except for the last one, which may be
+       incomplete.*/
+    if(y_avail<(int)mcenc->enc->state.info.frame_height)y_avail&=~31;
+    while(_stage->y_procd[0]<y_avail){
+      oc_mb_enc_info *embs;
+      oc_mb          *mbs;
+      int             mbi;
+      int             mbi_end;
+      mbi=(_stage->y_procd[0]>>4)*mcenc->enc->state.fplanes[0].nhsbs;
+      mbi_end=mbi+mcenc->enc->state.fplanes[0].nhsbs<<1;
+      mbs=mcenc->enc->state.mbs;
+      embs=mcenc->enc->mbinfo;
+      for(;mbi<mbi_end;mbi++)if(mbs[mbi].mode!=OC_MODE_INVALID){
+        oc_mb_enc_info *emb;
+        emb=embs+mbi;
+        oc_mcenc_search(mcenc,mbi,OC_FRAME_PREV,emb->bmvs,&emb->aerror,
+			&emb->aerror4mv);
+      }
+      /*Chain to the next stage.*/
+      _stage->y_procd[0]=OC_MINI(_stage->y_procd[0]+32,y_avail);
+      if(_stage->next!=NULL){
+        int ret;
+        ret=_stage->next->pipe_proc(_stage->next,_stage->y_procd);
+        if(ret<0)return ret;
+      }
+    }
+  }
+  else{
+    _stage->y_procd[0]=_y_avail[0];
+    if(_stage->next!=NULL){
+      return _stage->next->pipe_proc(_stage->next,_stage->y_procd);
+    }
+  }
+  return 0;
+}
+

Deleted: branches/theora-thusnelda/lib/enc/mcomp.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mcomp.c	2008-01-08 16:57:35 UTC (rev 14380)
+++ branches/theora-thusnelda/lib/enc/mcomp.c	2008-01-08 23:41:13 UTC (rev 14381)
@@ -1,700 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function:
-  last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "codec_internal.h"
-
-/* Initialises motion compentsation. */
-void InitMotionCompensation ( CP_INSTANCE *cpi ){
-  int i;
-  int SearchSite=0;
-  int Len;
-  int LineStepY = cpi->stride[0];
-
-  Len=((MAX_MV_EXTENT/2)+1)/2;
-
-  /* How many search stages are there. */
-  cpi->MVSearchSteps = 0;
-
-  /* Set up offsets arrays used in half pixel correction. */
-  cpi->HalfPixelRef2Offset[0] = -LineStepY - 1;
-  cpi->HalfPixelRef2Offset[1] = -LineStepY;
-  cpi->HalfPixelRef2Offset[2] = -LineStepY + 1;
-  cpi->HalfPixelRef2Offset[3] = - 1;
-  cpi->HalfPixelRef2Offset[4] = 0;
-  cpi->HalfPixelRef2Offset[5] = 1;
-  cpi->HalfPixelRef2Offset[6] = LineStepY - 1;
-  cpi->HalfPixelRef2Offset[7] = LineStepY;
-  cpi->HalfPixelRef2Offset[8] = LineStepY + 1;
-
-  cpi->HalfPixelXOffset[0] = -1;
-  cpi->HalfPixelXOffset[1] = 0;
-  cpi->HalfPixelXOffset[2] = 1;
-  cpi->HalfPixelXOffset[3] = -1;
-  cpi->HalfPixelXOffset[4] = 0;
-  cpi->HalfPixelXOffset[5] = 1;
-  cpi->HalfPixelXOffset[6] = -1;
-  cpi->HalfPixelXOffset[7] = 0;
-  cpi->HalfPixelXOffset[8] = 1;
-
-  cpi->HalfPixelYOffset[0] = -1;
-  cpi->HalfPixelYOffset[1] = -1;
-  cpi->HalfPixelYOffset[2] = -1;
-  cpi->HalfPixelYOffset[3] = 0;
-  cpi->HalfPixelYOffset[4] = 0;
-  cpi->HalfPixelYOffset[5] = 0;
-  cpi->HalfPixelYOffset[6] = 1;
-  cpi->HalfPixelYOffset[7] = 1;
-  cpi->HalfPixelYOffset[8] = 1;
-
-
-  /* Generate offsets for 8 search sites per step. */
-  while ( Len>0 ) {
-    /* Another step. */
-    cpi->MVSearchSteps += 1;
-
-    /* Compute offsets for search sites. */
-    cpi->MVOffsetX[SearchSite] = -Len;
-    cpi->MVOffsetY[SearchSite++] = -Len;
-    cpi->MVOffsetX[SearchSite] = 0;
-    cpi->MVOffsetY[SearchSite++] = -Len;
-    cpi->MVOffsetX[SearchSite] = Len;
-    cpi->MVOffsetY[SearchSite++] = -Len;
-    cpi->MVOffsetX[SearchSite] = -Len;
-    cpi->MVOffsetY[SearchSite++] = 0;
-    cpi->MVOffsetX[SearchSite] = Len;
-    cpi->MVOffsetY[SearchSite++] = 0;
-    cpi->MVOffsetX[SearchSite] = -Len;
-    cpi->MVOffsetY[SearchSite++] = Len;
-    cpi->MVOffsetX[SearchSite] = 0;
-    cpi->MVOffsetY[SearchSite++] = Len;
-    cpi->MVOffsetX[SearchSite] = Len;
-    cpi->MVOffsetY[SearchSite++] = Len;
-
-    /* Contract. */
-    Len /= 2;
-  }
-
-  /* Compute pixel index offsets. */
-  for ( i=SearchSite-1; i>=0; i-- )
-    cpi->MVPixelOffsetY[i] = (cpi->MVOffsetY[i]*LineStepY) + cpi->MVOffsetX[i];
-}
-
-static ogg_uint32_t GetInterErr (CP_INSTANCE *cpi, 
-				 unsigned char * NewDataPtr,
-				 unsigned char * RefDataPtr1,
-				 unsigned char * RefDataPtr2 ) {
-  ogg_int32_t   DiffVal;
-  ogg_int32_t   RefOffset = (int)(RefDataPtr1 - RefDataPtr2);
-
-  /* Mode of interpolation chosen based upon on the offset of the
-     second reference pointer */
-  if ( RefOffset == 0 ) {
-    DiffVal = dsp_inter8x8_err (cpi->dsp, NewDataPtr,
-				RefDataPtr1, cpi->stride[0]);
-  }else{
-    DiffVal = dsp_inter8x8_err_xy2 (cpi->dsp, NewDataPtr, 
-				    RefDataPtr1, RefDataPtr2, 
-				    cpi->stride[0]);
-  }
-
-  /* Compute and return population variance as mis-match metric. */
-  return DiffVal;
-}
-
-static ogg_uint32_t GetHalfPixelSumAbsDiffs (CP_INSTANCE *cpi,
-					     unsigned char * SrcData,
-					     unsigned char * RefDataPtr1,
-					     unsigned char * RefDataPtr2,
-					     ogg_uint32_t ErrorSoFar,
-					     ogg_uint32_t BestSoFar ) {
-  
-  ogg_uint32_t  DiffVal = ErrorSoFar;
-  ogg_int32_t   RefOffset = (int)(RefDataPtr1 - RefDataPtr2);
-  
-  if ( RefOffset == 0 ) {
-    /* Simple case as for non 0.5 pixel */
-    DiffVal += dsp_sad8x8 (cpi->dsp, SrcData,
-			   RefDataPtr1, cpi->stride[0]);
-  } else  {
-    DiffVal += dsp_sad8x8_xy2_thres (cpi->dsp, SrcData,
-				     RefDataPtr1, 
-				     RefDataPtr2, 
-				     cpi->stride[0],
-				     BestSoFar);
-  }
-
-  return DiffVal;
-}
-
-ogg_uint32_t GetMBIntraError (CP_INSTANCE *cpi, 
-			      macroblock_t *mp){
-
-  ogg_uint32_t  IntraError = 0;
-  dsp_save_fpu (cpi->dsp);
-  unsigned char *cp = cpi->frag_coded;
-  ogg_uint32_t *bp = cpi->frag_buffer_index;
-  int *y = mp->yuv[0];
-
-  /* Add together the intra errors for those blocks in the macro block
-     that are coded (Y only) */
-  if ( cp[y[0]] )
-    IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[y[0]]],cpi->stride[0]);
-  if ( cp[y[1]] )
-    IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[y[1]]],cpi->stride[0]);
-  if ( cp[y[2]] )
-    IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[y[2]]],cpi->stride[0]);
-  if ( cp[y[3]] )
-    IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[y[3]]],cpi->stride[0]);
-
-  dsp_restore_fpu (cpi->dsp);
-  return IntraError;
-}
-
-ogg_uint32_t GetMBInterError (CP_INSTANCE *cpi,
-                              unsigned char * SrcPtr,
-                              unsigned char * RefPtr,
-			      macroblock_t *mp,
-                              ogg_int32_t LastXMV,
-                              ogg_int32_t LastYMV){
-  ogg_uint32_t  PixelsPerLine = cpi->stride[0];
-  ogg_int32_t   RefPixelOffset = ((LastYMV/2) * PixelsPerLine) + (LastXMV/2);
-  ogg_int32_t   RefPtr2Offset = 0;
-  
-  ogg_uint32_t  InterError = 0;
-  
-  unsigned char * SrcPtr1;
-  unsigned char * RefPtr1;
-  unsigned char *cp = cpi->frag_coded;
-  ogg_uint32_t *bp = cpi->frag_buffer_index;
-  int *y = mp->yuv[0];
-
-  dsp_save_fpu (cpi->dsp);
-  
-  /* Work out the second reference pointer offset. */
-  if ( LastXMV % 2 ) {
-    if ( LastXMV > 0 )
-      RefPtr2Offset += 1;
-    else
-      RefPtr2Offset -= 1;
-  }
-  if ( LastYMV % 2 ) {
-    if ( LastYMV > 0 )
-      RefPtr2Offset += PixelsPerLine;
-    else
-      RefPtr2Offset -= PixelsPerLine;
-  }
-
-  /* Add together the errors for those blocks in the macro block that
-     are coded (Y only) */
-  if ( cp[y[0]] ) {
-    SrcPtr1 = &SrcPtr[bp[y[0]]];
-    RefPtr1 = &RefPtr[bp[y[0]] + RefPixelOffset];
-    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
-  }
-
-  if ( cp[y[1]] ) {
-    SrcPtr1 = &SrcPtr[bp[y[1]]];
-    RefPtr1 = &RefPtr[bp[y[1]] + RefPixelOffset];
-    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
-    
-  }
-  
-  if ( cp[y[2]] ) {
-    SrcPtr1 = &SrcPtr[bp[y[2]]];
-    RefPtr1 = &RefPtr[bp[y[2]] + RefPixelOffset];
-    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
-  }
-
-  if ( cp[y[3]] ) {
-    SrcPtr1 = &SrcPtr[bp[y[3]]];
-    RefPtr1 = &RefPtr[bp[y[3]] + RefPixelOffset];
-    InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
-  }
-  
-  dsp_restore_fpu (cpi->dsp);
-  
-  return InterError;
-}
-
-ogg_uint32_t GetMBMVInterError (CP_INSTANCE *cpi,
-                                unsigned char *RefFramePtr,
-				macroblock_t *mp,
-                                ogg_int32_t *MVPixelOffset,
-                                mv_t *MV ) {
-  ogg_uint32_t  Error = 0;
-  ogg_uint32_t  MinError;
-  ogg_uint32_t  InterMVError = 0;
-
-  ogg_int32_t   i;
-  ogg_int32_t   x=0, y=0;
-  ogg_int32_t   step;
-  ogg_int32_t   SearchSite=0;
-
-  unsigned char *SrcPtr[4] = {NULL, NULL, NULL, NULL};
-  unsigned char *RefPtr[4] = {NULL, NULL, NULL, NULL};
-  int            BestBlockOffset=0;
-  int            disp[4];
-  int            off = 0;
-
-  /* Half pixel variables */
-  ogg_int32_t   HalfPixelError;
-  ogg_int32_t   BestHalfPixelError;
-  unsigned char   BestHalfOffset;
-  unsigned char * RefDataPtr1;
-  unsigned char * RefDataPtr2;
-  unsigned char *cp = cpi->frag_coded;
-  ogg_uint32_t *bp = cpi->frag_buffer_index;
-  int *yp = mp->yuv[0];
-
-  dsp_save_fpu (cpi->dsp);
-
-  /* Note which of the four blocks in the macro block are to be
-     included in the search. */
-  disp[0] = cp[yp[0]];
-  disp[1] = cp[yp[1]];
-  disp[2] = cp[yp[2]];
-  disp[3] = cp[yp[3]];
-
-  if(disp[0]){
-    SrcPtr[0] = &cpi->frame[bp[yp[0]]];
-    RefPtr[0] = &RefFramePtr[bp[yp[0]]];
-    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], RefPtr[0],
-                         cpi->stride[0]);
-  }
-  if(disp[1]){
-    SrcPtr[1] = &cpi->frame[bp[yp[1]]];
-    RefPtr[1] = &RefFramePtr[bp[yp[1]]];
-    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[1], RefPtr[1],
-                         cpi->stride[0]);
-  }
-  if(disp[2]){
-    SrcPtr[2] = &cpi->frame[bp[yp[2]]];
-    RefPtr[2] = &RefFramePtr[bp[yp[2]]];
-    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[2], RefPtr[2],
-                         cpi->stride[0]);
-  }
-  if(disp[3]){
-    SrcPtr[3] = &cpi->frame[bp[yp[3]]];
-    RefPtr[3] = &RefFramePtr[bp[yp[3]]];
-    Error += dsp_sad8x8 (cpi->dsp, SrcPtr[3], RefPtr[3],
-                         cpi->stride[0]);
-  }
-
-  /* Set starting values to results of 0, 0 vector. */
-  MinError = Error;
-  BestBlockOffset = 0;
-  x = 0;
-  y = 0;
-  MV->x = 0;
-  MV->y = 0;
-
-  /* Proceed through N-steps. */
-  for (  step=0; step<cpi->MVSearchSteps; step++ ) {
-    /* Search the 8-neighbours at distance pertinent to current step.*/
-    for ( i=0; i<8; i++ ) {
-      /* Set pointer to next candidate matching block. */
-      int loff = off + MVPixelOffset[SearchSite];
-      Error = 0;
-      
-      /* Get the score for the current offset */
-      if ( disp[0] ) 
-        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], RefPtr[0] + loff,
-                             cpi->stride[0]);
-      
-      if ( disp[1] && (Error < MinError) ) 
-        Error += dsp_sad8x8_thres (cpi->dsp, SrcPtr[1], RefPtr[1] + loff,
-				   cpi->stride[0], MinError);
-      
-      if ( disp[2] && (Error < MinError) ) 
-        Error += dsp_sad8x8_thres (cpi->dsp, SrcPtr[2], RefPtr[2] + loff,
-				   cpi->stride[0],  MinError);
-      
-      if ( disp[3] && (Error < MinError) ) 
-        Error += dsp_sad8x8_thres (cpi->dsp, SrcPtr[3], RefPtr[3] + loff,
-				   cpi->stride[0],  MinError);
-
-      if ( Error < MinError ) {
-        /* Remember best match. */
-        MinError = Error;
-        BestBlockOffset = loff;
-	
-	/* Where is it. */
-        x = MV->x + cpi->MVOffsetX[SearchSite];
-        y = MV->y + cpi->MVOffsetY[SearchSite];
-      }
-
-      /* Move to next search location. */
-      SearchSite += 1;
-    }
-
-    /* Move to best location this step. */
-    off = BestBlockOffset;
-    MV->x = x;
-    MV->y = y;
-  }
-
-  /* Factor vectors to 1/2 pixel resoultion. */
-  MV->x = (MV->x * 2);
-  MV->y = (MV->y * 2);
-
-  /* Now do the half pixel pass */
-  BestHalfOffset = 4;     /* Default to the no offset case. */
-  BestHalfPixelError = MinError;
-
-  /* Get the half pixel error for each half pixel offset */
-  for ( i=0; i < 9; i++ ) {
-    HalfPixelError = 0;
-
-    if ( disp[0] ) {
-      RefDataPtr1 = RefPtr[0] + BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[0], RefDataPtr1, RefDataPtr2,
-                         HalfPixelError, BestHalfPixelError );
-    }
-
-    if ( disp[1]  && (HalfPixelError < BestHalfPixelError) ) {
-      RefDataPtr1 = RefPtr[1] + BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[1], RefDataPtr1, RefDataPtr2,
-                         HalfPixelError, BestHalfPixelError );
-    }
-
-    if ( disp[2] && (HalfPixelError < BestHalfPixelError) ) {
-      RefDataPtr1 = RefPtr[2] + BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[2], RefDataPtr1, RefDataPtr2,
-                         HalfPixelError, BestHalfPixelError );
-    }
-
-    if ( disp[3] && (HalfPixelError < BestHalfPixelError) ) { 
-      RefDataPtr1 = RefPtr[3] + BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[3], RefDataPtr1, RefDataPtr2,
-                         HalfPixelError, BestHalfPixelError );
-    }
-
-    if ( HalfPixelError < BestHalfPixelError ) {
-      BestHalfOffset = (unsigned char)i;
-      BestHalfPixelError = HalfPixelError;
-    }
-  }
-
-  /* Half pixel adjust the MV */
-  MV->x += cpi->HalfPixelXOffset[BestHalfOffset];
-  MV->y += cpi->HalfPixelYOffset[BestHalfOffset];
-
-  /* Get the error score for the chosen 1/2 pixel offset as a variance. */
-  InterMVError = GetMBInterError( cpi, cpi->frame, RefFramePtr, mp,
-                                  MV->x, MV->y);
-  
-  dsp_restore_fpu (cpi->dsp);
-  
-  /* Return score of best matching block. */
-  return InterMVError;
-}
-
-ogg_uint32_t GetMBMVExhaustiveSearch (CP_INSTANCE *cpi,
-                                      unsigned char *RefFramePtr,
-				      macroblock_t *mp,
-                                      mv_t *MV ) {
-  ogg_uint32_t  Error = 0;
-  ogg_uint32_t  MinError = HUGE_ERROR;
-  ogg_uint32_t  InterMVError = 0;
-
-  ogg_int32_t   i, j;
-  ogg_int32_t   x=0, y=0;
-
-  unsigned char *SrcPtr[4] = {NULL,NULL,NULL,NULL};
-  unsigned char *RefPtr[4] = {NULL,NULL,NULL,NULL};
-  int            BestBlockOffset=0;
-
-  int            disp[4];
-
-  /* Half pixel variables */
-  ogg_int32_t   HalfPixelError;
-  ogg_int32_t   BestHalfPixelError;
-  unsigned char   BestHalfOffset;
-  unsigned char * RefDataPtr1;
-  unsigned char * RefDataPtr2;
-  int off;
-  unsigned char *cp = cpi->frag_coded;
-  ogg_uint32_t *bp = cpi->frag_buffer_index;
-  int *yp = mp->yuv[0];
-
-  dsp_save_fpu (cpi->dsp);
-
-  /* Note which of the four blocks in the macro block are to be
-     included in the search. */
-  disp[0] = cp[yp[0]];
-  disp[1] = cp[yp[1]];
-  disp[2] = cp[yp[2]];
-  disp[3] = cp[yp[3]];
-
-  if(disp[0]){
-    SrcPtr[0] = &cpi->frame[bp[yp[0]]];
-    RefPtr[0] = &RefFramePtr[bp[yp[0]]];
-  }
-  if(disp[1]){
-    SrcPtr[1] = &cpi->frame[bp[yp[1]]];
-    RefPtr[1] = &RefFramePtr[bp[yp[1]]];
-  }
-  if(disp[2]){
-    SrcPtr[2] = &cpi->frame[bp[yp[2]]];
-    RefPtr[2] = &RefFramePtr[bp[yp[2]]];
-  }
-  if(disp[3]){
-    SrcPtr[3] = &cpi->frame[bp[yp[3]]];
-    RefPtr[3] = &RefFramePtr[bp[yp[3]]];
-  }
-
-  off = - ((MAX_MV_EXTENT/2) * cpi->stride[0]) - (MAX_MV_EXTENT/2);
-
-  /* Search each pixel alligned site */
-  for ( i = 0; i < (ogg_int32_t)MAX_MV_EXTENT; i ++ ) {
-    /* Starting position in row */
-    int loff = off;
-    
-    for ( j = 0; j < (ogg_int32_t)MAX_MV_EXTENT; j++ ) {
-      Error = 0;
-
-      /* Summ errors for each block. */
-      if ( disp[0] ) 
-        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], RefPtr[0]+loff, cpi->stride[0]);
-      if ( disp[1] )
-        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[1], RefPtr[1]+loff, cpi->stride[0]);
-      if ( disp[2] )
-        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[2], RefPtr[2]+loff, cpi->stride[0]);
-      if ( disp[3] )
-        Error += dsp_sad8x8 (cpi->dsp, SrcPtr[3], RefPtr[3]+loff, cpi->stride[0]);
-      
-      /* Was this the best so far */
-      if ( Error < MinError ) {
-        MinError = Error;
-        BestBlockOffset = loff;
-        x = 16 + j - MAX_MV_EXTENT;
-        y = 16 + i - MAX_MV_EXTENT;
-      }
-      
-      /* Move the the next site */
-      loff ++;
-    }
-
-    /* Move on to the next row. */
-    off += cpi->stride[0];
-
-  }
-
-  /* Factor vectors to 1/2 pixel resoultion. */
-  MV->x = (x * 2);
-  MV->y = (y * 2);
-
-  /* Now do the half pixel pass */
-  BestHalfOffset = 4;     /* Default to the no offset case. */
-  BestHalfPixelError = MinError;
-
-  /* Get the half pixel error for each half pixel offset */
-  for ( i=0; i < 9; i++ ) {
-    HalfPixelError = 0;
-
-    if ( disp[0] ) {
-      RefDataPtr1 = RefPtr[0]+BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[0], RefDataPtr1, RefDataPtr2,
-				HalfPixelError, BestHalfPixelError );
-    }
-
-    if ( disp[1]  && (HalfPixelError < BestHalfPixelError) ) {
-      RefDataPtr1 = RefPtr[1]+BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[1], RefDataPtr1, RefDataPtr2,
-				HalfPixelError, BestHalfPixelError );
-    }
-    
-    if ( disp[2] && (HalfPixelError < BestHalfPixelError) ) {
-      RefDataPtr1 = RefPtr[2]+BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[2], RefDataPtr1, RefDataPtr2,
-				HalfPixelError, BestHalfPixelError );
-    }
-    
-    if ( disp[3] && (HalfPixelError < BestHalfPixelError) ) {
-      RefDataPtr1 = RefPtr[3]+BestBlockOffset;
-      RefDataPtr2 = RefDataPtr1 + cpi->HalfPixelRef2Offset[i];
-      HalfPixelError =
-        GetHalfPixelSumAbsDiffs(cpi, SrcPtr[3], RefDataPtr1, RefDataPtr2,
-				HalfPixelError, BestHalfPixelError );
-    }
-
-    if ( HalfPixelError < BestHalfPixelError ){
-      BestHalfOffset = (unsigned char)i;
-      BestHalfPixelError = HalfPixelError;
-    }
-  }
-
-  /* Half pixel adjust the MV */
-  MV->x += cpi->HalfPixelXOffset[BestHalfOffset];
-  MV->y += cpi->HalfPixelYOffset[BestHalfOffset];
-
-  /* Get the error score for the chosen 1/2 pixel offset as a variance. */
-  InterMVError = GetMBInterError( cpi, cpi->frame, RefFramePtr, mp,
-                                  MV->x, MV->y );
-
-  dsp_restore_fpu (cpi->dsp);
-
-  /* Return score of best matching block. */
-  return InterMVError;
-}
-
-static ogg_uint32_t GetBMVExhaustiveSearch (CP_INSTANCE *cpi,
-                                            unsigned char *RefFramePtr,
-					    int fi,
-                                            mv_t *MV ) {
-  ogg_uint32_t  Error = 0;
-  ogg_uint32_t  MinError = HUGE_ERROR;
-  ogg_uint32_t  InterMVError = 0;
-
-  ogg_int32_t   i, j;
-  ogg_int32_t   x=0, y=0;
-
-  unsigned char *SrcPtr = NULL;
-  unsigned char *RefPtr;
-  unsigned char *CandidateBlockPtr=NULL;
-  unsigned char *BestBlockPtr=NULL;
-
-  /* Half pixel variables */
-  ogg_int32_t   HalfPixelError;
-  ogg_int32_t   BestHalfPixelError;
-  unsigned char   BestHalfOffset;
-  unsigned char * RefDataPtr2;
-  int  bi = cpi->frag_buffer_index[fi];
-
-  /* Set up the source pointer for the block. */
-  SrcPtr = &cpi->frame[bi];
-  RefPtr = &RefFramePtr[bi];
-  RefPtr = RefPtr - ((MAX_MV_EXTENT/2) * cpi->stride[0]) - (MAX_MV_EXTENT/2);
-  
-  /* Search each pixel alligned site */
-  for ( i = 0; i < (ogg_int32_t)MAX_MV_EXTENT; i ++ ) {
-    /* Starting position in row */
-    CandidateBlockPtr = RefPtr;
-    
-    for ( j = 0; j < (ogg_int32_t)MAX_MV_EXTENT; j++ ){
-      /* Get the block error score. */
-      Error = dsp_sad8x8 (cpi->dsp, SrcPtr, CandidateBlockPtr, cpi->stride[0] );
-
-      /* Was this the best so far */
-      if ( Error < MinError ) {
-        MinError = Error;
-        BestBlockPtr = CandidateBlockPtr;
-        x = 16 + j - MAX_MV_EXTENT;
-        y = 16 + i - MAX_MV_EXTENT;
-      }
-
-      /* Move the the next site */
-      CandidateBlockPtr ++;
-    }
-
-    /* Move on to the next row. */
-    RefPtr += cpi->stride[0];
-  }
-
-  /* Factor vectors to 1/2 pixel resoultion. */
-  MV->x = (x * 2);
-  MV->y = (y * 2);
-
-  /* Now do the half pixel pass */
-  BestHalfOffset = 4;     /* Default to the no offset case. */
-  BestHalfPixelError = MinError;
-
-  /* Get the half pixel error for each half pixel offset */
-  for ( i=0; i < 9; i++ ) {
-    RefDataPtr2 = BestBlockPtr + cpi->HalfPixelRef2Offset[i];
-    HalfPixelError =
-      GetHalfPixelSumAbsDiffs(cpi, SrcPtr, BestBlockPtr, RefDataPtr2,
-			      0, BestHalfPixelError );
-    
-    if ( HalfPixelError < BestHalfPixelError ){
-      BestHalfOffset = (unsigned char)i;
-      BestHalfPixelError = HalfPixelError;
-    }
-  }
-
-  /* Half pixel adjust the MV */
-  MV->x += cpi->HalfPixelXOffset[BestHalfOffset];
-  MV->y += cpi->HalfPixelYOffset[BestHalfOffset];
-
-  /* Get the variance score at the chosen offset */
-  RefDataPtr2 = BestBlockPtr + cpi->HalfPixelRef2Offset[BestHalfOffset];
-
-  InterMVError =
-    GetInterErr(cpi, SrcPtr, BestBlockPtr, RefDataPtr2 );
-
-  /* Return score of best matching block. */
-  return InterMVError;
-}
-
-ogg_uint32_t GetFOURMVExhaustiveSearch (CP_INSTANCE *cpi,
-                                        unsigned char * RefFramePtr,
-					macroblock_t *mp,
-                                        mv_t *MV ) {
-  ogg_uint32_t  InterMVError;
-  unsigned char *cp = cpi->frag_coded;
-  int *y = mp->yuv[0];
-
-  dsp_save_fpu (cpi->dsp);
-
-  /* For the moment the 4MV mode is only deemed to be valid 
-     if all four Y blocks are to be updated */
-  /* This may be adapted later. */
-  if ( cp[y[0]] &&
-       cp[y[1]] &&
-       cp[y[2]] &&
-       cp[y[3]] ) {
-    
-    /* Reset the error score. */
-    InterMVError = 0;
-    
-    /* Get the error component from each coded block */
-    InterMVError +=
-      GetBMVExhaustiveSearch(cpi, RefFramePtr, y[0], &(MV[0]) );
-    InterMVError +=
-      GetBMVExhaustiveSearch(cpi, RefFramePtr, y[1], &(MV[1]) );
-    InterMVError +=
-      GetBMVExhaustiveSearch(cpi, RefFramePtr, y[2], &(MV[2]) );
-    InterMVError +=
-      GetBMVExhaustiveSearch(cpi, RefFramePtr, y[3], &(MV[3]) );
-  }else{
-    InterMVError = HUGE_ERROR;
-  }
-  
-  dsp_restore_fpu (cpi->dsp);
-
-  /* Return score of best matching block. */
-  return InterMVError;
-}
-
-
-

Added: branches/theora-thusnelda/lib/enc/mode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mode.c	                        (rev 0)
+++ branches/theora-thusnelda/lib/enc/mode.c	2008-01-08 23:41:13 UTC (rev 14381)
@@ -0,0 +1,671 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2008                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: mode selection code
+  last mod: $Id$
+
+ ********************************************************************/
+
+#include "codec_internal.h"
+#include "mode_select.h"
+
+/* Mode decision is done by exhaustively examining all potential
+   choices.  Since we use a minimum-quality encoding strategy, this
+   amounts to simply selecting the mode which uses the smallest number
+   of bits, since the minimum quality will be met in any mode.
+   Obviously, doing the motion compensation, fDCT, tokenization, and
+   then counting the bits each token uses is computationally
+   expensive.  Theora's EOB runs can also split the cost of these
+   tokens across multiple fragments, and naturally we don't know what
+   the optimal choice of Huffman codes will be until we know all the
+   tokens we're going to encode in all the fragments.
+
+   So we use a simple approach to estimating the bit cost of each mode
+   based upon the SAD value of the residual.  The mathematics behind
+   the technique are outlined by Kim \cite{Kim03}, but the process is
+   very simple.  For each quality index and SAD value, we have a table
+   containing the average number of bits needed to code a fragment.
+   The SAD values are placed into a small number of bins (currently
+   16).  The bit counts are obtained by examining actual encoded
+   frames, with optimal Huffman codes selected and EOB bits
+   appropriately divided among all the blocks they involve.  A
+   separate QIxSAD table is kept for each mode and color plane.  It
+   may be possible to combine many of these, but only experimentation
+   will tell which ones truly represent the same distribution.
+
+   @ARTICLE{Kim03,
+     author="Hyun Mun Kim",
+     title="Adaptive Rate Control Using Nonlinear Regression",
+     journal="IEEE Transactions on Circuits and Systems for Video
+     Technology",
+     volume=13,
+     number=5,
+     pages="432--439",
+     month="May",
+     year=2003
+   }
+
+*/
+
+/* Initialize the mode scheme chooser.
+   
+   Schemes 0-6 use a highly unbalanced Huffman code to code each of
+   the modes.  The same set of Huffman codes is used for each of these
+   7 schemes, but the mode assigned to each code varies.
+
+   Schemes 1-6 have a fixed mapping from Huffman code to MB mode,
+   while scheme 0 writes a custom mapping to the bitstream before all
+   the modes.  Finally, scheme 7 just encodes each mode directly in 3
+   bits. 
+
+*/
+
+void oc_mode_scheme_chooser_init(CP_INSTANCE *cpi){
+  oc_mode_scheme_chooser *chooser = cpi->mode_scheme_chooser;
+  int i;
+
+  for(i=0;i<7;i++)
+    chooser->mode_bits[msi] = ModeBitLengths;
+  chooser->mode_bits[7] = ModeBitLengthsD[i];
+  
+  chooser->mode_ranks[0] = chooser->scheme0_ranks;
+  for(i=1;i<8;i++)
+    chooser->mode_ranks[msi] = ModeSchemes[i];
+
+  memset(chooser->mode_counts,0,sizeof(chooser->mode_counts));
+  
+  /*Scheme 0 starts with 24 bits to store the mode list in.*/
+  chooser->scheme_bits[0] = 24;
+  memset(chooser->scheme_bits+1,0,7*sizeof(chooser->scheme_bits[1]));
+  for(i=0;i<8;i++){
+    /*Scheme 7 should always start first, and scheme 0 should always start
+       last.*/
+    chooser->scheme_list[i] = 7-i;
+    chooser->scheme0_list[i] = chooser->scheme0_ranks[i]=i;
+  }
+}
+
+/* This is the real purpose of this data structure: not actually
+   selecting a mode scheme, but estimating the cost of coding a given
+   mode given all the modes selected so far.
+
+   This is done via opportunity cost: the cost is defined as the number of bits
+   required to encode all the modes selected so far including the current one
+   using the best possible scheme, minus the number of bits required to encode
+   all the modes selected so far not including the current one using the best
+   possible scheme.
+  
+   The computational expense of doing this probably makes it overkill.
+   Just be happy we take a greedy approach instead of trying to solve the
+   global mode-selection problem (which is NP-hard).
+   _mode: The mode to determine the cost of.
+   Return: The number of bits required to code this mode.*/
+
+int oc_mode_cost(CP_INSTANCE *cpi,
+		 int _mode){
+
+  oc_mode_scheme_chooser *chooser = cpi->mode_scheme_chooser;
+  int scheme0 = chooser->scheme_list[0];
+  int scheme1 = chooser->scheme_list[1];
+  int best_bits = chooser->scheme_bits[scheme0];
+  int mode_bits = chooser->mode_bits[scheme0][chooser->mode_ranks[scheme0][_mode]];
+  int si;
+  int scheme_bits;
+
+  /*Typical case: If the difference between the best scheme and the
+     next best is greater than 6 bits, then adding just one mode
+     cannot change which scheme we use.*/
+
+  if(chooser->scheme_bits[scheme1]-best_bits > 6) return mode_bits;
+
+  /*Otherwise, check to see if adding this mode selects a different scheme as the best.*/
+  si = 1;
+  best_bits += mode_bits;
+
+  do{
+    /* For any scheme except 0, we can just use the bit cost of the mode's rank in that scheme.*/
+    if(scheme1!=0){
+
+      scheme_bits = chooser->scheme_bits[scheme1]+
+	chooser->mode_bits[scheme1][chooser->mode_ranks[scheme1][_mode]];
+
+    }else{
+      int ri;
+
+      /* For scheme 0, incrementing the mode count could potentially
+         change the mode's rank.
+
+        Find the index where the mode would be moved to in the optimal
+        list, and use its bit cost instead of the one for the mode's
+        current position in the list. */
+
+      /* don't recompute scheme bits; this is computing opportunity
+	 cost, not an update. */
+
+      for(ri = chooser->scheme0_ranks[_mode] ; ri>0 &&
+	    chooser->mode_counts[_mode]>=
+	    chooser->mode_counts[chooser->scheme0_list[ri-1]] ; ri--);
+
+      scheme_bits = chooser->scheme_bits[0] + ModeBitLengths[ri];
+    }
+
+    if(scheme_bits<best_bits) best_bits = scheme_bits;
+    if(++si>=8) break;
+    scheme1 = chooser->scheme_list[si];
+  } while(chooser->scheme_bits[scheme1] - chooser->scheme_bits[scheme0] <= 6);
+
+  return best_bits - chooser->scheme_bits[scheme0];
+}
+
+/* Incrementally update the mode counts and per-scheme bit counts and re-order the scheme
+   lists once a mode has been selected.
+
+  _mode: The mode that was chosen.*/
+
+static void oc_mode_set( CP_INSTANCE *cpi,
+			 macroblock_t *mb,
+			 int _mode){
+
+  oc_mode_scheme_chooser *chooser = cpi->mode_scheme_chooser;
+  int ri;
+  int si;
+
+  mb->mode = _mode;
+  chooser->mode_counts[_mode]++;
+
+  /* Re-order the scheme0 mode list if necessary. */
+  for(ri = chooser->scheme0_ranks[_mode]; ri>0; ri--){
+    int pmode;
+    pmode=chooser->scheme0_list[ri-1];
+    if(chooser->mode_counts[pmode] >= chooser->mode_counts[_mode])break;
+
+    /* reorder the mode ranking */
+    chooser->scheme0_ranks[pmode]++;
+    chooser->scheme0_list[ri]=pmode;
+
+  }
+  chooser->scheme0_ranks[_mode]=ri;
+  chooser->scheme0_list[ri]=_mode;
+
+  /*Now add the bit cost for the mode to each scheme.*/
+  for(si=0;si<8;si++){
+    chooser->scheme_bits[si]+=
+      chooser->mode_bits[si][chooser->mode_ranks[si][_mode]];
+  }
+
+  /* Finally, re-order the list of schemes. */
+  for(si=1;si<8;si++){
+    int sj = si;
+    int scheme0 = chooser->scheme_list[si];
+    int bits0 = chooser->scheme_bits[scheme0];
+    do{
+      int scheme1 = chooser->scheme_list[sj-1];
+      if(bits0 >= chooser->scheme_bits[scheme1]) break;
+      chooser->scheme_list[sj] = scheme1;
+    } while(--sj>0);
+    chooser->scheme_list[sj]=scheme0;
+  }
+}
+
+void oc_mode_unset(CP_INSTANCE *cpi, 
+		   macroblock_t *mb){
+
+  oc_mode_scheme_chooser *chooser = cpi->mode_scheme_chooser;
+  int ri;
+  int si;
+  int mode = mb->mode;
+
+  chooser->mode_counts[mode]--;
+
+  /* Re-order the scheme0 mode list if necessary. */
+  for(ri = chooser->scheme0_ranks[mode]; ri<7; ri++){
+    int pmode;
+    pmode=chooser->scheme0_list[ri+1];
+    if(chooser->mode_counts[pmode] <= chooser->mode_counts[mode])break;
+
+    /* reorder the mode ranking */
+    chooser->scheme0_ranks[pmode]--;
+    chooser->scheme0_list[ri]=pmode;
+
+  }
+  chooser->scheme0_ranks[mode]=ri;
+  chooser->scheme0_list[ri]=mode;
+
+  /* Now remove the bit cost of the mode from each scheme.*/
+  for(si=0;si<8;si++){
+    chooser->scheme_bits[si]-=
+      chooser->mode_bits[si][chooser->mode_ranks[si][mode]];
+  }
+
+  /* Finally, re-order the list of schemes. */
+  for(si=1;si<8;si++){
+    int sj = si;
+    int scheme0 = chooser->scheme_list[si];
+    int bits0 = chooser->scheme_bits[scheme0];
+    do{
+      int scheme1 = chooser->scheme_list[sj-1];
+      if(bits0 >= chooser->scheme_bits[scheme1]) break;
+      chooser->scheme_list[sj] = scheme1;
+    } while(--sj>0);
+    chooser->scheme_list[sj]=scheme0;
+  }
+}
+
+static void SetMBMotionVectorsAndMode(CP_INSTANCE *cpi, 
+				      macroblock_t *mp,
+				      mv_t *mv,
+				      int mode){
+  oc_mode_set(cpi,mp,mode);
+  mp->mv[0] = *mv;
+  mp->mv[1] = *mv;
+  mp->mv[2] = *mv;
+  mp->mv[3] = *mv;
+}
+
+static int BIntraSAD420(CP_INSTANCE *cpi, int fi){
+  int sad = 0;
+  unsigned char *y = frame + cpi->frag_buffer_index[fi];
+  ogg_uint32_t acc = 0;
+  int j;
+  for(j=0;j<8;j++){
+    acc += y[0]; 
+    acc += y[1]; 
+    acc += y[2]; 
+    acc += y[3]; 
+    acc += y[4]; 
+    acc += y[5]; 
+    acc += y[6]; 
+    acc += y[7]; 
+    y += cpi->stride[0];
+  }
+  
+  y = frame + cpi->frag_buffer_index[fi];
+  for(j=0;j<8;j++){
+    sad += abs ((y[0]<<6)-acc); 
+    sad += abs ((y[1]<<6)-acc); 
+    sad += abs ((y[2]<<6)-acc); 
+    sad += abs ((y[3]<<6)-acc); 
+    sad += abs ((y[4]<<6)-acc); 
+    sad += abs ((y[5]<<6)-acc); 
+    sad += abs ((y[6]<<6)-acc); 
+    sad += abs ((y[7]<<6)-acc); 
+    y += cpi->stride[0];
+  }
+
+  return sad;
+}
+
+/* equivalent to adding up the abs values of the AC components of a block */
+static int MBIntraSAD420(CP_INSTANCE *cpi, int mbi){
+  macroblock_t *mb = &cpi->macro[mbi];
+  unsigned char *cp = cpi->frag_coded;
+  int sad = 0;
+
+  int fi = mb->yuv[0][0];
+  if(cp[fi]) sad += BIntraSAD420(cpi,fi);
+
+  fi = mb->yuv[0][1];
+  if(cp[fi]) sad += BIntraSAD420(cpi,fi);
+
+  fi = mb->yuv[0][2];
+  if(cp[fi]) sad += BIntraSAD420(cpi,fi);
+
+  fi = mb->yuv[0][3];
+  if(cp[fi]) sad += BIntraSAD420(cpi,fi);
+
+  fi = mb->yuv[1][0];
+  if(cp[fi]) sad += BIntraSAD420(cpi,fi);
+
+  fi = mb->yuv[2][0];
+  if(cp[fi]) sad += BIntraSAD420(cpi,fi);
+
+  return sad;
+}
+
+static int InterSad(CP_INSTANCE *cpi, int mbi, mv_t mv){
+  macroblock_t *mb = &cpi->macro[mbi];
+  unsigned char *cp = cpi->frag_coded;
+  int sad = 0;
+  int i;
+  for(i=0;i<4;i++){
+    int fi = mb->y[i];
+    if(cp[fi]){
+      unsigned char *y = frame + cpi->frag_buffer_index[fi];
+      ogg_uint32_t acc = 0;
+      int j;
+      for(j=0;j<8;j++){
+	acc += y[0]; 
+	acc += y[1]; 
+	acc += y[2]; 
+	acc += y[3]; 
+	acc += y[4]; 
+	acc += y[5]; 
+	acc += y[6]; 
+	acc += y[7]; 
+	y += cpi->stride[0];
+      }
+
+      y = frame + cpi->frag_buffer_index[fi];
+      for(j=0;j<8;j++){
+	sad += abs ((y[0]<<6)-acc); 
+	sad += abs ((y[1]<<6)-acc); 
+	sad += abs ((y[2]<<6)-acc); 
+	sad += abs ((y[3]<<6)-acc); 
+	sad += abs ((y[4]<<6)-acc); 
+	sad += abs ((y[5]<<6)-acc); 
+	sad += abs ((y[6]<<6)-acc); 
+	sad += abs ((y[7]<<6)-acc); 
+	y += cpi->stride[0];
+      }
+    }
+  }
+  return sad;
+
+
+
+
+
+}
+
+ogg_uint32_t PickModes(CP_INSTANCE *cpi,
+                       ogg_uint32_t *InterError, 
+		       ogg_uint32_t *IntraError) {
+  
+  unsigned char qi = cpi->BaseQ; // temporary
+
+  mc_state mcenc;
+  mv_t bmvs[4];
+  int mbi, bi;
+  
+  oc_mode_scheme_chooser_init(cpi);
+  oc_mcenc_start(cpi, &mcenc); 
+  *InterError = 0;
+  *IntraError = 0;
+  cpi->MVBits_0 = 0;
+  cpi->MVBits_1 = 0;
+ 
+  /* Scan through macroblocks. */
+  for(mbi = 0; mbi<cpi->macro_total; mbi++){
+    ogg_uint32_t  sad[8] = {0,0,0,0, 0,0,0,0};
+    macroblock_t *mb     = &cp->macro[mbi];
+
+    /*Move the motion vector predictors back a frame */
+    memmove(mb->analysis_mv+1,mb->analysis_mv,2*sizeof(mb->analysis_mv[0]));
+
+    /* basic 1MV search always done for all macroblocks, coded or not, keyframe or not */
+    oc_mcenc_search(cpi, &mcenc, mbi, 0, bmvs, &errormv, &error4mv);
+
+    if(mb->coded==0){
+      /* Don't bother to do a MV search against the golden frame.
+	 Just re-use the last vector, which should match well since the
+	 contents of the MB haven't changed much.*/
+      mb->analysis_mv[0][1]=mb->analysis_mv[1][1];
+      continue;
+    }
+
+    /* search golden frame */
+    oc_mcenc_search(cpi, &mcenc, mbi, 1, NULL, &errormv_gold, NULL);
+
+    if(cpi->FrameType == KEY_FRAME){
+      mb->mode = CODE_INTRA;
+      continue;
+    }
+
+    /* Count the number of coded blocks that are luma blocks, and replace the
+       block MVs for not-coded blocks with (0,0).*/    
+    for ( bi=0; bi<4; bi++ ){
+      fi = mbp->yuv[0][bi];
+      if(!cp[fi]) bmvs[bi]={0,0};
+    }
+      
+    /**************************************************************
+     Find the block choice with the lowest estimated coding cost
+
+     NOTE THAT if U or V is coded but no Y from a macro block then the
+     mode will be CODE_INTER_NO_MV as this is the default state to
+     which the mode data structure is initialised in encoder and
+     decoder at the start of each frame. */
+
+    /* calculate INTRA error */
+    for(ci=1;ci<64;ci++)
+      sad[CODE_INTRA]+=abs(efrag->dct_coeffs[ci]);
+   
+
+
+      BestError = HUGE_ERROR;
+      
+      
+      /* Look at the intra coding error. */
+      MBIntraError = GetMBIntraError( cpi, mbp );
+      BestError = (BestError > MBIntraError) ? MBIntraError : BestError;
+      
+      /* Get the golden frame error */
+      MBGFError = GetMBInterError( cpi, cpi->frame, cpi->golden, 
+				   mbp, 0, 0 );
+      BestError = (BestError > MBGFError) ? MBGFError : BestError;
+      
+      /* Calculate the 0,0 case. */
+      MBInterError = GetMBInterError( cpi, cpi->frame,
+				      cpi->lastrecon,
+				      mbp, 0, 0 );
+      BestError = (BestError > MBInterError) ? MBInterError : BestError;
+      
+      /* Measure error for last MV */
+      MBLastInterError =  GetMBInterError( cpi, cpi->frame,
+					   cpi->lastrecon,
+					   mbp, LastInterMVect.x,
+					   LastInterMVect.y );
+      BestError = (BestError > MBLastInterError) ?
+	MBLastInterError : BestError;
+      
+      /* Measure error for prior last MV */
+      MBPriorLastInterError =  GetMBInterError( cpi, cpi->frame,
+						cpi->lastrecon,
+						mbp, PriorLastInterMVect.x,
+						PriorLastInterMVect.y );
+      BestError = (BestError > MBPriorLastInterError) ?
+	MBPriorLastInterError : BestError;
+
+      /* Temporarily force usage of no motionvector blocks */
+      MBInterMVError = HUGE_ERROR;
+      InterMVect.x = 0;  /* Set 0,0 motion vector */
+      InterMVect.y = 0;
+
+      /* If the best error is above the required threshold search
+	 for a new inter MV */
+      if ( BestError > cpi->MinImprovementForNewMV && cpi->MotionCompensation) {
+	/* Use a mix of heirachical and exhaustive searches for
+	   quick mode. */
+	if ( cpi->info.quick_p ) {
+	  MBInterMVError = GetMBMVInterError( cpi, cpi->lastrecon,
+					      mbp,
+					      cpi->MVPixelOffsetY,
+					      &InterMVect );
+
+	  /* If we still do not have a good match try an exhaustive
+	     MBMV search */
+	  if ( (MBInterMVError > cpi->ExhaustiveSearchThresh) &&
+	       (BestError > cpi->ExhaustiveSearchThresh) ) {
+
+	    MBInterMVExError =
+	      GetMBMVExhaustiveSearch( cpi, cpi->lastrecon,
+				       mbp,
+				       &InterMVectEx );
+
+	    /* Is the Variance measure for the EX search
+	       better... If so then use it. */
+	    if ( MBInterMVExError < MBInterMVError ) {
+	      MBInterMVError = MBInterMVExError;
+	      InterMVect.x = InterMVectEx.x;
+	      InterMVect.y = InterMVectEx.y;
+	    }
+	  }
+	}else{
+	  /* Use an exhaustive search */
+	  MBInterMVError =
+	    GetMBMVExhaustiveSearch( cpi, cpi->lastrecon,
+				     mbp,
+				     &InterMVect );
+	}
+
+
+	/* Is the improvement, if any, good enough to justify a new MV */
+	if ( (16 * MBInterMVError < (BestError * cpi->MVChangeFactor)) &&
+	     ((MBInterMVError + cpi->MinImprovementForNewMV) < BestError) ){
+	  BestError = MBInterMVError;
+	}
+
+      }
+
+      /* If the best error is still above the required threshold
+	 search for a golden frame MV */
+      MBGF_MVError = HUGE_ERROR;
+      GFMVect.x = 0; /* Set 0,0 motion vector */
+      GFMVect.y = 0;
+      if ( BestError > cpi->MinImprovementForNewMV && cpi->MotionCompensation) {
+	/* Do an MV search in the golden reference frame */
+	MBGF_MVError = GetMBMVInterError( cpi, cpi->golden,
+					  mbp,
+					  cpi->MVPixelOffsetY, &GFMVect );
+
+	/* Measure error for last GFMV */
+	LastMBGF_MVError =  GetMBInterError( cpi, cpi->frame,
+					     cpi->golden,
+					     mbp,
+					     LastGFMVect.x,
+					     LastGFMVect.y );
+
+	/* Check against last GF motion vector and reset if the
+	   search has thrown a worse result. */
+	if ( LastMBGF_MVError < MBGF_MVError ) {
+	  GFMVect.x = LastGFMVect.x;
+	  GFMVect.y = LastGFMVect.y;
+	  MBGF_MVError = LastMBGF_MVError;
+	}else{
+	  LastGFMVect.x = GFMVect.x;
+	  LastGFMVect.y = GFMVect.y;
+	}
+
+	/* Is the improvement, if any, good enough to justify a new MV */
+	if ( (16 * MBGF_MVError < (BestError * cpi->MVChangeFactor)) &&
+	     ((MBGF_MVError + cpi->MinImprovementForNewMV) < BestError) ) {
+	  BestError = MBGF_MVError;
+	}
+      }
+
+      /* Finally... If the best error is still to high then consider
+	 the 4MV mode */
+      MBInterFOURMVError = HUGE_ERROR;
+      if ( BestError > cpi->FourMVThreshold && cpi->MotionCompensation) {
+	/* Get the 4MV error. */
+	MBInterFOURMVError =
+	  GetFOURMVExhaustiveSearch( cpi, cpi->lastrecon,
+				     mbp,
+				     FourMVect );
+
+	/* If the improvement is great enough then use the four MV mode */
+	if ( ((MBInterFOURMVError + cpi->MinImprovementForFourMV) <
+	      BestError) && (16 * MBInterFOURMVError <
+			     (BestError * cpi->FourMvChangeFactor))) {
+	  BestError = MBInterFOURMVError;
+	}
+      }
+
+      /********************************************************
+         end finding the best error
+         *******************************************************
+
+         Figure out what to do with the block we chose
+
+         Over-ride and force intra if error high and Intra error similar
+         Now choose a mode based on lowest error (with bias towards no MV) */
+
+      if ( (BestError > cpi->InterTripOutThresh) &&
+	   (10 * BestError > MBIntraError * 7 ) ) {
+	SetMBMotionVectorsAndMode(cpi,mbp,&ZeroVect,CODE_INTRA);
+      } else if ( BestError == MBInterError ) {
+	SetMBMotionVectorsAndMode(cpi,mbp,&ZeroVect,CODE_INTER_NO_MV);
+      } else if ( BestError == MBGFError ) {
+	SetMBMotionVectorsAndMode(cpi,mbp,&ZeroVect,CODE_USING_GOLDEN);
+      } else if ( BestError == MBLastInterError ) {
+	SetMBMotionVectorsAndMode(cpi,mbp,&LastInterMVect,CODE_INTER_LAST_MV);
+      } else if ( BestError == MBPriorLastInterError ) {
+	SetMBMotionVectorsAndMode(cpi,mbp,&PriorLastInterMVect,CODE_INTER_PRIOR_LAST);
+
+	/* Swap the prior and last MV cases over */
+	TmpMVect = PriorLastInterMVect;
+	PriorLastInterMVect = LastInterMVect;
+	LastInterMVect = TmpMVect;
+
+      } else if ( BestError == MBInterMVError ) {
+
+	SetMBMotionVectorsAndMode(cpi,mbp,&InterMVect,CODE_INTER_PLUS_MV);
+
+	/* Update Prior last mv with last mv */
+	PriorLastInterMVect.x = LastInterMVect.x;
+	PriorLastInterMVect.y = LastInterMVect.y;
+
+	/* Note last inter MV for future use */
+	LastInterMVect.x = InterMVect.x;
+	LastInterMVect.y = InterMVect.y;
+
+	CountMotionVector( cpi, &InterMVect);
+
+      } else if ( BestError == MBGF_MVError ) {
+
+	SetMBMotionVectorsAndMode(cpi,mbp,&GFMVect,CODE_GOLDEN_MV);
+
+	/* Note last inter GF MV for future use */
+	LastGFMVect.x = GFMVect.x;
+	LastGFMVect.y = GFMVect.y;
+
+	CountMotionVector( cpi, &GFMVect);
+      } else if ( BestError == MBInterFOURMVError ) {
+
+	mbp->mode = CODE_INTER_FOURMV;
+	mbp->mv[0] = FourMVect[0];
+	mbp->mv[1] = FourMVect[1];
+	mbp->mv[2] = FourMVect[2];
+	mbp->mv[3] = FourMVect[3];
+
+	/* Note the four MVs values for current macro-block. */
+	CountMotionVector( cpi, &FourMVect[0]);
+	CountMotionVector( cpi, &FourMVect[1]);
+	CountMotionVector( cpi, &FourMVect[2]);
+	CountMotionVector( cpi, &FourMVect[3]);
+
+	/* Update Prior last mv with last mv */
+	PriorLastInterMVect = LastInterMVect;
+
+	/* Note last inter MV for future use */
+	LastInterMVect = FourMVect[3];
+
+      } else {
+
+	SetMBMotionVectorsAndMode(cpi, mbp,&ZeroVect,CODE_INTRA);
+
+      }
+
+      /* setting up mode specific block types
+         *******************************************************/
+
+      *InterError += (BestError>>8);
+      *IntraError += (MBIntraError>>8);
+
+    }
+  }
+
+  /* Return number of pixels coded */
+  return 0;
+}
+
+

Added: branches/theora-thusnelda/lib/enc/mode_select.h
===================================================================
--- branches/theora-thusnelda/lib/enc/mode_select.h	                        (rev 0)
+++ branches/theora-thusnelda/lib/enc/mode_select.h	2008-01-08 23:41:13 UTC (rev 14381)
@@ -0,0 +1,8217 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2008                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: mode selection lookup tables
+  last mod: $Id$
+
+ ********************************************************************/
+
+#include "codec_internal.h"
+
+#define OC_BIT_SCALE (7)
+
+/* [qi][plane][mode][sad_bin] */
+ogg_uint16_t OC_RES_BITRATES[64][3][8][16]={
+  {
+    {
+      /*Y'  qi=0  OC_MODE_INTRA*/
+      {
+          476,  632, 1372, 2027, 2619, 3272, 3956, 4620,
+         5300, 5974, 6626, 7245, 7836, 8474, 9056,12823
+      },
+      /*Y'  qi=0  OC_MODE_INTER_NOMV*/
+      {
+           74,   95,  127,  263,  592, 1010, 1582, 2359,
+         3295, 4275, 5286, 6236, 6988, 7777, 8725,13318
+      },
+      /*Y'  qi=0  OC_MODE_INTER_MV*/
+      {
+          223,  258,  305,  459,  824, 1461, 2273, 3168,
+         4062, 4967, 5893, 6785, 7694, 8470, 9289,12589
+      },
+      /*Y'  qi=0  OC_MDOE_INTER_MV_LAST*/
+      {
+          199,  229,  266,  420,  776, 1350, 2121, 2987,
+         3909, 4868, 5841, 6780, 7688, 8529, 9327,12668
+      },
+      /*Y'  qi=0  OC_MODE_INTER_MV_LAST2*/
+      {
+          221,  261,  295,  436,  793, 1375, 2144, 3011,
+         3936, 4895, 5882, 6839, 7776, 8639, 9398,12826
+      },
+      /*Y'  qi=0  OC_MODE_INTER_MV_FOUR*/
+      {
+          252,  289,  324,  477,  844, 1463, 2274, 3173,
+         4100, 5046, 5982, 6909, 7780, 8588, 9358,12248
+      },
+      /*Y'  qi=0  OC_MODE_GOLDEN_NOMV*/
+      {
+          265,  297,  408,  739, 1444, 1989, 2404, 3139,
+         3879, 4394, 5131, 5967, 6262, 6833, 7631,13096
+      },
+      /*Y'  qi=0  OC_MODE_GOLDEN_MV*/
+      {
+          316,  348,  381,  625, 1158, 1661, 2342, 3151,
+         4094, 5062, 6045, 6988, 7862, 8665, 9420,12760
+      }
+    },
+    {
+      /*Cb  qi=0  OC_MODE_INTRA*/
+      {
+          457, 1182, 2197, 3154, 4159, 5256, 6252, 7084,
+         7945, 8846, 9524,10479,11039,11905,12674,16114
+      },
+      /*Cb  qi=0  OC_MODE_INTER_NOMV*/
+      {
+           55,   90,  260,  679, 1505, 3029, 4482, 5749,
+         6616, 7001, 7349, 7457, 7671, 7492, 7782, 8001
+      },
+      /*Cb  qi=0  OC_MODE_INTER_MV*/
+      {
+           35,  173,  510, 1346, 2519, 3995, 5144, 6672,
+         7823, 8681, 9591,10611,10955,12535,12121,14330
+      },
+      /*Cb  qi=0  OC_MDOE_INTER_MV_LAST*/
+      {
+           34,  156,  476, 1130, 2159, 3629, 5215, 6754,
+         8110, 9218,10134,10300,10982,10395,10888,10719
+      },
+      /*Cb  qi=0  OC_MODE_INTER_MV_LAST2*/
+      {
+           33,  166,  497, 1140, 2157, 3630, 5234, 6730,
+         8149, 9295,10312,10488,10568,10645,10943,11595
+      },
+      /*Cb  qi=0  OC_MODE_INTER_MV_FOUR*/
+      {
+           20,  178,  526, 1239, 2328, 3699, 5120, 6558,
+         7873, 8890, 9785,10528,11189,11793,12165,14903
+      },
+      /*Cb  qi=0  OC_MODE_GOLDEN_NOMV*/
+      {
+          112,  220,  500, 1066, 1908, 3199, 3770, 4392,
+         4592, 5275, 5284, 5458, 6029, 6134, 6305, 8462
+      },
+      /*Cb  qi=0  OC_MODE_GOLDEN_MV*/
+      {
+           23,  204,  572, 1248, 2271, 3523, 4832, 5771,
+         6389, 6313, 6357, 6756, 6406, 6533, 6549, 8494
+      }
+    },
+    {
+      /*Cr  qi=0  OC_MODE_INTRA*/
+      {
+          354,  976, 1749, 2553, 3277, 3998, 4656, 5295,
+         5948, 6531, 7173, 7740, 8309, 9125, 9439,11887
+      },
+      /*Cr  qi=0  OC_MODE_INTER_NOMV*/
+      {
+           47,   64,  105,  209,  447,  916, 2069, 2923,
+         3616, 3837, 4237, 4515, 4435, 4719, 4754, 4264
+      },
+      /*Cr  qi=0  OC_MODE_INTER_MV*/
+      {
+           32,  112,  258,  636, 1207, 1919, 2837, 3772,
+         4447, 5092, 5832, 6519, 6945, 6537, 7111, 8700
+      },
+      /*Cr  qi=0  OC_MDOE_INTER_MV_LAST*/
+      {
+           33,  115,  236,  607, 1107, 1681, 2592, 3621,
+         4588, 5507, 6271, 6687, 7354, 7199, 6916, 5722
+      },
+      /*Cr  qi=0  OC_MODE_INTER_MV_LAST2*/
+      {
+           31,  120,  236,  589, 1125, 1655, 2550, 3525,
+         4290, 5056, 5672, 6112, 6678, 6058, 5292, 5296
+      },
+      /*Cr  qi=0  OC_MODE_INTER_MV_FOUR*/
+      {
+           20,  120,  261,  663, 1245, 1871, 2711, 3641,
+         4597, 5351, 6091, 6884, 7369, 7670, 8045, 9350
+      },
+      /*Cr  qi=0  OC_MODE_GOLDEN_NOMV*/
+      {
+           93,  116,  202,  456,  960, 1495, 2274, 2914,
+         3091, 3475, 3958, 4175, 4293, 4415, 4675, 4808
+      },
+      /*Cr  qi=0  OC_MODE_GOLDEN_MV*/
+      {
+           24,  135,  267,  655, 1226, 1777, 2537, 3357,
+         3704, 3986, 4465, 4350, 4359, 4758, 4889, 4295
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=1  OC_MODE_INTRA*/
+      {
+          485,  652, 1438, 2134, 2764, 3465, 4192, 4881,
+         5591, 6285, 6958, 7579, 8191, 8840, 9430,13291
+      },
+      /*Y'  qi=1  OC_MODE_INTER_NOMV*/
+      {
+           78,   99,  138,  311,  688, 1153, 1817, 2695,
+         3700, 4744, 5813, 6771, 7547, 8466, 9413,13919
+      },
+      /*Y'  qi=1  OC_MODE_INTER_MV*/
+      {
+          239,  270,  317,  502,  969, 1700, 2600, 3515,
+         4434, 5331, 6241, 7209, 8081, 8896, 9762,13081
+      },
+      /*Y'  qi=1  OC_MDOE_INTER_MV_LAST*/
+      {
+          192,  229,  273,  460,  877, 1539, 2384, 3307,
+         4282, 5283, 6288, 7256, 8170, 9040, 9821,13176
+      },
+      /*Y'  qi=1  OC_MODE_INTER_MV_LAST2*/
+      {
+          225,  268,  304,  476,  898, 1566, 2412, 3333,
+         4307, 5316, 6341, 7331, 8245, 9114, 9900,13359
+      },
+      /*Y'  qi=1  OC_MODE_INTER_MV_FOUR*/
+      {
+          253,  292,  333,  521,  951, 1655, 2540, 3485,
+         4458, 5447, 6428, 7393, 8270, 9107, 9851,12755
+      },
+      /*Y'  qi=1  OC_MODE_GOLDEN_NOMV*/
+      {
+          285,  309,  441,  905, 1635, 2025, 2594, 3251,
+         4036, 4655, 5471, 6248, 6556, 7138, 7876,13739
+      },
+      /*Y'  qi=1  OC_MODE_GOLDEN_MV*/
+      {
+          339,  348,  387,  689, 1234, 1797, 2566, 3441,
+         4454, 5463, 6521, 7493, 8402, 9187, 9947,13286
+      }
+    },
+    {
+      /*Cb  qi=1  OC_MODE_INTRA*/
+      {
+          469, 1231, 2305, 3310, 4341, 5465, 6471, 7341,
+         8227, 9150, 9872,10820,11414,12362,13075,16640
+      },
+      /*Cb  qi=1  OC_MODE_INTER_NOMV*/
+      {
+           57,   99,  304,  797, 1727, 3370, 4809, 6067,
+         6910, 7450, 7468, 7969, 7648, 7747, 7930, 8330
+      },
+      /*Cb  qi=1  OC_MODE_INTER_MV*/
+      {
+           27,  192,  571, 1432, 2674, 4147, 5662, 7246,
+         8536, 9590,10045,11387,12736,14068,12607,14603
+      },
+      /*Cb  qi=1  OC_MDOE_INTER_MV_LAST*/
+      {
+           35,  170,  539, 1268, 2364, 3963, 5607, 7175,
+         8543, 9659,10420,10704,11477,10757,11486,11450
+      },
+      /*Cb  qi=1  OC_MODE_INTER_MV_LAST2*/
+      {
+           33,  184,  563, 1277, 2368, 3963, 5674, 7210,
+         8568, 9673,10362,10549,10951,11780,11816,12030
+      },
+      /*Cb  qi=1  OC_MODE_INTER_MV_FOUR*/
+      {
+           20,  196,  594, 1369, 2524, 3983, 5469, 6954,
+         8218, 9281,10111,10831,11632,12277,13257,15247
+      },
+      /*Cb  qi=1  OC_MODE_GOLDEN_NOMV*/
+      {
+          116,  216,  592, 1122, 1905, 3353, 4044, 4836,
+         4835, 5581, 5451, 5961, 6350, 6610, 6457, 8852
+      },
+      /*Cb  qi=1  OC_MODE_GOLDEN_MV*/
+      {
+           24,  208,  634, 1382, 2483, 3824, 5133, 6049,
+         6686, 6738, 6955, 7293, 6615, 7244, 7503, 8992
+      }
+    },
+    {
+      /*Cr  qi=1  OC_MODE_INTRA*/
+      {
+          363, 1030, 1850, 2693, 3453, 4200, 4866, 5526,
+         6253, 6844, 7498, 8073, 8633, 9539, 9893,12400
+      },
+      /*Cr  qi=1  OC_MODE_INTER_NOMV*/
+      {
+           49,   67,  117,  247,  551, 1115, 2247, 3264,
+         3829, 4189, 4330, 4677, 4879, 4746, 5399, 4432
+      },
+      /*Cr  qi=1  OC_MODE_INTER_MV*/
+      {
+           24,  118,  295,  719, 1275, 1932, 2956, 3993,
+         4952, 5669, 6508, 7293, 7309, 7100, 7450, 8738
+      },
+      /*Cr  qi=1  OC_MDOE_INTER_MV_LAST*/
+      {
+           34,  121,  262,  680, 1231, 1894, 2879, 3976,
+         4980, 5929, 6596, 7111, 7546, 7237, 7229, 6053
+      },
+      /*Cr  qi=1  OC_MODE_INTER_MV_LAST2*/
+      {
+           31,  126,  261,  676, 1270, 1874, 2856, 3851,
+         4701, 5384, 6003, 6573, 6988, 6267, 6763, 5411
+      },
+      /*Cr  qi=1  OC_MODE_INTER_MV_FOUR*/
+      {
+           21,  127,  288,  758, 1402, 2100, 3002, 4008,
+         4936, 5739, 6483, 7048, 7770, 8247, 8413, 9825
+      },
+      /*Cr  qi=1  OC_MODE_GOLDEN_NOMV*/
+      {
+           96,  120,  249,  574,  865, 1688, 2528, 3322,
+         3226, 3537, 4023, 4444, 4583, 4656, 4877, 4962
+      },
+      /*Cr  qi=1  OC_MODE_GOLDEN_MV*/
+      {
+           25,  138,  289,  740, 1370, 1991, 2803, 3677,
+         4205, 4319, 4979, 4651, 4860, 5132, 5524, 4751
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=2  OC_MODE_INTRA*/
+      {
+          496,  675, 1519, 2272, 2949, 3692, 4456, 5186,
+         5929, 6637, 7334, 7968, 8594, 9252, 9861,13843
+      },
+      /*Y'  qi=2  OC_MODE_INTER_NOMV*/
+      {
+           82,  103,  151,  371,  801, 1327, 2118, 3113,
+         4204, 5312, 6412, 7346, 8173, 9147,10260,14547
+      },
+      /*Y'  qi=2  OC_MODE_INTER_MV*/
+      {
+          236,  280,  336,  568, 1108, 1952, 2937, 3917,
+         4856, 5829, 6789, 7761, 8652, 9519,10375,13705
+      },
+      /*Y'  qi=2  OC_MDOE_INTER_MV_LAST*/
+      {
+          199,  233,  282,  513, 1012, 1775, 2705, 3698,
+         4729, 5789, 6830, 7825, 8754, 9653,10445,13772
+      },
+      /*Y'  qi=2  OC_MODE_INTER_MV_LAST2*/
+      {
+          226,  270,  305,  523, 1031, 1797, 2733, 3715,
+         4762, 5823, 6879, 7917, 8872, 9710,10517,13980
+      },
+      /*Y'  qi=2  OC_MODE_INTER_MV_FOUR*/
+      {
+          260,  297,  348,  581, 1095, 1904, 2870, 3881,
+         4912, 5950, 6980, 7968, 8860, 9697,10464,13338
+      },
+      /*Y'  qi=2  OC_MODE_GOLDEN_NOMV*/
+      {
+          279,  306,  476,  957, 1725, 2297, 2839, 3633,
+         4444, 5124, 6036, 6529, 6922, 7776, 7979,14329
+      },
+      /*Y'  qi=2  OC_MODE_GOLDEN_MV*/
+      {
+          308,  353,  394,  776, 1383, 2030, 2871, 3845,
+         4925, 6026, 7099, 8106, 8994, 9831,10572,13876
+      }
+    },
+    {
+      /*Cb  qi=2  OC_MODE_INTRA*/
+      {
+          485, 1291, 2447, 3500, 4570, 5739, 6737, 7641,
+         8558, 9482,10212,11223,11788,12802,13591,17150
+      },
+      /*Cb  qi=2  OC_MODE_INTER_NOMV*/
+      {
+           61,  110,  358,  940, 1968, 3694, 5260, 6435,
+         7182, 7927, 7849, 8157, 8033, 7860, 8125, 8433
+      },
+      /*Cb  qi=2  OC_MODE_INTER_MV*/
+      {
+           28,  209,  645, 1570, 2916, 4580, 6179, 7715,
+         8988, 9990,10472,11590,12642,13135,13104,14829
+      },
+      /*Cb  qi=2  OC_MDOE_INTER_MV_LAST*/
+      {
+           37,  188,  619, 1436, 2615, 4315, 6093, 7691,
+         9098,10234,11175,11294,11304,11712,11862,11917
+      },
+      /*Cb  qi=2  OC_MODE_INTER_MV_LAST2*/
+      {
+           35,  204,  644, 1442, 2594, 4292, 6149, 7725,
+         9140,10176,10551,11524,11779,11536,12599,12935
+      },
+      /*Cb  qi=2  OC_MODE_INTER_MV_FOUR*/
+      {
+           21,  214,  673, 1535, 2772, 4314, 5874, 7395,
+         8652, 9640,10566,11408,12140,12526,13187,15633
+      },
+      /*Cb  qi=2  OC_MODE_GOLDEN_NOMV*/
+      {
+          125,  261,  613, 1204, 2159, 3435, 4405, 5125,
+         5145, 5595, 5789, 6160, 6574, 6878, 6799, 8953
+      },
+      /*Cb  qi=2  OC_MODE_GOLDEN_MV*/
+      {
+           26,  229,  720, 1534, 2729, 4083, 5394, 6314,
+         6714, 6961, 6843, 6942, 6645, 7057, 7525, 9052
+      }
+    },
+    {
+      /*Cr  qi=2  OC_MODE_INTRA*/
+      {
+          373, 1086, 1967, 2863, 3653, 4449, 5158, 5834,
+         6643, 7204, 7893, 8529, 9091, 9986,10418,12982
+      },
+      /*Cr  qi=2  OC_MODE_INTER_NOMV*/
+      {
+           51,   72,  135,  303,  678, 1508, 2543, 3703,
+         4121, 4334, 4711, 4893, 5119, 4983, 5223, 4521
+      },
+      /*Cr  qi=2  OC_MODE_INTER_MV*/
+      {
+           25,  129,  331,  818, 1441, 2224, 3309, 4478,
+         5354, 6231, 6735, 7665, 8357, 7694, 8091, 9234
+      },
+      /*Cr  qi=2  OC_MDOE_INTER_MV_LAST*/
+      {
+           34,  131,  298,  786, 1399, 2180, 3303, 4462,
+         5452, 6530, 7106, 7346, 8099, 7448, 7438, 5942
+      },
+      /*Cr  qi=2  OC_MODE_INTER_MV_LAST2*/
+      {
+           34,  138,  298,  772, 1438, 2170, 3303, 4244,
+         5075, 5879, 6437, 6807, 7101, 6423, 6783, 5220
+      },
+      /*Cr  qi=2  OC_MODE_INTER_MV_FOUR*/
+      {
+           22,  136,  331,  873, 1595, 2382, 3392, 4427,
+         5382, 6184, 6957, 7928, 8173, 8378, 9142,10498
+      },
+      /*Cr  qi=2  OC_MODE_GOLDEN_NOMV*/
+      {
+          107,  140,  314,  662,  874, 1914, 2905, 3181,
+         3303, 3796, 4349, 4571, 4694, 5076, 5092, 5231
+      },
+      /*Cr  qi=2  OC_MODE_GOLDEN_MV*/
+      {
+           27,  146,  330,  845, 1531, 2264, 3100, 3930,
+         4173, 4362, 5105, 4699, 4814, 5492, 5364, 4739
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=3  OC_MODE_INTRA*/
+      {
+          502,  686, 1550, 2333, 3044, 3812, 4592, 5334,
+         6087, 6806, 7513, 8156, 8783, 9448,10058,14101
+      },
+      /*Y'  qi=3  OC_MODE_INTER_NOMV*/
+      {
+           83,  105,  157,  404,  857, 1425, 2272, 3316,
+         4426, 5553, 6654, 7600, 8366, 9286,10513,14877
+      },
+      /*Y'  qi=3  OC_MODE_INTER_MV*/
+      {
+          240,  285,  343,  607, 1194, 2087, 3079, 4078,
+         5034, 6016, 6990, 7961, 8916, 9788,10614,14008
+      },
+      /*Y'  qi=3  OC_MDOE_INTER_MV_LAST*/
+      {
+          199,  235,  286,  538, 1081, 1900, 2867, 3884,
+         4940, 6018, 7075, 8085, 9014, 9879,10700,14015
+      },
+      /*Y'  qi=3  OC_MODE_INTER_MV_LAST2*/
+      {
+          232,  273,  328,  581, 1145, 1980, 2949, 3937,
+         4975, 6048, 7111, 8110, 9070, 9956,10742,14274
+      },
+      /*Y'  qi=3  OC_MODE_INTER_MV_FOUR*/
+      {
+          259,  302,  356,  617, 1178, 2040, 3036, 4068,
+         5121, 6174, 7203, 8188, 9101, 9925,10700,13631
+      },
+      /*Y'  qi=3  OC_MODE_GOLDEN_NOMV*/
+      {
+          286,  286,  486, 1041, 1755, 2478, 2971, 3789,
+         4618, 5382, 6175, 6709, 7280, 7663, 8416,14660
+      },
+      /*Y'  qi=3  OC_MODE_GOLDEN_MV*/
+      {
+          341,  349,  402,  819, 1426, 2126, 3015, 4022,
+         5122, 6239, 7303, 8345, 9264,10073,10875,14167
+      }
+    },
+    {
+      /*Cb  qi=3  OC_MODE_INTRA*/
+      {
+          499, 1338, 2562, 3673, 4784, 5986, 7007, 7928,
+         8910, 9862,10621,11696,12350,13266,14028,17697
+      },
+      /*Cb  qi=3  OC_MODE_INTER_NOMV*/
+      {
+           64,  119,  403, 1089, 2258, 4109, 5682, 6749,
+         7626, 8187, 8077, 8623, 8370, 8243, 8621, 8922
+      },
+      /*Cb  qi=3  OC_MODE_INTER_MV*/
+      {
+           30,  222,  721, 1754, 3195, 4772, 6536, 8204,
+         9477,10372,11172,12128,12479,14549,14228,15843
+      },
+      /*Cb  qi=3  OC_MDOE_INTER_MV_LAST*/
+      {
+           38,  202,  690, 1594, 2863, 4685, 6544, 8157,
+         9476,10583,11737,12361,13068,13616,13986,15475
+      },
+      /*Cb  qi=3  OC_MODE_INTER_MV_LAST2*/
+      {
+           35,  215,  716, 1623, 2912, 4780, 6558, 8216,
+         9613,10463,11078,11309,11113,11356,12284,11630
+      },
+      /*Cb  qi=3  OC_MODE_INTER_MV_FOUR*/
+      {
+           23,  229,  742, 1695, 3015, 4670, 6321, 7863,
+         9128,10303,11028,12045,12465,13034,13877,16260
+      },
+      /*Cb  qi=3  OC_MODE_GOLDEN_NOMV*/
+      {
+          122,  314,  647, 1391, 2469, 3857, 4946, 5212,
+         5371, 5936, 6156, 6596, 6811, 7079, 7233, 9525
+      },
+      /*Cb  qi=3  OC_MODE_GOLDEN_MV*/
+      {
+           29,  254,  777, 1690, 2963, 4444, 5823, 6719,
+         7044, 7279, 7391, 7463, 7255, 7705, 8388, 9719
+      }
+    },
+    {
+      /*Cr  qi=3  OC_MODE_INTRA*/
+      {
+          382, 1111, 1999, 2899, 3696, 4496, 5219, 5914,
+         6724, 7315, 7991, 8649, 9266,10080,10536,13102
+      },
+      /*Cr  qi=3  OC_MODE_INTER_NOMV*/
+      {
+           52,   75,  142,  313,  696, 1575, 2627, 3713,
+         4281, 4402, 4756, 4905, 5121, 5463, 5283, 4892
+      },
+      /*Cr  qi=3  OC_MODE_INTER_MV*/
+      {
+           26,  131,  356,  853, 1535, 2380, 3435, 4513,
+         5580, 6278, 6876, 7860, 7934, 8073, 8429, 9093
+      },
+      /*Cr  qi=3  OC_MDOE_INTER_MV_LAST*/
+      {
+           36,  136,  312,  807, 1454, 2266, 3410, 4564,
+         5749, 6650, 7202, 7999, 8513, 7783, 8245, 8183
+      },
+      /*Cr  qi=3  OC_MODE_INTER_MV_LAST2*/
+      {
+           32,  141,  323,  833, 1435, 2182, 3357, 4485,
+         5322, 6165, 6620, 7250, 7385, 6943, 6487, 5132
+      },
+      /*Cr  qi=3  OC_MODE_INTER_MV_FOUR*/
+      {
+           23,  141,  348,  905, 1622, 2435, 3505, 4601,
+         5540, 6360, 7200, 7930, 8305, 8722, 9172,10336
+      },
+      /*Cr  qi=3  OC_MODE_GOLDEN_NOMV*/
+      {
+          114,  153,  326,  646, 1003, 1983, 2982, 3309,
+         3355, 3728, 4404, 4711, 4799, 5294, 5145, 5354
+      },
+      /*Cr  qi=3  OC_MODE_GOLDEN_MV*/
+      {
+           27,  153,  338,  873, 1539, 2352, 3258, 4224,
+         4401, 4705, 4910, 4573, 5208, 5224, 5967, 5637
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=4  OC_MODE_INTRA*/
+      {
+          511,  703, 1587, 2424, 3173, 3989, 4808, 5576,
+         6361, 7098, 7829, 8475, 9120, 9804,10422,14518
+      },
+      /*Y'  qi=4  OC_MODE_INTER_NOMV*/
+      {
+           87,  111,  175,  467,  968, 1611, 2571, 3690,
+         4869, 6045, 7206, 8163, 8984, 9922,11129,15347
+      },
+      /*Y'  qi=4  OC_MODE_INTER_MV*/
+      {
+          246,  292,  364,  672, 1347, 2331, 3388, 4417,
+         5426, 6440, 7458, 8448, 9402,10269,11146,14476
+      },
+      /*Y'  qi=4  OC_MDOE_INTER_MV_LAST*/
+      {
+          204,  238,  298,  592, 1211, 2124, 3154, 4224,
+         5338, 6453, 7539, 8564, 9494,10406,11220,14512
+      },
+      /*Y'  qi=4  OC_MODE_INTER_MV_LAST2*/
+      {
+          236,  276,  320,  608, 1242, 2167, 3198, 4254,
+         5376, 6498, 7602, 8658, 9584,10446,11312,14719
+      },
+      /*Y'  qi=4  OC_MODE_INTER_MV_FOUR*/
+      {
+          268,  309,  372,  672, 1308, 2261, 3325, 4413,
+         5508, 6611, 7687, 8692, 9596,10438,11212,14062
+      },
+      /*Y'  qi=4  OC_MODE_GOLDEN_NOMV*/
+      {
+          272,  294,  548, 1152, 1956, 2593, 3259, 4076,
+         4980, 5882, 6433, 7054, 7451, 8481, 8794,15068
+      },
+      /*Y'  qi=4  OC_MODE_GOLDEN_MV*/
+      {
+          331,  350,  424,  887, 1552, 2335, 3271, 4398,
+         5547, 6708, 7840, 8861, 9834,10574,11312,14608
+      }
+    },
+    {
+      /*Cb  qi=4  OC_MODE_INTRA*/
+      {
+          520, 1397, 2685, 3843, 4991, 6209, 7247, 8176,
+         9180,10156,10968,11996,12606,13564,14262,17938
+      },
+      /*Cb  qi=4  OC_MODE_INTER_NOMV*/
+      {
+           68,  133,  463, 1233, 2487, 4478, 5937, 6962,
+         7729, 8181, 8416, 8688, 8225, 8525, 8918, 9004
+      },
+      /*Cb  qi=4  OC_MODE_INTER_MV*/
+      {
+           29,  250,  800, 1906, 3430, 5178, 6996, 8650,
+         9908,11034,11578,12568,13131,14065,14728,16652
+      },
+      /*Cb  qi=4  OC_MDOE_INTER_MV_LAST*/
+      {
+           42,  225,  775, 1753, 3075, 5003, 6918, 8521,
+         9899,11004,11951,12080,12037,13284,12832,12956
+      },
+      /*Cb  qi=4  OC_MODE_INTER_MV_LAST2*/
+      {
+           41,  244,  822, 1758, 3048, 5015, 6929, 8652,
+         9785,11063,11494,12384,12552,13532,14308,14735
+      },
+      /*Cb  qi=4  OC_MODE_INTER_MV_FOUR*/
+      {
+           25,  257,  829, 1847, 3226, 4942, 6621, 8169,
+         9457,10524,11416,12245,12874,13489,15075,16289
+      },
+      /*Cb  qi=4  OC_MODE_GOLDEN_NOMV*/
+      {
+          141,  338,  680, 1514, 2484, 3988, 5141, 5361,
+         5513, 6150, 6366, 6593, 6988, 7292, 7310, 9675
+      },
+      /*Cb  qi=4  OC_MODE_GOLDEN_MV*/
+      {
+           31,  275,  874, 1831, 3117, 4730, 6004, 6752,
+         7395, 7243, 7468, 7403, 7112, 7901, 8036, 9963
+      }
+    },
+    {
+      /*Cr  qi=4  OC_MODE_INTRA*/
+      {
+          396, 1163, 2080, 3011, 3826, 4652, 5397, 6117,
+         6947, 7556, 8181, 8926, 9527,10356,10821,13399
+      },
+      /*Cr  qi=4  OC_MODE_INTER_NOMV*/
+      {
+           55,   82,  163,  366,  803, 1739, 2867, 3973,
+         4345, 4699, 4970, 5063, 5176, 5286, 5835, 4720
+      },
+      /*Cr  qi=4  OC_MODE_INTER_MV*/
+      {
+           26,  143,  393,  909, 1581, 2419, 3622, 4808,
+         5690, 6499, 7464, 8205, 8752, 7905, 9340,10595
+      },
+      /*Cr  qi=4  OC_MDOE_INTER_MV_LAST*/
+      {
+           38,  148,  351,  885, 1561, 2442, 3682, 4848,
+         5969, 6948, 7431, 7702, 8547, 7014, 7022, 6058
+      },
+      /*Cr  qi=4  OC_MODE_INTER_MV_LAST2*/
+      {
+           37,  158,  354,  887, 1607, 2411, 3641, 4780,
+         5507, 6312, 6739, 7383, 7391, 7145, 6150, 6136
+      },
+      /*Cr  qi=4  OC_MODE_INTER_MV_FOUR*/
+      {
+           24,  156,  390,  983, 1760, 2647, 3746, 4811,
+         5751, 6662, 7414, 7934, 8548, 8762,10129,10869
+      },
+      /*Cr  qi=4  OC_MODE_GOLDEN_NOMV*/
+      {
+          122,  162,  326,  645, 1132, 2252, 3216, 3506,
+         3623, 3932, 4555, 4787, 4785, 5169, 5323, 5431
+      },
+      /*Cr  qi=4  OC_MODE_GOLDEN_MV*/
+      {
+           31,  167,  376,  934, 1656, 2468, 3440, 4376,
+         4490, 4649, 5167, 4780, 5140, 5584, 6055, 4984
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=5  OC_MODE_INTRA*/
+      {
+          521,  726, 1660, 2572, 3362, 4218, 5074, 5868,
+         6673, 7435, 8173, 8831, 9495,10186,10820,15020
+      },
+      /*Y'  qi=5  OC_MODE_INTER_NOMV*/
+      {
+           89,  114,  192,  542, 1087, 1829, 2902, 4122,
+         5364, 6602, 7790, 8764, 9549,10598,11823,15917
+      },
+      /*Y'  qi=5  OC_MODE_INTER_MV*/
+      {
+          255,  299,  381,  762, 1534, 2611, 3704, 4780,
+         5817, 6881, 7933, 8951, 9925,10797,11647,14990
+      },
+      /*Y'  qi=5  OC_MDOE_INTER_MV_LAST*/
+      {
+          207,  242,  318,  670, 1379, 2381, 3473, 4604,
+         5769, 6920, 8033, 9069,10026,10918,11737,15085
+      },
+      /*Y'  qi=5  OC_MODE_INTER_MV_LAST2*/
+      {
+          242,  271,  323,  672, 1403, 2409, 3499, 4634,
+         5802, 6980, 8096, 9145,10126,11014,11823,15271
+      },
+      /*Y'  qi=5  OC_MODE_INTER_MV_FOUR*/
+      {
+          277,  313,  392,  757, 1490, 2526, 3646, 4789,
+         5940, 7083, 8178, 9196,10124,10971,11739,14598
+      },
+      /*Y'  qi=5  OC_MODE_GOLDEN_NOMV*/
+      {
+          282,  282,  531, 1319, 2107, 2752, 3535, 4413,
+         5409, 6239, 6767, 7398, 7934, 8521, 9940,15622
+      },
+      /*Y'  qi=5  OC_MODE_GOLDEN_MV*/
+      {
+          339,  355,  453,  966, 1691, 2566, 3605, 4762,
+         5986, 7209, 8370, 9399,10370,11207,11933,15161
+      }
+    },
+    {
+      /*Cb  qi=5  OC_MODE_INTRA*/
+      {
+          530, 1447, 2810, 4029, 5212, 6457, 7496, 8481,
+         9501,10539,11376,12444,12994,13939,14711,18424
+      },
+      /*Cb  qi=5  OC_MODE_INTER_NOMV*/
+      {
+           70,  141,  509, 1407, 2806, 4909, 6182, 7359,
+         8041, 8497, 8715, 9058, 8768, 8760, 9306, 9412
+      },
+      /*Cb  qi=5  OC_MODE_INTER_MV*/
+      {
+           30,  270,  877, 2089, 3678, 5607, 7503, 9107,
+        10491,11593,11881,12986,13949,14005,15208,16496
+      },
+      /*Cb  qi=5  OC_MDOE_INTER_MV_LAST*/
+      {
+           42,  238,  857, 1938, 3348, 5424, 7381, 9053,
+        10373,11424,12375,12399,12894,13643,13428,13986
+      },
+      /*Cb  qi=5  OC_MODE_INTER_MV_LAST2*/
+      {
+           48,  262,  913, 1927, 3279, 5379, 7313, 9021,
+        10364,11507,11959,12239,14029,14040,13656,14941
+      },
+      /*Cb  qi=5  OC_MODE_INTER_MV_FOUR*/
+      {
+           27,  270,  912, 2027, 3481, 5270, 7028, 8623,
+         9827,10943,11917,12546,13483,14146,15172,17260
+      },
+      /*Cb  qi=5  OC_MODE_GOLDEN_NOMV*/
+      {
+          130,  329,  743, 1652, 2760, 4507, 5842, 5433,
+         5817, 6214, 6544, 6805, 7373, 7523, 7645,10070
+      },
+      /*Cb  qi=5  OC_MODE_GOLDEN_MV*/
+      {
+           33,  286,  958, 2017, 3417, 5085, 6378, 7122,
+         7562, 7943, 7607, 7800, 7972, 8534, 8719,10247
+      }
+    },
+    {
+      /*Cr  qi=5  OC_MODE_INTRA*/
+      {
+          406, 1213, 2167, 3138, 3991, 4851, 5631, 6398,
+         7206, 7854, 8484, 9343, 9987,10727,11196,13787
+      },
+      /*Cr  qi=5  OC_MODE_INTER_NOMV*/
+      {
+           57,   88,  180,  418,  922, 1953, 3157, 4270,
+         4563, 4909, 5131, 5338, 5594, 5782, 5498, 5065
+      },
+      /*Cr  qi=5  OC_MODE_INTER_MV*/
+      {
+           26,  152,  425, 1015, 1735, 2624, 4000, 5120,
+         6182, 7023, 7566, 8433, 9700, 8864, 8038,10979
+      },
+      /*Cr  qi=5  OC_MDOE_INTER_MV_LAST*/
+      {
+           38,  157,  381,  968, 1702, 2695, 4016, 5258,
+         6391, 7322, 7793, 7627, 8547, 7629, 7197, 5952
+      },
+      /*Cr  qi=5  OC_MODE_INTER_MV_LAST2*/
+      {
+           43,  170,  385,  964, 1790, 2678, 3903, 5002,
+         5877, 6687, 7070, 7039, 7370, 6540, 6556, 6066
+      },
+      /*Cr  qi=5  OC_MODE_INTER_MV_FOUR*/
+      {
+           25,  165,  423, 1079, 1932, 2909, 4047, 5148,
+         6175, 6990, 7633, 8490, 8885, 9437,10259,11937
+      },
+      /*Cr  qi=5  OC_MODE_GOLDEN_NOMV*/
+      {
+          116,  171,  342,  720, 1286, 2628, 3147, 3489,
+         3562, 4119, 4759, 4903, 4999, 5375, 5385, 5611
+      },
+      /*Cr  qi=5  OC_MODE_GOLDEN_MV*/
+      {
+           33,  179,  418, 1029, 1846, 2735, 3633, 4652,
+         4846, 5103, 5372, 4823, 5249, 5928, 5880, 5795
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=6  OC_MODE_INTRA*/
+      {
+          535,  748, 1714, 2666, 3494, 4385, 5271, 6085,
+         6920, 7699, 8456, 9118, 9789,10494,11132,15403
+      },
+      /*Y'  qi=6  OC_MODE_INTER_NOMV*/
+      {
+           93,  119,  212,  607, 1198, 2036, 3197, 4504,
+         5785, 7061, 8267, 9279,10198,11251,12276,16375
+      },
+      /*Y'  qi=6  OC_MODE_INTER_MV*/
+      {
+          270,  309,  407,  841, 1693, 2828, 3962, 5058,
+         6140, 7252, 8316, 9372,10302,11226,12078,15373
+      },
+      /*Y'  qi=6  OC_MDOE_INTER_MV_LAST*/
+      {
+          204,  244,  333,  729, 1519, 2597, 3739, 4917,
+         6124, 7308, 8434, 9481,10412,11353,12183,15482
+      },
+      /*Y'  qi=6  OC_MODE_INTER_MV_LAST2*/
+      {
+          241,  272,  337,  732, 1549, 2637, 3781, 4957,
+         6151, 7349, 8508, 9584,10498,11397,12239,15652
+      },
+      /*Y'  qi=6  OC_MODE_INTER_MV_FOUR*/
+      {
+          275,  317,  410,  824, 1638, 2751, 3921, 5113,
+         6301, 7472, 8592, 9615,10536,11379,12145,15016
+      },
+      /*Y'  qi=6  OC_MODE_GOLDEN_NOMV*/
+      {
+          298,  297,  619, 1363, 2259, 2927, 3776, 4648,
+         5719, 6519, 7073, 7709, 8174, 9022,10459,16031
+      },
+      /*Y'  qi=6  OC_MODE_GOLDEN_MV*/
+      {
+          340,  367,  473, 1038, 1821, 2773, 3876, 5111,
+         6376, 7624, 8761, 9829,10743,11555,12252,15572
+      }
+    },
+    {
+      /*Cb  qi=6  OC_MODE_INTRA*/
+      {
+          551, 1510, 2948, 4223, 5435, 6697, 7743, 8740,
+         9803,10874,11745,12851,13355,14281,15140,18896
+      },
+      /*Cb  qi=6  OC_MODE_INTER_NOMV*/
+      {
+           76,  164,  594, 1601, 3088, 5189, 6627, 7604,
+         8215, 8836, 9117, 9226, 8773, 9243, 9313, 9515
+      },
+      /*Cb  qi=6  OC_MODE_INTER_MV*/
+      {
+           31,  303,  980, 2269, 3973, 5950, 7900, 9489,
+        10875,11994,12666,13647,15488,14763,16044,17567
+      },
+      /*Cb  qi=6  OC_MDOE_INTER_MV_LAST*/
+      {
+           46,  270,  956, 2101, 3592, 5793, 7815, 9485,
+        10846,11871,12698,13022,13268,13535,13990,14401
+      },
+      /*Cb  qi=6  OC_MODE_INTER_MV_LAST2*/
+      {
+           52,  299, 1017, 2093, 3533, 5682, 7745, 9505,
+        10744,11983,12747,12484,14471,14406,15294,16275
+      },
+      /*Cb  qi=6  OC_MODE_INTER_MV_FOUR*/
+      {
+           29,  306, 1013, 2205, 3727, 5623, 7409, 9009,
+        10268,11393,12208,13012,13864,14694,14930,17693
+      },
+      /*Cb  qi=6  OC_MODE_GOLDEN_NOMV*/
+      {
+          133,  376,  812, 1766, 2963, 4821, 6427, 5958,
+         6140, 6554, 6890, 7219, 7574, 7779, 7946,10397
+      },
+      /*Cb  qi=6  OC_MODE_GOLDEN_MV*/
+      {
+           34,  324, 1057, 2178, 3630, 5426, 6819, 7534,
+         7855, 8144, 7953, 8086, 7928, 8224, 8204,10424
+      }
+    },
+    {
+      /*Cr  qi=6  OC_MODE_INTRA*/
+      {
+          417, 1276, 2300, 3320, 4209, 5104, 5910, 6742,
+         7569, 8255, 8861, 9717,10445,11219,11628,14270
+      },
+      /*Cr  qi=6  OC_MODE_INTER_NOMV*/
+      {
+           61,   96,  214,  518, 1149, 2246, 3808, 4540,
+         4940, 5097, 5320, 5498, 5799, 5941, 6036, 5180
+      },
+      /*Cr  qi=6  OC_MODE_INTER_MV*/
+      {
+           27,  168,  480, 1151, 1935, 3005, 4432, 5527,
+         6598, 7581, 8547, 8203, 8871, 9541, 8910,12025
+      },
+      /*Cr  qi=6  OC_MDOE_INTER_MV_LAST*/
+      {
+           40,  172,  431, 1094, 1935, 3063, 4454, 5709,
+         6916, 7693, 8313, 8147, 8063, 7824, 7565, 6179
+      },
+      /*Cr  qi=6  OC_MODE_INTER_MV_LAST2*/
+      {
+           46,  185,  435, 1099, 2038, 2998, 4460, 5545,
+         6368, 7124, 7701, 7687, 7638, 7109, 7179, 6673
+      },
+      /*Cr  qi=6  OC_MODE_INTER_MV_FOUR*/
+      {
+           27,  180,  485, 1229, 2155, 3223, 4475, 5568,
+         6580, 7479, 8226, 8901, 9630,10508,10550,12095
+      },
+      /*Cr  qi=6  OC_MODE_GOLDEN_NOMV*/
+      {
+          114,  182,  384,  846, 1418, 2587, 3213, 3860,
+         3780, 4407, 5062, 5140, 5318, 5710, 5593, 5837
+      },
+      /*Cr  qi=6  OC_MODE_GOLDEN_MV*/
+      {
+           33,  190,  475, 1168, 2043, 3001, 3985, 4935,
+         5063, 5163, 5699, 5507, 5451, 6608, 5813, 5751
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=7  OC_MODE_INTRA*/
+      {
+          548,  765, 1782, 2795, 3670, 4591, 5511, 6362,
+         7215, 8006, 8779, 9452,10131,10847,11482,15825
+      },
+      /*Y'  qi=7  OC_MODE_INTER_NOMV*/
+      {
+           95,  121,  229,  679, 1322, 2286, 3559, 4942,
+         6270, 7579, 8796, 9799,10792,11898,12802,16828
+      },
+      /*Y'  qi=7  OC_MODE_INTER_MV*/
+      {
+          259,  312,  427,  934, 1917, 3113, 4288, 5416,
+         6525, 7663, 8753, 9815,10741,11651,12473,15830
+      },
+      /*Y'  qi=7  OC_MDOE_INTER_MV_LAST*/
+      {
+          214,  248,  353,  813, 1704, 2861, 4054, 5278,
+         6526, 7738, 8875, 9933,10893,11806,12635,15935
+      },
+      /*Y'  qi=7  OC_MODE_INTER_MV_LAST2*/
+      {
+          243,  278,  365,  817, 1735, 2907, 4098, 5327,
+         6569, 7785, 8962,10002,10957,11891,12657,16149
+      },
+      /*Y'  qi=7  OC_MODE_INTER_MV_FOUR*/
+      {
+          277,  319,  432,  915, 1833, 3026, 4247, 5484,
+         6704, 7891, 9037,10079,10986,11853,12605,15434
+      },
+      /*Y'  qi=7  OC_MODE_GOLDEN_NOMV*/
+      {
+          284,  297,  689, 1487, 2308, 3063, 4067, 4975,
+         6095, 6931, 7424, 8022, 8395, 9433,11190,16480
+      },
+      /*Y'  qi=7  OC_MODE_GOLDEN_MV*/
+      {
+          347,  356,  510, 1127, 1977, 3023, 4199, 5477,
+         6778, 8045, 9226,10298,11104,11995,12715,15999
+      }
+    },
+    {
+      /*Cb  qi=7  OC_MODE_INTRA*/
+      {
+          578, 1575, 3050, 4366, 5618, 6898, 7971, 9005,
+        10062,11237,12115,13169,13758,14578,15545,19337
+      },
+      /*Cb  qi=7  OC_MODE_INTER_NOMV*/
+      {
+           78,  178,  646, 1746, 3412, 5452, 6861, 7915,
+         8721, 9082, 9014, 9508, 9311, 9216, 9590, 9709
+      },
+      /*Cb  qi=7  OC_MODE_INTER_MV*/
+      {
+           32,  328, 1052, 2423, 4211, 6392, 8329,10020,
+        11320,12335,13187,13673,14507,15569,15613,17477
+      },
+      /*Cb  qi=7  OC_MDOE_INTER_MV_LAST*/
+      {
+           48,  293, 1028, 2245, 3815, 6137, 8174, 9877,
+        11138,12262,12871,13341,13603,14971,14591,14952
+      },
+      /*Cb  qi=7  OC_MODE_INTER_MV_LAST2*/
+      {
+           56,  321, 1095, 2231, 3726, 6046, 8057, 9855,
+        11066,12240,13138,12724,14364,15267,15743,16337
+      },
+      /*Cb  qi=7  OC_MODE_INTER_MV_FOUR*/
+      {
+           33,  333, 1088, 2342, 3949, 5906, 7760, 9331,
+        10671,11771,12918,13478,14038,14750,15301,17891
+      },
+      /*Cb  qi=7  OC_MODE_GOLDEN_NOMV*/
+      {
+          132,  403,  848, 1854, 3147, 5245, 6528, 5879,
+         6302, 6808, 7233, 7617, 7733, 8331, 8001,10520
+      },
+      /*Cb  qi=7  OC_MODE_GOLDEN_MV*/
+      {
+           39,  343, 1133, 2343, 3857, 5663, 6881, 7622,
+         8006, 8245, 7893, 8273, 7969, 8364, 8803,10610
+      }
+    },
+    {
+      /*Cr  qi=7  OC_MODE_INTRA*/
+      {
+          435, 1319, 2374, 3426, 4349, 5261, 6080, 6933,
+         7785, 8498, 9065, 9934,10697,11441,11879,14561
+      },
+      /*Cr  qi=7  OC_MODE_INTER_NOMV*/
+      {
+           62,  100,  229,  561, 1287, 2464, 4093, 4719,
+         4999, 5342, 5618, 5631, 6062, 5827, 6099, 5207
+      },
+      /*Cr  qi=7  OC_MODE_INTER_MV*/
+      {
+           27,  176,  517, 1225, 2088, 3157, 4633, 5865,
+         6870, 7862, 8407, 8405, 9364, 9164,10974,10981
+      },
+      /*Cr  qi=7  OC_MDOE_INTER_MV_LAST*/
+      {
+           42,  183,  461, 1171, 2074, 3287, 4725, 6016,
+         7165, 8073, 8222, 8227, 8760, 7649, 7481, 6486
+      },
+      /*Cr  qi=7  OC_MODE_INTER_MV_LAST2*/
+      {
+           48,  196,  468, 1177, 2131, 3289, 4672, 5678,
+         6620, 7506, 7733, 7743, 7971, 7608, 8029, 6429
+      },
+      /*Cr  qi=7  OC_MODE_INTER_MV_FOUR*/
+      {
+           29,  191,  520, 1314, 2304, 3427, 4743, 5874,
+         6876, 7810, 8591, 9553, 9902,10356,11418,12678
+      },
+      /*Cr  qi=7  OC_MODE_GOLDEN_NOMV*/
+      {
+          116,  195,  422,  915, 1502, 2431, 3299, 3742,
+         3971, 4774, 4878, 5258, 5430, 5410, 6139, 5936
+      },
+      /*Cr  qi=7  OC_MODE_GOLDEN_MV*/
+      {
+           36,  196,  500, 1227, 2192, 3194, 4268, 5204,
+         5219, 5398, 5565, 5405, 5769, 6391, 6147, 5729
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=8  OC_MODE_INTRA*/
+      {
+          562,  790, 1842, 2922, 3842, 4793, 5749, 6624,
+         7506, 8313, 9097, 9774,10459,11206,11844,16218
+      },
+      /*Y'  qi=8  OC_MODE_INTER_NOMV*/
+      {
+          101,  131,  264,  784, 1491, 2573, 3953, 5391,
+         6735, 8069, 9312,10306,11378,12442,13626,17294
+      },
+      /*Y'  qi=8  OC_MODE_INTER_MV*/
+      {
+          266,  326,  471, 1054, 2147, 3392, 4597, 5729,
+         6881, 8022, 9166,10225,11196,12115,12948,16248
+      },
+      /*Y'  qi=8  OC_MDOE_INTER_MV_LAST*/
+      {
+          221,  254,  375,  897, 1897, 3130, 4383, 5669,
+         6966, 8227, 9390,10453,11417,12312,13149,16452
+      },
+      /*Y'  qi=8  OC_MODE_INTER_MV_LAST2*/
+      {
+          251,  294,  424,  956, 1976, 3215, 4441, 5713,
+         6972, 8184, 9332,10382,11327,12242,13047,16509
+      },
+      /*Y'  qi=8  OC_MODE_INTER_MV_FOUR*/
+      {
+          285,  329,  465, 1015, 2036, 3300, 4581, 5868,
+         7126, 8344, 9498,10530,11456,12292,13037,15817
+      },
+      /*Y'  qi=8  OC_MODE_GOLDEN_NOMV*/
+      {
+          304,  307,  727, 1606, 2471, 3276, 4359, 5375,
+         6545, 7275, 7754, 8512, 8945, 9537,12077,16894
+      },
+      /*Y'  qi=8  OC_MODE_GOLDEN_MV*/
+      {
+          373,  372,  570, 1270, 2166, 3295, 4532, 5890,
+         7245, 8530, 9737,10784,11665,12491,13186,16377
+      }
+    },
+    {
+      /*Cb  qi=8  OC_MODE_INTRA*/
+      {
+          612, 1696, 3272, 4668, 5982, 7274, 8378, 9437,
+        10479,11750,12631,13640,14329,15060,16043,19886
+      },
+      /*Cb  qi=8  OC_MODE_INTER_NOMV*/
+      {
+           83,  203,  763, 2035, 3871, 5784, 7451, 8681,
+        10213,12002,11900,11320,11930,12408,10549, 7446
+      },
+      /*Cb  qi=8  OC_MODE_INTER_MV*/
+      {
+           33,  377, 1214, 2713, 4582, 6847, 8871,10571,
+        11871,13066,14081,14684,15172,16096,15613,17972
+      },
+      /*Cb  qi=8  OC_MDOE_INTER_MV_LAST*/
+      {
+           58,  344, 1214, 2529, 4200, 6689, 8759,10335,
+        11390,11881,11823,11981,11073,10764,10918,10280
+      },
+      /*Cb  qi=8  OC_MODE_INTER_MV_LAST2*/
+      {
+           55,  366, 1264, 2567, 4252, 6698, 8706,10572,
+        11852,12920,13168,13724,14546,15601,16427,16842
+      },
+      /*Cb  qi=8  OC_MODE_INTER_MV_FOUR*/
+      {
+           38,  388, 1267, 2640, 4316, 6393, 8236, 9822,
+        11113,12171,13105,13822,14769,15540,16011,18461
+      },
+      /*Cb  qi=8  OC_MODE_GOLDEN_NOMV*/
+      {
+          131,  460,  965, 2172, 3563, 5959, 6333, 6291,
+         6630, 7185, 7626, 8132, 8148, 8435, 8372,10536
+      },
+      /*Cb  qi=8  OC_MODE_GOLDEN_MV*/
+      {
+           42,  405, 1317, 2640, 4224, 6195, 7213, 8034,
+         8064, 8514, 8060, 8441, 8294, 8444, 8803,10454
+      }
+    },
+    {
+      /*Cr  qi=8  OC_MODE_INTRA*/
+      {
+          451, 1387, 2495, 3583, 4536, 5479, 6313, 7188,
+         8055, 8769, 9363,10252,11061,11738,12235,14983
+      },
+      /*Cr  qi=8  OC_MODE_INTER_NOMV*/
+      {
+           66,  109,  260,  633, 1405, 2679, 4375, 4885,
+         5414, 5939, 6845, 7824, 7937, 6923, 8967, 6027
+      },
+      /*Cr  qi=8  OC_MODE_INTER_MV*/
+      {
+           27,  193,  575, 1344, 2255, 3487, 5071, 6218,
+         7239, 8243, 8876, 9292, 9720, 8756,10391,11109
+      },
+      /*Cr  qi=8  OC_MDOE_INTER_MV_LAST*/
+      {
+           49,  203,  510, 1281, 2271, 3544, 5005, 6187,
+         7031, 7422, 7296, 6922, 6715, 6833, 6994, 5814
+      },
+      /*Cr  qi=8  OC_MODE_INTER_MV_LAST2*/
+      {
+           45,  209,  527, 1321, 2290, 3516, 4972, 6072,
+         6901, 7350, 7296, 7321, 8406, 6898, 6931, 7460
+      },
+      /*Cr  qi=8  OC_MODE_INTER_MV_FOUR*/
+      {
+           31,  211,  577, 1439, 2511, 3717, 5050, 6167,
+         7085, 7967, 8704, 9383,10441,10688,11291,12481
+      },
+      /*Cr  qi=8  OC_MODE_GOLDEN_NOMV*/
+      {
+          112,  209,  491, 1044, 1675, 2875, 3332, 4103,
+         4262, 5162, 5069, 5549, 5605, 5795, 5852, 6134
+      },
+      /*Cr  qi=8  OC_MODE_GOLDEN_MV*/
+      {
+           40,  223,  556, 1362, 2360, 3437, 4598, 5022,
+         5211, 5574, 5272, 5393, 5741, 5726, 5955, 5582
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=9  OC_MODE_INTRA*/
+      {
+          583,  823, 1954, 3146, 4114, 5110, 6098, 7001,
+         7902, 8716, 9516,10191,10894,11647,12297,16748
+      },
+      /*Y'  qi=9  OC_MODE_INTER_NOMV*/
+      {
+          102,  134,  304,  897, 1708, 2955, 4448, 5946,
+         7317, 8681, 9869,10884,11713,12906,14232,17956
+      },
+      /*Y'  qi=9  OC_MODE_INTER_MV*/
+      {
+          267,  329,  521, 1239, 2421, 3782, 4998, 6195,
+         7407, 8594, 9701,10739,11722,12651,13557,16726
+      },
+      /*Y'  qi=9  OC_MDOE_INTER_MV_LAST*/
+      {
+          225,  262,  423, 1053, 2183, 3498, 4805, 6137,
+         7470, 8750, 9918,11007,11946,12870,13657,16992
+      },
+      /*Y'  qi=9  OC_MODE_INTER_MV_LAST2*/
+      {
+          243,  300,  474, 1119, 2276, 3591, 4879, 6176,
+         7479, 8725, 9905,10942,11908,12829,13592,17087
+      },
+      /*Y'  qi=9  OC_MODE_INTER_MV_FOUR*/
+      {
+          292,  336,  522, 1192, 2342, 3676, 5014, 6348,
+         7643, 8874,10045,11083,11986,12831,13590,16379
+      },
+      /*Y'  qi=9  OC_MODE_GOLDEN_NOMV*/
+      {
+          291,  333,  823, 1778, 2652, 3561, 4717, 5839,
+         6951, 7717, 8308, 8669, 9684,10657,12384,17450
+      },
+      /*Y'  qi=9  OC_MODE_GOLDEN_MV*/
+      {
+          362,  378,  616, 1398, 2427, 3650, 4961, 6373,
+         7779, 9115,10267,11337,12205,13010,13669,16908
+      }
+    },
+    {
+      /*Cb  qi=9  OC_MODE_INTRA*/
+      {
+          631, 1766, 3404, 4886, 6261, 7559, 8690, 9749,
+        10829,12169,13059,14081,14709,15468,16505,20330
+      },
+      /*Cb  qi=9  OC_MODE_INTER_NOMV*/
+      {
+           86,  217,  844, 2284, 4217, 6245, 7901, 9038,
+        11119,12379,12070,11851,12745,12266,11269, 7327
+      },
+      /*Cb  qi=9  OC_MODE_INTER_MV*/
+      {
+           38,  413, 1345, 2961, 4938, 7331, 9416,11071,
+        12432,13264,13984,15158,15082,17712,17441,18168
+      },
+      /*Cb  qi=9  OC_MDOE_INTER_MV_LAST*/
+      {
+           59,  370, 1338, 2772, 4538, 7174, 9279,10844,
+        11850,12375,12193,12246,11251,11034,11021,10726
+      },
+      /*Cb  qi=9  OC_MODE_INTER_MV_LAST2*/
+      {
+           60,  395, 1392, 2817, 4626, 7159, 9320,11050,
+        12307,13338,14330,14130,15615,17268,15844,16476
+      },
+      /*Cb  qi=9  OC_MODE_INTER_MV_FOUR*/
+      {
+           41,  415, 1388, 2880, 4654, 6823, 8766,10387,
+        11649,12827,13823,14349,14962,15954,16932,19138
+      },
+      /*Cb  qi=9  OC_MODE_GOLDEN_NOMV*/
+      {
+          144,  479, 1057, 2382, 4162, 5999, 6231, 6296,
+         6958, 7236, 8314, 8275, 8586, 8687, 8694,10895
+      },
+      /*Cb  qi=9  OC_MODE_GOLDEN_MV*/
+      {
+           45,  460, 1453, 2878, 4553, 6534, 7715, 8300,
+         8421, 8778, 8562, 8913, 8670, 8944, 9391,10824
+      }
+    },
+    {
+      /*Cr  qi=9  OC_MODE_INTRA*/
+      {
+          467, 1460, 2618, 3746, 4739, 5704, 6588, 7470,
+         8361, 9072, 9659,10533,11398,11958,12557,15329
+      },
+      /*Cr  qi=9  OC_MODE_INTER_NOMV*/
+      {
+           67,  118,  290,  723, 1600, 3145, 4706, 5334,
+         5873, 6266, 7165, 7962, 7729, 8448, 8588, 5948
+      },
+      /*Cr  qi=9  OC_MODE_INTER_MV*/
+      {
+           30,  212,  627, 1492, 2508, 3831, 5434, 6536,
+         7643, 8910, 8868, 9374, 9772, 9712,11167,11630
+      },
+      /*Cr  qi=9  OC_MDOE_INTER_MV_LAST*/
+      {
+           51,  215,  560, 1419, 2481, 3866, 5364, 6551,
+         7349, 7692, 7274, 7120, 6874, 6655, 7142, 6065
+      },
+      /*Cr  qi=9  OC_MODE_INTER_MV_LAST2*/
+      {
+           49,  223,  587, 1452, 2495, 3803, 5270, 6409,
+         7096, 7424, 7607, 7800, 7361, 7250, 7654, 7824
+      },
+      /*Cr  qi=9  OC_MODE_INTER_MV_FOUR*/
+      {
+           34,  227,  633, 1584, 2706, 3993, 5345, 6491,
+         7505, 8370, 9124, 9898,10980,10596,12049,13587
+      },
+      /*Cr  qi=9  OC_MODE_GOLDEN_NOMV*/
+      {
+          120,  237,  549, 1206, 1914, 2950, 3680, 4144,
+         4524, 4906, 5409, 5483, 5581, 6060, 5839, 6292
+      },
+      /*Cr  qi=9  OC_MODE_GOLDEN_MV*/
+      {
+           45,  245,  616, 1495, 2593, 3703, 4877, 5221,
+         5443, 5546, 5474, 5663, 5779, 6191, 5957, 5800
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=10  OC_MODE_INTRA*/
+      {
+          592,  846, 1981, 3196, 4189, 5213, 6215, 7133,
+         8041, 8869, 9676,10362,11063,11820,12489,17017
+      },
+      /*Y'  qi=10  OC_MODE_INTER_NOMV*/
+      {
+          106,  140,  333,  967, 1819, 3120, 4664, 6178,
+         7568, 8937,10127,11138,11992,13342,14563,18285
+      },
+      /*Y'  qi=10  OC_MODE_INTER_MV*/
+      {
+          287,  343,  546, 1306, 2574, 3931, 5198, 6413,
+         7629, 8825, 9963,11000,11964,12913,13737,17069
+      },
+      /*Y'  qi=10  OC_MDOE_INTER_MV_LAST*/
+      {
+          221,  268,  442, 1112, 2296, 3648, 4987, 6345,
+         7699, 8983,10161,11248,12195,13123,13927,17311
+      },
+      /*Y'  qi=10  OC_MODE_INTER_MV_LAST2*/
+      {
+          261,  306,  492, 1180, 2392, 3740, 5065, 6380,
+         7701, 8968,10161,11225,12122,13081,13829,17412
+      },
+      /*Y'  qi=10  OC_MODE_INTER_MV_FOUR*/
+      {
+          302,  343,  541, 1246, 2450, 3825, 5192, 6549,
+         7863, 9112,10295,11313,12240,13075,13830,16660
+      },
+      /*Y'  qi=10  OC_MODE_GOLDEN_NOMV*/
+      {
+          310,  341,  817, 1834, 2694, 3712, 4879, 6058,
+         7196, 7960, 8486, 8868, 9703,10837,12813,17824
+      },
+      /*Y'  qi=10  OC_MODE_GOLDEN_MV*/
+      {
+          353,  379,  641, 1465, 2535, 3782, 5137, 6586,
+         7995, 9353,10543,11643,12573,13469,14156,17511
+      }
+    },
+    {
+      /*Cb  qi=10  OC_MODE_INTRA*/
+      {
+          644, 1789, 3424, 4917, 6289, 7592, 8731, 9791,
+        10880,12194,13104,14107,14789,15539,16546,20340
+      },
+      /*Cb  qi=10  OC_MODE_INTER_NOMV*/
+      {
+           88,  227,  869, 2320, 4281, 6210, 7953, 9428,
+        10073,12490,12040,12486,12938,12168,12805, 7137
+      },
+      /*Cb  qi=10  OC_MODE_INTER_MV*/
+      {
+           36,  421, 1375, 2999, 5010, 7425, 9547,11201,
+        12589,14006,14252,14613,15709,17649,17098,18775
+      },
+      /*Cb  qi=10  OC_MDOE_INTER_MV_LAST*/
+      {
+           62,  380, 1366, 2809, 4576, 7215, 9306,10903,
+        11943,12417,12474,12645,11730,11248,11707,11106
+      },
+      /*Cb  qi=10  OC_MODE_INTER_MV_LAST2*/
+      {
+           63,  401, 1424, 2848, 4655, 7209, 9333,11107,
+        12430,13447,15432,15722,16103,15374,17623,17061
+      },
+      /*Cb  qi=10  OC_MODE_INTER_MV_FOUR*/
+      {
+           42,  425, 1409, 2910, 4686, 6867, 8823,10475,
+        11677,12806,13956,14556,14898,16552,17390,19429
+      },
+      /*Cb  qi=10  OC_MODE_GOLDEN_NOMV*/
+      {
+          163,  489, 1088, 2440, 4169, 5996, 6240, 6662,
+         7167, 7603, 8353, 8363, 8532, 9065, 8831,11131
+      },
+      /*Cb  qi=10  OC_MODE_GOLDEN_MV*/
+      {
+           48,  464, 1472, 2914, 4590, 6862, 8706, 9723,
+        10641,10117,10307,10250, 9007,12307,10550, 9113
+      }
+    },
+    {
+      /*Cr  qi=10  OC_MODE_INTRA*/
+      {
+          476, 1501, 2682, 3823, 4837, 5830, 6724, 7628,
+         8566, 9257, 9869,10750,11666,12213,12857,15631
+      },
+      /*Cr  qi=10  OC_MODE_INTER_NOMV*/
+      {
+           70,  128,  322,  795, 1743, 3412, 4841, 5507,
+         6072, 6585, 6805, 7446, 7868, 9084, 8101, 6417
+      },
+      /*Cr  qi=10  OC_MODE_INTER_MV*/
+      {
+           29,  230,  670, 1545, 2609, 4029, 5639, 6750,
+         7896, 8425, 9102, 9378, 9319,10298,10303,13429
+      },
+      /*Cr  qi=10  OC_MDOE_INTER_MV_LAST*/
+      {
+           55,  229,  597, 1502, 2650, 4075, 5584, 6835,
+         7613, 7863, 7482, 7200, 6998, 7480, 7393, 6369
+      },
+      /*Cr  qi=10  OC_MODE_INTER_MV_LAST2*/
+      {
+           54,  240,  630, 1560, 2701, 4035, 5560, 6553,
+         7327, 7937, 7506, 8733, 8040, 6384, 7895, 8749
+      },
+      /*Cr  qi=10  OC_MODE_INTER_MV_FOUR*/
+      {
+           36,  243,  675, 1674, 2847, 4202, 5562, 6713,
+         7737, 8651, 9498,10123,10973,11042,12613,14092
+      },
+      /*Cr  qi=10  OC_MODE_GOLDEN_NOMV*/
+      {
+          126,  244,  587, 1253, 2109, 3204, 4063, 4400,
+         4792, 4870, 5738, 5760, 5861, 6402, 6490, 6733
+      },
+      /*Cr  qi=10  OC_MODE_GOLDEN_MV*/
+      {
+           48,  255,  642, 1602, 2798, 4018, 5571, 6216,
+         7695, 6689, 7023, 7240, 7011, 9217, 8570, 8429
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=11  OC_MODE_INTRA*/
+      {
+          609,  871, 2061, 3353, 4392, 5457, 6498, 7447,
+         8373, 9212,10038,10734,11446,12223,12862,17460
+      },
+      /*Y'  qi=11  OC_MODE_INTER_NOMV*/
+      {
+          108,  142,  376, 1072, 2038, 3503, 5142, 6680,
+         8103, 9464,10705,11756,12711,13997,15048,18940
+      },
+      /*Y'  qi=11  OC_MODE_INTER_MV*/
+      {
+          301,  351,  596, 1471, 2818, 4245, 5546, 6791,
+         8025, 9257,10441,11496,12474,13421,14257,17510
+      },
+      /*Y'  qi=11  OC_MDOE_INTER_MV_LAST*/
+      {
+          232,  272,  482, 1253, 2565, 3993, 5389, 6802,
+         8185, 9484,10683,11741,12715,13624,14395,17747
+      },
+      /*Y'  qi=11  OC_MODE_INTER_MV_LAST2*/
+      {
+          265,  311,  532, 1321, 2654, 4087, 5457, 6821,
+         8150, 9417,10613,11647,12574,13487,14274,17831
+      },
+      /*Y'  qi=11  OC_MODE_INTER_MV_FOUR*/
+      {
+          310,  347,  593, 1406, 2729, 4175, 5607, 7005,
+         8349, 9600,10797,11826,12748,13552,14316,17104
+      },
+      /*Y'  qi=11  OC_MODE_GOLDEN_NOMV*/
+      {
+          303,  332,  921, 2022, 2900, 4068, 5358, 6562,
+         7605, 8480, 8884, 9320, 9835,11589,13177,18244
+      },
+      /*Y'  qi=11  OC_MODE_GOLDEN_MV*/
+      {
+          394,  397,  723, 1627, 2790, 4139, 5543, 7042,
+         8507, 9849,11042,12106,13034,13822,14519,17647
+      }
+    },
+    {
+      /*Cb  qi=11  OC_MODE_INTRA*/
+      {
+          693, 1940, 3661, 5256, 6684, 8019, 9166,10216,
+        11394,12742,13706,14690,15430,16118,17135,21064
+      },
+      /*Cb  qi=11  OC_MODE_INTER_NOMV*/
+      {
+           96,  266, 1021, 2689, 4805, 6688, 8445, 9490,
+        10985,13177,12478,13909,12860,13041,11786, 7035
+      },
+      /*Cb  qi=11  OC_MODE_INTER_MV*/
+      {
+           39,  475, 1548, 3354, 5461, 8089,10157,11911,
+        13192,14418,14652,15775,17096,17397,19344,20330
+      },
+      /*Cb  qi=11  OC_MDOE_INTER_MV_LAST*/
+      {
+           70,  437, 1596, 3164, 5028, 7826, 9929,11482,
+        12453,12953,12791,12958,11968,11597,11851,11435
+      },
+      /*Cb  qi=11  OC_MODE_INTER_MV_LAST2*/
+      {
+           71,  465, 1656, 3186, 5104, 7777, 9953,11895,
+        12876,14244,16218,15200,16101,16815,19361,19582
+      },
+      /*Cb  qi=11  OC_MODE_INTER_MV_FOUR*/
+      {
+           48,  487, 1624, 3271, 5154, 7429, 9419,11158,
+        12392,13468,14557,15151,15595,16701,18737,20143
+      },
+      /*Cb  qi=11  OC_MODE_GOLDEN_NOMV*/
+      {
+          163,  542, 1237, 2823, 4347, 6147, 6403, 6720,
+         7445, 8089, 8652, 8883, 9220, 9450, 9159,11573
+      },
+      /*Cb  qi=11  OC_MODE_GOLDEN_MV*/
+      {
+           54,  538, 1707, 3264, 5039, 7180, 8390, 8974,
+         8873, 9230, 9298, 9573, 9185, 9615,10330,11284
+      }
+    },
+    {
+      /*Cr  qi=11  OC_MODE_INTRA*/
+      {
+          497, 1589, 2837, 4019, 5073, 6100, 7036, 7965,
+         8896, 9606,10314,11131,12062,12583,13221,16195
+      },
+      /*Cr  qi=11  OC_MODE_INTER_NOMV*/
+      {
+           72,  140,  366,  918, 2024, 3802, 5152, 5530,
+         6154, 6525, 7951, 7934, 8668, 7936, 9412, 6516
+      },
+      /*Cr  qi=11  OC_MODE_INTER_MV*/
+      {
+           31,  246,  731, 1706, 2858, 4487, 6039, 7345,
+         8205, 9376, 9989, 9855,10542,11663,10961,12939
+      },
+      /*Cr  qi=11  OC_MDOE_INTER_MV_LAST*/
+      {
+           59,  247,  660, 1693, 2959, 4503, 6065, 7247,
+         7959, 8239, 7841, 7423, 7232, 7390, 7523, 6570
+      },
+      /*Cr  qi=11  OC_MODE_INTER_MV_LAST2*/
+      {
+           58,  259,  699, 1749, 3020, 4428, 5974, 7179,
+         7875, 8188, 7727, 8509, 7490, 8309, 8743, 9875
+      },
+      /*Cr  qi=11  OC_MODE_INTER_MV_FOUR*/
+      {
+           40,  264,  758, 1857, 3119, 4558, 5985, 7178,
+         8235, 9133,10110,10709,11655,12467,13190,14572
+      },
+      /*Cr  qi=11  OC_MODE_GOLDEN_NOMV*/
+      {
+          136,  275,  638, 1272, 2450, 3388, 4233, 4688,
+         4623, 5392, 5578, 5633, 6320, 6368, 6640, 6784
+      },
+      /*Cr  qi=11  OC_MODE_GOLDEN_MV*/
+      {
+           51,  279,  707, 1770, 2996, 4290, 5388, 5724,
+         5922, 5936, 6155, 6146, 6570, 6840, 7133, 7304
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=12  OC_MODE_INTRA*/
+      {
+          639,  929, 2209, 3638, 4750, 5865, 6943, 7921,
+         8870, 9737,10574,11281,12011,12796,13447,18159
+      },
+      /*Y'  qi=12  OC_MODE_INTER_NOMV*/
+      {
+          115,  158,  484, 1296, 2430, 4093, 5840, 7416,
+         8877,10230,11423,12631,13617,14874,15771,20116
+      },
+      /*Y'  qi=12  OC_MODE_INTER_MV*/
+      {
+          304,  368,  709, 1785, 3304, 4743, 6119, 7432,
+         8701, 9950,11131,12181,13147,14099,14928,18197
+      },
+      /*Y'  qi=12  OC_MDOE_INTER_MV_LAST*/
+      {
+          239,  286,  579, 1522, 2999, 4507, 5978, 7434,
+         8851,10169,11377,12426,13380,14289,15085,18421
+      },
+      /*Y'  qi=12  OC_MODE_INTER_MV_LAST2*/
+      {
+          265,  324,  633, 1599, 3082, 4600, 6044, 7449,
+         8808,10114,11271,12351,13274,14190,14984,18488
+      },
+      /*Y'  qi=12  OC_MODE_INTER_MV_FOUR*/
+      {
+          315,  365,  696, 1669, 3146, 4685, 6195, 7642,
+         9014,10313,11507,12514,13437,14268,15009,17771
+      },
+      /*Y'  qi=12  OC_MODE_GOLDEN_NOMV*/
+      {
+          324,  383, 1107, 2232, 3243, 4588, 5911, 7087,
+         8248, 9059, 9377, 9871,10916,12179,13513,18885
+      },
+      /*Y'  qi=12  OC_MODE_GOLDEN_MV*/
+      {
+          368,  419,  863, 1881, 3189, 4650, 6184, 7747,
+         9250,10620,11711,12801,13683,14462,15036,18301
+      }
+    },
+    {
+      /*Cb  qi=12  OC_MODE_INTRA*/
+      {
+          731, 2045, 3839, 5541, 7015, 8373, 9516,10570,
+        11796,13154,14124,15270,15980,16650,17728,21647
+      },
+      /*Cb  qi=12  OC_MODE_INTER_NOMV*/
+      {
+          109,  325, 1182, 2978, 5199, 7122, 8660,10054,
+        11083,14580,12600,13009,12892,12674,12186, 6210
+      },
+      /*Cb  qi=12  OC_MODE_INTER_MV*/
+      {
+           39,  547, 1729, 3675, 5946, 8682,10819,12640,
+        14064,14963,15087,15897,16347,18103,19644,20596
+      },
+      /*Cb  qi=12  OC_MDOE_INTER_MV_LAST*/
+      {
+           76,  504, 1783, 3477, 5479, 8369,10488,12015,
+        12987,13180,13226,13230,12260,12063,12157,11790
+      },
+      /*Cb  qi=12  OC_MODE_INTER_MV_LAST2*/
+      {
+           79,  533, 1857, 3497, 5550, 8317,10570,12371,
+        13621,14433,14818,14233,14476,18431,17887,16163
+      },
+      /*Cb  qi=12  OC_MODE_INTER_MV_FOUR*/
+      {
+           54,  554, 1811, 3544, 5489, 7910, 9927,11577,
+        12816,13795,15363,15520,16332,18049,18804,20224
+      },
+      /*Cb  qi=12  OC_MODE_GOLDEN_NOMV*/
+      {
+          171,  610, 1383, 2946, 4822, 6475, 6610, 7061,
+         7561, 8587, 8755, 9427, 9492, 9711, 9637,11734
+      },
+      /*Cb  qi=12  OC_MODE_GOLDEN_MV*/
+      {
+           56,  609, 1911, 3568, 5487, 7692, 8683, 9269,
+         9399, 9972, 9441, 9745, 9579, 9723,10227,11619
+      }
+    },
+    {
+      /*Cr  qi=12  OC_MODE_INTRA*/
+      {
+          525, 1688, 2993, 4214, 5301, 6380, 7354, 8309,
+         9237, 9931,10648,11575,12404,12958,13602,16716
+      },
+      /*Cr  qi=12  OC_MODE_INTER_NOMV*/
+      {
+           80,  166,  438, 1073, 2322, 4198, 5594, 5765,
+         5867, 6561, 7579, 7954, 9573, 8488, 8417, 6513
+      },
+      /*Cr  qi=12  OC_MODE_INTER_MV*/
+      {
+           33,  288,  826, 1872, 3136, 4829, 6471, 7702,
+         8412, 9640,10252,10588,11416,11416,11996,14060
+      },
+      /*Cr  qi=12  OC_MDOE_INTER_MV_LAST*/
+      {
+           65,  284,  747, 1885, 3268, 4907, 6492, 7637,
+         8333, 8485, 7889, 7514, 7409, 7549, 7443, 6548
+      },
+      /*Cr  qi=12  OC_MODE_INTER_MV_LAST2*/
+      {
+           64,  295,  794, 1931, 3266, 4821, 6442, 7481,
+         8139, 8441, 7925, 7504, 7445, 7529, 7249, 6060
+      },
+      /*Cr  qi=12  OC_MODE_INTER_MV_FOUR*/
+      {
+           46,  303,  845, 2057, 3422, 4968, 6400, 7585,
+         8693, 9470,10382,11354,11930,12255,13511,14946
+      },
+      /*Cr  qi=12  OC_MODE_GOLDEN_NOMV*/
+      {
+          144,  312,  775, 1364, 2823, 3992, 4396, 4874,
+         4744, 5534, 5779, 6006, 6358, 6475, 6920, 6974
+      },
+      /*Cr  qi=12  OC_MODE_GOLDEN_MV*/
+      {
+           55,  324,  810, 1955, 3306, 4686, 5572, 6063,
+         6126, 6314, 6418, 6359, 6581, 6856, 6891, 6586
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=13  OC_MODE_INTRA*/
+      {
+          658,  965, 2286, 3824, 4982, 6128, 7236, 8238,
+         9200,10080,10937,11647,12392,13183,13862,18635
+      },
+      /*Y'  qi=13  OC_MODE_INTER_NOMV*/
+      {
+          118,  164,  545, 1435, 2710, 4513, 6324, 7931,
+         9388,10719,11901,13114,14223,15447,16266,20612
+      },
+      /*Y'  qi=13  OC_MODE_INTER_MV*/
+      {
+          309,  380,  801, 2022, 3582, 5065, 6448, 7798,
+         9105,10376,11596,12648,13626,14562,15400,18647
+      },
+      /*Y'  qi=13  OC_MDOE_INTER_MV_LAST*/
+      {
+          247,  292,  641, 1718, 3303, 4868, 6380, 7884,
+         9323,10637,11855,12876,13876,14780,15565,18913
+      },
+      /*Y'  qi=13  OC_MODE_INTER_MV_LAST2*/
+      {
+          269,  335,  703, 1804, 3389, 4969, 6483, 7915,
+         9290,10578,11734,12775,13690,14583,15326,18867
+      },
+      /*Y'  qi=13  OC_MODE_INTER_MV_FOUR*/
+      {
+          317,  372,  767, 1866, 3447, 5050, 6616, 8094,
+         9499,10796,12002,13018,13919,14753,15519,18240
+      },
+      /*Y'  qi=13  OC_MODE_GOLDEN_NOMV*/
+      {
+          314,  388, 1240, 2536, 3502, 4963, 6334, 7515,
+         8781, 9343, 9864,10403,11026,12739,14132,19367
+      },
+      /*Y'  qi=13  OC_MODE_GOLDEN_MV*/
+      {
+          384,  417,  946, 2061, 3472, 5017, 6607, 8193,
+         9742,11070,12208,13246,14105,14894,15500,18763
+      }
+    },
+    {
+      /*Cb  qi=13  OC_MODE_INTRA*/
+      {
+          786, 2214, 4095, 5897, 7425, 8799, 9966,11023,
+        12297,13640,14695,15914,16556,17248,18420,22432
+      },
+      /*Cb  qi=13  OC_MODE_INTER_NOMV*/
+      {
+          120,  384, 1361, 3384, 5719, 7569, 9061,10623,
+        12296,14908,13198,14142,13391,14737,12933, 6557
+      },
+      /*Cb  qi=13  OC_MODE_INTER_MV*/
+      {
+           45,  618, 1942, 4096, 6410, 9330,11490,13258,
+        14751,15154,16673,17335,16730,20006,19651,21592
+      },
+      /*Cb  qi=13  OC_MDOE_INTER_MV_LAST*/
+      {
+           87,  578, 2055, 3865, 5987, 9014,11167,12630,
+        13573,13811,13693,13817,12973,12666,12497,12303
+      },
+      /*Cb  qi=13  OC_MODE_INTER_MV_LAST2*/
+      {
+           84,  613, 2129, 3891, 6181, 9131,11325,13367,
+        14479,15053,15737,15517,15957,18428,19719,16527
+      },
+      /*Cb  qi=13  OC_MODE_INTER_MV_FOUR*/
+      {
+           64,  632, 2057, 3919, 5988, 8481,10538,12280,
+        13544,14659,15741,16540,16843,18360,19647,21182
+      },
+      /*Cb  qi=13  OC_MODE_GOLDEN_NOMV*/
+      {
+          185,  675, 1563, 3257, 5030, 7012, 7185, 7539,
+         8068, 8797, 9317,10040, 9848,10218,10088,12294
+      },
+      /*Cb  qi=13  OC_MODE_GOLDEN_MV*/
+      {
+           69,  707, 2174, 3974, 5972, 8181, 9146, 9649,
+         9996,10059,10047,10171,10065,10347,10496,12237
+      }
+    },
+    {
+      /*Cr  qi=13  OC_MODE_INTRA*/
+      {
+          548, 1760, 3107, 4371, 5498, 6612, 7597, 8560,
+         9533,10214,10891,11832,12810,13295,13989,17158
+      },
+      /*Cr  qi=13  OC_MODE_INTER_NOMV*/
+      {
+           81,  178,  474, 1175, 2592, 4568, 5920, 6152,
+         6498, 7279, 7474, 8499, 9825, 8632, 7819, 7414
+      },
+      /*Cr  qi=13  OC_MODE_INTER_MV*/
+      {
+           36,  302,  877, 2024, 3402, 5231, 6934, 8192,
+         9049, 9975,10349,10683,10506,12455,12046,14688
+      },
+      /*Cr  qi=13  OC_MDOE_INTER_MV_LAST*/
+      {
+           72,  304,  805, 2071, 3578, 5296, 6858, 8031,
+         8610, 8648, 8080, 7655, 7926, 7493, 7781, 6750
+      },
+      /*Cr  qi=13  OC_MODE_INTER_MV_LAST2*/
+      {
+           67,  317,  858, 2114, 3453, 5140, 6805, 8078,
+         8720, 8826, 8271, 7999, 8461, 7057, 7802, 7046
+      },
+      /*Cr  qi=13  OC_MODE_INTER_MV_FOUR*/
+      {
+           51,  324,  908, 2226, 3696, 5287, 6729, 7942,
+         8941, 9924,11031,11903,12186,12886,14435,15105
+      },
+      /*Cr  qi=13  OC_MODE_GOLDEN_NOMV*/
+      {
+          140,  356,  841, 1491, 3000, 4251, 4547, 4992,
+         4873, 5683, 5870, 6295, 6204, 6743, 6798, 7308
+      },
+      /*Cr  qi=13  OC_MODE_GOLDEN_MV*/
+      {
+           63,  342,  876, 2112, 3528, 4999, 5826, 6275,
+         6229, 6613, 6460, 6686, 6867, 7195, 7202, 6850
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=14  OC_MODE_INTRA*/
+      {
+          679,  999, 2391, 4022, 5238, 6416, 7548, 8573,
+         9554,10468,11334,12043,12801,13610,14264,19184
+      },
+      /*Y'  qi=14  OC_MODE_INTER_NOMV*/
+      {
+          120,  173,  623, 1603, 3054, 5007, 6859, 8533,
+         9957,11292,12442,13731,14869,15985,16758,21428
+      },
+      /*Y'  qi=14  OC_MODE_INTER_MV*/
+      {
+          318,  391,  898, 2256, 3906, 5457, 6890, 8247,
+         9579,10879,12083,13125,14113,15070,15887,19180
+      },
+      /*Y'  qi=14  OC_MDOE_INTER_MV_LAST*/
+      {
+          254,  300,  723, 1939, 3634, 5257, 6809, 8326,
+         9783,11122,12340,13413,14368,15286,16052,19468
+      },
+      /*Y'  qi=14  OC_MODE_INTER_MV_LAST2*/
+      {
+          275,  345,  788, 2026, 3710, 5350, 6892, 8357,
+         9762,11084,12267,13331,14212,15061,15813,19320
+      },
+      /*Y'  qi=14  OC_MODE_INTER_MV_FOUR*/
+      {
+          323,  387,  862, 2101, 3782, 5454, 7059, 8555,
+         9973,11292,12464,13500,14408,15265,15999,18782
+      },
+      /*Y'  qi=14  OC_MODE_GOLDEN_NOMV*/
+      {
+          325,  426, 1297, 2591, 3805, 5292, 6805, 8023,
+         9204, 9683,10418,10891,11236,13195,14517,20007
+      },
+      /*Y'  qi=14  OC_MODE_GOLDEN_MV*/
+      {
+          378,  434, 1038, 2268, 3795, 5406, 7079, 8694,
+        10217,11592,12705,13715,14649,15285,15937,19341
+      }
+    },
+    {
+      /*Cb  qi=14  OC_MODE_INTRA*/
+      {
+          798, 2291, 4194, 6058, 7620, 9009,10198,11297,
+        12573,13977,15070,16332,16986,17651,18784,22905
+      },
+      /*Cb  qi=14  OC_MODE_INTER_NOMV*/
+      {
+          120,  397, 1444, 3606, 5928, 7655, 9462,10997,
+        12957,14257,13521,14736,14102,12819,15748, 6509
+      },
+      /*Cb  qi=14  OC_MODE_INTER_MV*/
+      {
+           46,  648, 2064, 4316, 6834, 9771,12006,13750,
+        15050,15892,16677,17526,20421,20352,20188,22002
+      },
+      /*Cb  qi=14  OC_MDOE_INTER_MV_LAST*/
+      {
+           89,  594, 2171, 4075, 6298, 9413,11588,13032,
+        13981,14263,14108,14096,13177,12857,12948,12791
+      },
+      /*Cb  qi=14  OC_MODE_INTER_MV_LAST2*/
+      {
+           95,  637, 2245, 4064, 6368, 9201,11389,13523,
+        14693,15668,16657,16987,17432,19451,18513,22443
+      },
+      /*Cb  qi=14  OC_MODE_INTER_MV_FOUR*/
+      {
+           68,  660, 2168, 4125, 6260, 8837,10931,12651,
+        14016,15114,16203,17097,17632,19932,19673,21908
+      },
+      /*Cb  qi=14  OC_MODE_GOLDEN_NOMV*/
+      {
+          193,  712, 1648, 3495, 5310, 7116, 7151, 7851,
+         8264, 9030, 9709,10201, 9960,10480,10406,12576
+      },
+      /*Cb  qi=14  OC_MODE_GOLDEN_MV*/
+      {
+           71,  729, 2309, 4184, 6264, 8479, 9524,10037,
+        10242,10419,10538,10403,10367,10745,10854,12763
+      }
+    },
+    {
+      /*Cr  qi=14  OC_MODE_INTRA*/
+      {
+          557, 1848, 3253, 4565, 5731, 6873, 7893, 8916,
+         9873,10559,11286,12203,13131,13648,14432,17707
+      },
+      /*Cr  qi=14  OC_MODE_INTER_NOMV*/
+      {
+           81,  188,  517, 1317, 3031, 4965, 5974, 6398,
+         6756, 8015, 7918,10043, 9928,10240, 9176, 7346
+      },
+      /*Cr  qi=14  OC_MODE_INTER_MV*/
+      {
+           38,  325,  974, 2227, 3724, 5641, 7262, 8614,
+         9465, 9981,11118,12323,12248,13367,12617,15090
+      },
+      /*Cr  qi=14  OC_MDOE_INTER_MV_LAST*/
+      {
+           73,  321,  877, 2285, 3879, 5694, 7240, 8450,
+         8917, 8990, 8296, 8043, 7723, 8083, 8074, 6930
+      },
+      /*Cr  qi=14  OC_MODE_INTER_MV_LAST2*/
+      {
+           75,  336,  943, 2364, 3808, 5499, 7055, 8316,
+         8876, 9258, 8802, 9769, 9488, 8801,10330,11839
+      },
+      /*Cr  qi=14  OC_MODE_INTER_MV_FOUR*/
+      {
+           55,  345, 1003, 2442, 4002, 5647, 7139, 8403,
+         9491,10247,11462,12301,12751,13977,14594,15385
+      },
+      /*Cr  qi=14  OC_MODE_GOLDEN_NOMV*/
+      {
+          146,  368,  894, 1753, 3288, 4511, 4978, 5029,
+         5261, 5892, 6285, 6428, 6496, 6907, 7152, 7412
+      },
+      /*Cr  qi=14  OC_MODE_GOLDEN_MV*/
+      {
+           66,  371,  954, 2349, 3856, 5289, 6158, 6456,
+         6404, 6912, 6574, 6947, 6641, 7822, 7124, 7003
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=15  OC_MODE_INTRA*/
+      {
+          710, 1055, 2510, 4247, 5522, 6740, 7904, 8951,
+         9950,10885,11773,12480,13259,14094,14730,19742
+      },
+      /*Y'  qi=15  OC_MODE_INTER_NOMV*/
+      {
+          125,  196,  754, 1840, 3471, 5550, 7450, 9148,
+        10571,11876,13097,14317,15585,16562,17085,23143
+      },
+      /*Y'  qi=15  OC_MODE_INTER_MV*/
+      {
+          331,  418, 1021, 2520, 4238, 5821, 7296, 8702,
+        10096,11419,12603,13633,14653,15595,16390,19727
+      },
+      /*Y'  qi=15  OC_MDOE_INTER_MV_LAST*/
+      {
+          259,  314,  830, 2210, 4012, 5696, 7296, 8862,
+        10344,11663,12861,13886,14870,15794,16550,20009
+      },
+      /*Y'  qi=15  OC_MODE_INTER_MV_LAST2*/
+      {
+          281,  368,  912, 2309, 4091, 5796, 7394, 8879,
+        10313,11616,12764,13780,14703,15535,16216,19778
+      },
+      /*Y'  qi=15  OC_MODE_INTER_MV_FOUR*/
+      {
+          333,  413,  980, 2366, 4155, 5899, 7556, 9099,
+        10524,11850,13015,14043,14951,15803,16520,19304
+      },
+      /*Y'  qi=15  OC_MODE_GOLDEN_NOMV*/
+      {
+          356,  482, 1401, 2777, 4193, 5707, 7247, 8533,
+         9513,10151,11018,11310,11914,14019,14827,20528
+      },
+      /*Y'  qi=15  OC_MODE_GOLDEN_MV*/
+      {
+          387,  461, 1171, 2544, 4175, 5846, 7571, 9239,
+        10800,12127,13286,14240,15097,15857,16453,19863
+      }
+    },
+    {
+      /*Cb  qi=15  OC_MODE_INTRA*/
+      {
+          847, 2475, 4442, 6407, 8007, 9410,10601,11729,
+        13043,14430,15566,16847,17562,18239,19470,23623
+      },
+      /*Cb  qi=15  OC_MODE_INTER_NOMV*/
+      {
+          132,  470, 1675, 4020, 6239, 7976, 9724,10533,
+        12365,14549,13173,14194,14417,14276,10166, 5841
+      },
+      /*Cb  qi=15  OC_MODE_INTER_MV*/
+      {
+           53,  741, 2298, 4730, 7293,10409,12556,14281,
+        15677,16745,17527,18924,18867,19749,21406,23108
+      },
+      /*Cb  qi=15  OC_MDOE_INTER_MV_LAST*/
+      {
+          103,  684, 2467, 4462, 6812, 9983,12104,13667,
+        14508,14733,14538,14771,13831,13150,13695,13269
+      },
+      /*Cb  qi=15  OC_MODE_INTER_MV_LAST2*/
+      {
+           96,  737, 2543, 4496, 7047,10172,12579,14406,
+        15461,16296,16982,17751,16705,18372,21377,18999
+      },
+      /*Cb  qi=15  OC_MODE_INTER_MV_FOUR*/
+      {
+           77,  754, 2439, 4504, 6722, 9367,11492,13285,
+        14507,15617,16864,17986,18453,18464,21086,22951
+      },
+      /*Cb  qi=15  OC_MODE_GOLDEN_NOMV*/
+      {
+          214,  798, 1884, 3787, 5863, 7487, 7686, 8149,
+         8789, 9533,10134,10777,10569,10862,10887,13090
+      },
+      /*Cb  qi=15  OC_MODE_GOLDEN_MV*/
+      {
+           85,  824, 2590, 4585, 6755, 9062, 9941,10311,
+        10600,11011,10713,11235,10589,11282,11257,13063
+      }
+    },
+    {
+      /*Cr  qi=15  OC_MODE_INTRA*/
+      {
+          580, 1957, 3431, 4793, 6003, 7165, 8212, 9278,
+        10270,10982,11701,12575,13644,14276,14887,18160
+      },
+      /*Cr  qi=15  OC_MODE_INTER_NOMV*/
+      {
+           87,  213,  592, 1510, 3380, 5327, 6194, 6477,
+         6389, 7235, 7633, 8675,10056,10345, 8704, 6301
+      },
+      /*Cr  qi=15  OC_MODE_INTER_MV*/
+      {
+           43,  358, 1068, 2440, 4080, 6048, 7794, 9019,
+         9825,10515,11770,11892,12805,14299,13933,15160
+      },
+      /*Cr  qi=15  OC_MDOE_INTER_MV_LAST*/
+      {
+           83,  351,  981, 2534, 4281, 6103, 7700, 8836,
+         9304, 9262, 8518, 8251, 7941, 8193, 8017, 7174
+      },
+      /*Cr  qi=15  OC_MODE_INTER_MV_LAST2*/
+      {
+           75,  370, 1053, 2554, 4040, 5926, 7569, 8789,
+         9360, 9358, 9223, 9139, 8817, 8369, 8116, 7704
+      },
+      /*Cr  qi=15  OC_MODE_INTER_MV_FOUR*/
+      {
+           61,  380, 1118, 2694, 4352, 6041, 7538, 8721,
+         9832,10791,11819,12768,13337,14262,15590,16166
+      },
+      /*Cr  qi=15  OC_MODE_GOLDEN_NOMV*/
+      {
+          148,  405,  978, 1821, 3639, 4852, 5152, 5242,
+         5464, 5680, 6473, 6644, 6554, 7214, 7435, 7635
+      },
+      /*Cr  qi=15  OC_MODE_GOLDEN_MV*/
+      {
+           76,  407, 1060, 2559, 4181, 5684, 6442, 6995,
+         6700, 7133, 6902, 7294, 7095, 7739, 7234, 7414
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=16  OC_MODE_INTRA*/
+      {
+          717, 1070, 2530, 4299, 5597, 6833, 8010, 9067,
+        10079,11025,11922,12625,13411,14250,14907,19948
+      },
+      /*Y'  qi=16  OC_MODE_INTER_NOMV*/
+      {
+          123,  195,  769, 1899, 3616, 5747, 7664, 9413,
+        10816,12119,13351,14565,15893,16743,17276,22994
+      },
+      /*Y'  qi=16  OC_MODE_INTER_MV*/
+      {
+          335,  425, 1059, 2613, 4361, 5970, 7466, 8884,
+        10295,11613,12812,13832,14871,15799,16574,19935
+      },
+      /*Y'  qi=16  OC_MDOE_INTER_MV_LAST*/
+      {
+          260,  317,  860, 2299, 4142, 5849, 7475, 9060,
+        10539,11871,13065,14094,15109,15992,16769,20226
+      },
+      /*Y'  qi=16  OC_MODE_INTER_MV_LAST2*/
+      {
+          279,  371,  939, 2392, 4205, 5936, 7551, 9079,
+        10509,11832,12978,13954,14939,15758,16421,20074
+      },
+      /*Y'  qi=16  OC_MODE_INTER_MV_FOUR*/
+      {
+          335,  417, 1009, 2445, 4272, 6052, 7725, 9275,
+        10700,12040,13207,14221,15151,15996,16739,19515
+      },
+      /*Y'  qi=16  OC_MODE_GOLDEN_NOMV*/
+      {
+          369,  509, 1470, 2868, 4294, 5851, 7416, 8652,
+         9643,10306,11206,11425,12120,14461,14998,20780
+      },
+      /*Y'  qi=16  OC_MODE_GOLDEN_MV*/
+      {
+          413,  474, 1210, 2630, 4296, 6008, 7758, 9432,
+        11002,12337,13457,14434,15356,15996,16667,20098
+      }
+    },
+    {
+      /*Cb  qi=16  OC_MODE_INTRA*/
+      {
+          875, 2528, 4520, 6502, 8120, 9536,10725,11865,
+        13162,14575,15729,17008,17782,18371,19646,23808
+      },
+      /*Cb  qi=16  OC_MODE_INTER_NOMV*/
+      {
+          134,  483, 1727, 4125, 6355, 8177, 9924,11407,
+        13572,14106,14639,13963,14121,14066,13880, 6350
+      },
+      /*Cb  qi=16  OC_MODE_INTER_MV*/
+      {
+           56,  764, 2369, 4836, 7427,10571,12697,14474,
+        15801,16876,17915,18829,18341,20368,21015,23192
+      },
+      /*Cb  qi=16  OC_MDOE_INTER_MV_LAST*/
+      {
+          110,  704, 2542, 4567, 6940,10114,12243,13756,
+        14603,14954,14730,14733,13657,13578,13545,13446
+      },
+      /*Cb  qi=16  OC_MODE_INTER_MV_LAST2*/
+      {
+          107,  757, 2619, 4570, 7139,10251,12679,14467,
+        15701,16753,16784,16102,18243,18707,21886,18943
+      },
+      /*Cb  qi=16  OC_MODE_INTER_MV_FOUR*/
+      {
+           83,  774, 2504, 4592, 6848, 9492,11666,13416,
+        14695,15768,16947,17894,18229,19603,20537,23049
+      },
+      /*Cb  qi=16  OC_MODE_GOLDEN_NOMV*/
+      {
+          232,  822, 1926, 3871, 6139, 7591, 7702, 8197,
+         8788, 9433,10331,10842,10530,10839,11016,13217
+      },
+      /*Cb  qi=16  OC_MODE_GOLDEN_MV*/
+      {
+           91,  849, 2664, 4694, 6893, 9229, 9997,10739,
+        10798,10796,11009,11383,10994,11296,11514,13301
+      }
+    },
+    {
+      /*Cr  qi=16  OC_MODE_INTRA*/
+      {
+          595, 1992, 3476, 4852, 6072, 7251, 8314, 9409,
+        10394,11081,11856,12726,13890,14453,15082,18367
+      },
+      /*Cr  qi=16  OC_MODE_INTER_NOMV*/
+      {
+           87,  218,  606, 1564, 3582, 5326, 6247, 6646,
+         7038, 7546, 9337, 8391,10629,11032, 8824, 6677
+      },
+      /*Cr  qi=16  OC_MODE_INTER_MV*/
+      {
+           44,  371, 1093, 2505, 4216, 6277, 7899, 9243,
+         9757,10923,11967,12371,12669,13293,13961,14683
+      },
+      /*Cr  qi=16  OC_MDOE_INTER_MV_LAST*/
+      {
+           85,  360, 1003, 2608, 4405, 6309, 7863, 9077,
+         9402, 9295, 8493, 8323, 8339, 8195, 8296, 7245
+      },
+      /*Cr  qi=16  OC_MODE_INTER_MV_LAST2*/
+      {
+           82,  384, 1092, 2632, 4182, 6206, 7781, 9056,
+         9383, 9619, 9200, 9006, 9125, 8290, 8526, 7320
+      },
+      /*Cr  qi=16  OC_MODE_INTER_MV_FOUR*/
+      {
+           64,  391, 1142, 2768, 4458, 6208, 7666, 8984,
+        10079,10905,12010,13222,13500,14437,15386,17279
+      },
+      /*Cr  qi=16  OC_MODE_GOLDEN_NOMV*/
+      {
+          158,  429, 1002, 1891, 3677, 4972, 5244, 5315,
+         5351, 5821, 6507, 6635, 6974, 6935, 7783, 7730
+      },
+      /*Cr  qi=16  OC_MODE_GOLDEN_MV*/
+      {
+           79,  417, 1087, 2639, 4252, 5618, 6622, 6732,
+         6983, 6883, 7093, 7084, 7326, 7586, 7831, 7416
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=17  OC_MODE_INTRA*/
+      {
+          742, 1117, 2656, 4534, 5900, 7175, 8383, 9454,
+        10492,11469,12390,13101,13902,14774,15382,20585
+      },
+      /*Y'  qi=17  OC_MODE_INTER_NOMV*/
+      {
+          125,  212,  879, 2147, 4096, 6339, 8325,10070,
+        11489,12742,14042,15246,16490,17348,17997,23592
+      },
+      /*Y'  qi=17  OC_MODE_INTER_MV*/
+      {
+          334,  454, 1190, 2916, 4766, 6446, 8016, 9478,
+        10884,12212,13394,14407,15458,16369,17156,20524
+      },
+      /*Y'  qi=17  OC_MDOE_INTER_MV_LAST*/
+      {
+          259,  334,  984, 2611, 4554, 6327, 7993, 9601,
+        11098,12460,13662,14709,15708,16590,17336,20925
+      },
+      /*Y'  qi=17  OC_MODE_INTER_MV_LAST2*/
+      {
+          284,  390, 1067, 2679, 4607, 6391, 8039, 9596,
+        11077,12399,13598,14627,15591,16464,17044,21039
+      },
+      /*Y'  qi=17  OC_MODE_INTER_MV_FOUR*/
+      {
+          340,  439, 1150, 2753, 4685, 6534, 8244, 9820,
+        11260,12619,13781,14802,15725,16561,17313,20161
+      },
+      /*Y'  qi=17  OC_MODE_GOLDEN_NOMV*/
+      {
+          377,  521, 1654, 3135, 4678, 6278, 7909, 9148,
+        10021,10863,11580,11828,12700,15108,15525,21453
+      },
+      /*Y'  qi=17  OC_MODE_GOLDEN_MV*/
+      {
+          402,  509, 1361, 2895, 4666, 6493, 8300,10008,
+        11558,12925,14046,15021,15906,16645,17277,20762
+      }
+    },
+    {
+      /*Cb  qi=17  OC_MODE_INTRA*/
+      {
+          925, 2734, 4812, 6913, 8585, 9994,11221,12377,
+        13693,15135,16302,17725,18425,19092,20425,24706
+      },
+      /*Cb  qi=17  OC_MODE_INTER_NOMV*/
+      {
+          143,  552, 1999, 4638, 6743, 8494,10488,12018,
+        14234,16214,14142,16149,14899,16360,15904, 6799
+      },
+      /*Cb  qi=17  OC_MODE_INTER_MV*/
+      {
+           62,  888, 2727, 5305, 8195,11399,13582,15420,
+        16709,17622,18465,18930,19995,21688,23192,24403
+      },
+      /*Cb  qi=17  OC_MDOE_INTER_MV_LAST*/
+      {
+          118,  788, 2864, 5014, 7545,10804,12907,14407,
+        15359,15558,15315,15238,14602,13862,14315,14106
+      },
+      /*Cb  qi=17  OC_MODE_INTER_MV_LAST2*/
+      {
+          133,  844, 2936, 4981, 7618,10776,12993,14846,
+        16218,16991,18190,17384,17444,22165,20686,21170
+      },
+      /*Cb  qi=17  OC_MODE_INTER_MV_FOUR*/
+      {
+           92,  869, 2820, 5035, 7412,10155,12368,14232,
+        15579,16694,17608,18446,19286,21298,22477,24178
+      },
+      /*Cb  qi=17  OC_MODE_GOLDEN_NOMV*/
+      {
+          245,  896, 2158, 4236, 6576, 7995, 8424, 8691,
+         9195,10064,10986,11355,11092,11771,11520,13798
+      },
+      /*Cb  qi=17  OC_MODE_GOLDEN_MV*/
+      {
+          100,  969, 3004, 5144, 7457, 9672,10670,11082,
+        11369,11583,11595,11847,11667,12096,11976,14029
+      }
+    },
+    {
+      /*Cr  qi=17  OC_MODE_INTRA*/
+      {
+          620, 2102, 3663, 5092, 6360, 7580, 8677, 9806,
+        10830,11490,12287,13209,14357,15068,15626,18989
+      },
+      /*Cr  qi=17  OC_MODE_INTER_NOMV*/
+      {
+           91,  243,  689, 1799, 4049, 5731, 6511, 7106,
+         6803, 7079, 8480, 9885,11454, 9849, 8769, 6980
+      },
+      /*Cr  qi=17  OC_MODE_INTER_MV*/
+      {
+           47,  413, 1229, 2805, 4577, 6696, 8452, 9688,
+        10283,11290,12283,13442,13295,12898,15390,16827
+      },
+      /*Cr  qi=17  OC_MDOE_INTER_MV_LAST*/
+      {
+           91,  392, 1112, 2885, 4791, 6804, 8387, 9538,
+         9818, 9571, 8794, 8467, 8485, 8255, 8678, 7523
+      },
+      /*Cr  qi=17  OC_MODE_INTER_MV_LAST2*/
+      {
+           98,  416, 1198, 2934, 4668, 6659, 8171, 9453,
+         9725, 9818, 9365, 9009, 8796, 8933, 8440, 8254
+      },
+      /*Cr  qi=17  OC_MODE_INTER_MV_FOUR*/
+      {
+           70,  426, 1275, 3053, 4852, 6667, 8136, 9450,
+        10568,11478,12610,13594,13959,14950,16534,16416
+      },
+      /*Cr  qi=17  OC_MODE_GOLDEN_NOMV*/
+      {
+          169,  457, 1109, 2151, 3895, 5170, 5608, 5546,
+         5662, 6023, 6786, 6965, 7165, 7243, 8080, 8040
+      },
+      /*Cr  qi=17  OC_MODE_GOLDEN_MV*/
+      {
+           88,  459, 1220, 2931, 4650, 6000, 6899, 6993,
+         7364, 7281, 7299, 7577, 7721, 7775, 7810, 7663
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=18  OC_MODE_INTRA*/
+      {
+          772, 1193, 2810, 4799, 6235, 7554, 8794, 9888,
+        10959,11963,12899,13617,14447,15340,15966,21266
+      },
+      /*Y'  qi=18  OC_MODE_INTER_NOMV*/
+      {
+          133,  248, 1048, 2471, 4636, 6986, 9022,10741,
+        12226,13360,14819,16008,17158,17828,18539,24557
+      },
+      /*Y'  qi=18  OC_MODE_INTER_MV*/
+      {
+          343,  484, 1369, 3230, 5159, 6914, 8525,10050,
+        11495,12804,14008,15067,16108,17014,17814,21335
+      },
+      /*Y'  qi=18  OC_MDOE_INTER_MV_LAST*/
+      {
+          259,  362, 1140, 2964, 5013, 6863, 8607,10263,
+        11748,13075,14270,15346,16368,17289,18034,21701
+      },
+      /*Y'  qi=18  OC_MODE_INTER_MV_LAST2*/
+      {
+          294,  425, 1247, 3030, 5068, 6957, 8677,10270,
+        11719,13006,14152,15169,16106,16850,17429,21113
+      },
+      /*Y'  qi=18  OC_MODE_INTER_MV_FOUR*/
+      {
+          351,  479, 1335, 3104, 5149, 7074, 8848,10457,
+        11916,13264,14441,15428,16401,17226,17980,20874
+      },
+      /*Y'  qi=18  OC_MODE_GOLDEN_NOMV*/
+      {
+          367,  665, 1821, 3441, 5122, 6868, 8499, 9691,
+        10485,11488,12251,12197,13766,15765,16066,22187
+      },
+      /*Y'  qi=18  OC_MODE_GOLDEN_MV*/
+      {
+          421,  574, 1544, 3210, 5143, 7042, 8907,10693,
+        12175,13589,14695,15653,16559,17256,17924,21485
+      }
+    },
+    {
+      /*Cb  qi=18  OC_MODE_INTRA*/
+      {
+         1005, 2959, 5117, 7328, 9066,10451,11682,12894,
+        14171,15681,16901,18286,19060,19770,21085,25523
+      },
+      /*Cb  qi=18  OC_MODE_INTER_NOMV*/
+      {
+          159,  647, 2306, 5141, 7102, 8799,11278,12618,
+        14572,14373,16939,14955,15770,15861,13793, 7075
+      },
+      /*Cb  qi=18  OC_MODE_INTER_MV*/
+      {
+           78,  979, 3024, 5767, 8668,11925,14191,15919,
+        17279,18558,19049,19697,20399,22552,23150,24172
+      },
+      /*Cb  qi=18  OC_MDOE_INTER_MV_LAST*/
+      {
+          143,  893, 3216, 5455, 8100,11394,13546,14990,
+        15881,16226,16048,16005,15262,14789,15026,14703
+      },
+      /*Cb  qi=18  OC_MODE_INTER_MV_LAST2*/
+      {
+          128,  976, 3280, 5493, 8330,11519,14006,15895,
+        17152,17680,18247,19808,18124,20903,20931,22658
+      },
+      /*Cb  qi=18  OC_MODE_INTER_MV_FOUR*/
+      {
+          110,  982, 3153, 5472, 7953,10805,12986,14862,
+        16243,17349,18710,18967,20385,21888,22696,24390
+      },
+      /*Cb  qi=18  OC_MODE_GOLDEN_NOMV*/
+      {
+          266, 1017, 2460, 4699, 7208, 8482, 9001, 9071,
+         9800,10872,11509,11920,11528,12183,11963,14327
+      },
+      /*Cb  qi=18  OC_MODE_GOLDEN_MV*/
+      {
+          122, 1094, 3340, 5597, 7982,10310,11093,11528,
+        11894,12162,11956,12213,12090,12363,12660,14505
+      }
+    },
+    {
+      /*Cr  qi=18  OC_MODE_INTRA*/
+      {
+          664, 2259, 3913, 5403, 6711, 7980, 9113,10262,
+        11334,12021,12836,13683,14841,15560,16297,19630
+      },
+      /*Cr  qi=18  OC_MODE_INTER_NOMV*/
+      {
+          103,  308,  841, 2110, 4545, 6204, 6939, 7915,
+         7808, 7902, 8305, 9168,10009,10383, 9237, 6932
+      },
+      /*Cr  qi=18  OC_MODE_INTER_MV*/
+      {
+           57,  486, 1391, 3145, 5169, 7333, 9084,10345,
+        11085,12560,13286,13442,13997,15635,15570,15470
+      },
+      /*Cr  qi=18  OC_MDOE_INTER_MV_LAST*/
+      {
+          106,  465, 1280, 3281, 5327, 7369, 8950,10072,
+        10233, 9995, 9242, 8878, 8871, 8616, 8840, 7744
+      },
+      /*Cr  qi=18  OC_MODE_INTER_MV_LAST2*/
+      {
+           95,  492, 1399, 3219, 5030, 7040, 8873,10163,
+        10271,10438, 9828, 9743,10424, 9601, 9739, 9941
+      },
+      /*Cr  qi=18  OC_MODE_INTER_MV_FOUR*/
+      {
+           79,  506, 1472, 3409, 5323, 7205, 8687,10032,
+        11039,12092,13571,13967,14509,15819,16888,18279
+      },
+      /*Cr  qi=18  OC_MODE_GOLDEN_NOMV*/
+      {
+          176,  571, 1288, 2442, 4260, 5285, 5676, 6107,
+         5896, 6465, 7050, 7262, 7544, 7776, 7894, 8370
+      },
+      /*Cr  qi=18  OC_MODE_GOLDEN_MV*/
+      {
+           96,  548, 1389, 3274, 5089, 6523, 7490, 7451,
+         7783, 7650, 7809, 7628, 8102, 8137, 8386, 8189
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=19  OC_MODE_INTRA*/
+      {
+          799, 1239, 2938, 5018, 6495, 7842, 9093,10198,
+        11285,12308,13255,13985,14814,15722,16368,21723
+      },
+      /*Y'  qi=19  OC_MODE_INTER_NOMV*/
+      {
+          136,  272, 1163, 2723, 5014, 7416, 9459,11126,
+        12573,13830,15203,16532,17485,18365,19143,25375
+      },
+      /*Y'  qi=19  OC_MODE_INTER_MV*/
+      {
+          344,  518, 1515, 3480, 5481, 7290, 8934,10434,
+        11895,13226,14411,15493,16522,17399,18207,21741
+      },
+      /*Y'  qi=19  OC_MDOE_INTER_MV_LAST*/
+      {
+          256,  388, 1283, 3256, 5352, 7224, 8985,10631,
+        12127,13469,14648,15691,16696,17556,18296,22092
+      },
+      /*Y'  qi=19  OC_MODE_INTER_MV_LAST2*/
+      {
+          290,  444, 1383, 3285, 5368, 7290, 9058,10624,
+        12045,13399,14572,15650,16656,17500,18258,22248
+      },
+      /*Y'  qi=19  OC_MODE_INTER_MV_FOUR*/
+      {
+          354,  506, 1490, 3376, 5479, 7430, 9223,10835,
+        12289,13652,14816,15844,16793,17622,18392,21334
+      },
+      /*Y'  qi=19  OC_MODE_GOLDEN_NOMV*/
+      {
+          365,  700, 1982, 3662, 5489, 7241, 8809,10035,
+        10919,11842,12502,12749,14079,15935,16438,22700
+      },
+      /*Y'  qi=19  OC_MODE_GOLDEN_MV*/
+      {
+          413,  587, 1667, 3425, 5464, 7406, 9264,11049,
+        12604,13963,15069,16007,16974,17656,18308,21937
+      }
+    },
+    {
+      /*Cb  qi=19  OC_MODE_INTRA*/
+      {
+         1045, 3108, 5323, 7593, 9379,10776,12008,13255,
+        14528,16024,17347,18789,19505,20317,21580,26079
+      },
+      /*Cb  qi=19  OC_MODE_INTER_NOMV*/
+      {
+          164,  695, 2524, 5487, 7512, 9148,11860,12498,
+        14334,16490,16915,16530,15549,15473,18212, 7299
+      },
+      /*Cb  qi=19  OC_MODE_INTER_MV*/
+      {
+           87, 1080, 3288, 6080, 9101,12495,14712,16503,
+        18006,18892,19851,19911,21216,23036,24689,25364
+      },
+      /*Cb  qi=19  OC_MDOE_INTER_MV_LAST*/
+      {
+          148,  960, 3436, 5790, 8543,11943,14075,15433,
+        16360,16550,16470,16186,15556,15556,15339,15257
+      },
+      /*Cb  qi=19  OC_MODE_INTER_MV_LAST2*/
+      {
+          174, 1032, 3552, 5719, 8426,11685,13998,15881,
+        17229,18490,18602,19140,20472,22679,22656,22874
+      },
+      /*Cb  qi=19  OC_MODE_INTER_MV_FOUR*/
+      {
+          122, 1055, 3382, 5777, 8345,11237,13387,15356,
+        16743,18120,19070,19687,21104,20928,23889,25790
+      },
+      /*Cb  qi=19  OC_MODE_GOLDEN_NOMV*/
+      {
+          290, 1063, 2652, 4925, 7788, 8856, 9257, 9329,
+        10151,11008,11707,12502,11870,12696,12132,14837
+      },
+      /*Cb  qi=19  OC_MODE_GOLDEN_MV*/
+      {
+          138, 1185, 3582, 5912, 8319,10886,11561,11806,
+        12146,12280,12261,12853,12514,12874,13293,15010
+      }
+    },
+    {
+      /*Cr  qi=19  OC_MODE_INTRA*/
+      {
+          680, 2298, 3972, 5486, 6829, 8133, 9296,10466,
+        11562,12216,13133,13938,15155,15832,16649,19960
+      },
+      /*Cr  qi=19  OC_MODE_INTER_NOMV*/
+      {
+          105,  320,  873, 2246, 4844, 6236, 6912, 8208,
+         8753, 8095, 9184, 9290, 9678, 9636,10059, 7456
+      },
+      /*Cr  qi=19  OC_MODE_INTER_MV*/
+      {
+           59,  515, 1478, 3311, 5359, 7585, 9280,10831,
+        11177,12145,13187,14162,14665,14573,14488,16463
+      },
+      /*Cr  qi=19  OC_MDOE_INTER_MV_LAST*/
+      {
+          107,  485, 1333, 3412, 5540, 7630, 9239,10340,
+        10455,10141, 9226, 9060, 8838, 8535, 8953, 7796
+      },
+      /*Cr  qi=19  OC_MODE_INTER_MV_LAST2*/
+      {
+          122,  512, 1438, 3507, 5478, 7504, 9104,10224,
+        10585,10307,10410, 9792,11089, 9178, 9127, 9354
+      },
+      /*Cr  qi=19  OC_MODE_INTER_MV_FOUR*/
+      {
+           85,  524, 1525, 3539, 5516, 7437, 8957,10279,
+        11392,12395,13425,14407,14863,15464,16745,17950
+      },
+      /*Cr  qi=19  OC_MODE_GOLDEN_NOMV*/
+      {
+          186,  587, 1304, 2666, 4610, 5534, 5808, 6283,
+         6114, 6642, 7135, 7329, 7798, 7944, 8162, 8639
+      },
+      /*Cr  qi=19  OC_MODE_GOLDEN_MV*/
+      {
+          108,  562, 1452, 3417, 5292, 6807, 7551, 7755,
+         7665, 7629, 7959, 7952, 8381, 8206, 8443, 8282
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=20  OC_MODE_INTRA*/
+      {
+          826, 1346, 3202, 5420, 6999, 8403, 9686,10820,
+        11946,13020,14000,14709,15574,16498,17109,22597
+      },
+      /*Y'  qi=20  OC_MODE_INTER_NOMV*/
+      {
+          139,  315, 1394, 3260, 5840, 8342,10353,12036,
+        13481,14869,16152,17377,18284,19235,19774,26401
+      },
+      /*Y'  qi=20  OC_MODE_INTER_MV*/
+      {
+          341,  572, 1827, 4010, 6131, 8022, 9707,11266,
+        12733,14079,15285,16367,17406,18331,19135,22815
+      },
+      /*Y'  qi=20  OC_MDOE_INTER_MV_LAST*/
+      {
+          260,  436, 1560, 3799, 6037, 8003, 9837,11502,
+        12994,14305,15482,16521,17510,18418,19160,23095
+      },
+      /*Y'  qi=20  OC_MODE_INTER_MV_LAST2*/
+      {
+          290,  485, 1673, 3788, 6032, 8089, 9910,11492,
+        12937,14227,15400,16530,17428,18356,19116,23324
+      },
+      /*Y'  qi=20  OC_MODE_INTER_MV_FOUR*/
+      {
+          354,  555, 1794, 3920, 6156, 8200,10036,11674,
+        13131,14499,15673,16725,17658,18496,19316,22275
+      },
+      /*Y'  qi=20  OC_MODE_GOLDEN_NOMV*/
+      {
+          381,  771, 2174, 4151, 6180, 7969, 9561,10671,
+        11778,12492,13199,13785,15426,16631,17062,23729
+      },
+      /*Y'  qi=20  OC_MODE_GOLDEN_MV*/
+      {
+          430,  676, 1936, 3922, 6133, 8178,10118,11913,
+        13455,14787,15948,16873,17837,18502,19169,22970
+      }
+    },
+    {
+      /*Cb  qi=20  OC_MODE_INTRA*/
+      {
+         1108, 3364, 5668, 8042, 9884,11295,12524,13814,
+        15120,16706,18004,19584,20253,21106,22346,26882
+      },
+      /*Cb  qi=20  OC_MODE_INTER_NOMV*/
+      {
+          179,  782, 2884, 5975, 7851, 9764,12258,12994,
+        17568,17087,17227,18018,16906,18271,17465, 7901
+      },
+      /*Cb  qi=20  OC_MODE_INTER_MV*/
+      {
+          103, 1203, 3663, 6635, 9767,13231,15478,17189,
+        18942,19555,20448,21608,22302,25504,25078,28354
+      },
+      /*Cb  qi=20  OC_MDOE_INTER_MV_LAST*/
+      {
+          165, 1072, 3825, 6305, 9221,12685,14834,16130,
+        16953,17275,17083,17106,16541,16178,16318,15943
+      },
+      /*Cb  qi=20  OC_MODE_INTER_MV_LAST2*/
+      {
+          206, 1150, 3944, 6198, 8991,12361,14807,16393,
+        18131,19005,19929,20150,21400,22741,22966,25862
+      },
+      /*Cb  qi=20  OC_MODE_INTER_MV_FOUR*/
+      {
+          144, 1164, 3745, 6277, 8930,11906,14150,16126,
+        17420,19042,20377,20595,21414,21968,26449,27536
+      },
+      /*Cb  qi=20  OC_MODE_GOLDEN_NOMV*/
+      {
+          312, 1194, 2968, 5589, 8357, 9200, 9873, 9927,
+        10805,11739,12315,13057,12634,13418,13007,15498
+      },
+      /*Cb  qi=20  OC_MODE_GOLDEN_MV*/
+      {
+          160, 1315, 3981, 6395, 8954,11242,12337,12489,
+        12909,12635,12800,13435,13003,13306,13824,15739
+      }
+    },
+    {
+      /*Cr  qi=20  OC_MODE_INTRA*/
+      {
+          714, 2480, 4270, 5851, 7233, 8567, 9777,10995,
+        12181,12866,13814,14694,15902,16581,17353,20735
+      },
+      /*Cr  qi=20  OC_MODE_INTER_NOMV*/
+      {
+          113,  379, 1054, 2633, 5368, 6552, 7323, 7835,
+         8494, 7871, 8718, 9999,11632,11207, 9371, 7624
+      },
+      /*Cr  qi=20  OC_MODE_INTER_MV*/
+      {
+           68,  586, 1685, 3735, 6009, 8241, 9926,11125,
+        11917,12597,13342,15116,15179,14870,16640,17964
+      },
+      /*Cr  qi=20  OC_MDOE_INTER_MV_LAST*/
+      {
+          117,  552, 1531, 3891, 6147, 8293, 9881,11028,
+        10985,10454, 9773, 9362, 9009, 9020, 9930, 8243
+      },
+      /*Cr  qi=20  OC_MODE_INTER_MV_LAST2*/
+      {
+          141,  583, 1653, 3969, 6006, 8159, 9632,10788,
+        11220,11200,11487,10835,11115,10424, 9968,10827
+      },
+      /*Cr  qi=20  OC_MODE_INTER_MV_FOUR*/
+      {
+           98,  598, 1761, 3977, 6090, 8053, 9633,10977,
+        12178,13027,14302,15075,16159,16777,17447,18884
+      },
+      /*Cr  qi=20  OC_MODE_GOLDEN_NOMV*/
+      {
+          190,  650, 1484, 3039, 5110, 5818, 6203, 6557,
+         6340, 6814, 7346, 7722, 7812, 8330, 8373, 9043
+      },
+      /*Cr  qi=20  OC_MODE_GOLDEN_MV*/
+      {
+          117,  650, 1667, 3854, 5819, 7230, 8097, 8109,
+         8180, 8190, 8193, 8440, 8470, 8717, 8920, 8775
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=21  OC_MODE_INTRA*/
+      {
+          832, 1352, 3212, 5467, 7066, 8491, 9788,10935,
+        12073,13153,14137,14860,15733,16655,17295,22807
+      },
+      /*Y'  qi=21  OC_MODE_INTER_NOMV*/
+      {
+          138,  318, 1421, 3378, 6027, 8551,10554,12241,
+        13714,15092,16320,17491,18394,19221,19905,27152
+      },
+      /*Y'  qi=21  OC_MODE_INTER_MV*/
+      {
+          339,  565, 1848, 4073, 6244, 8172, 9869,11439,
+        12913,14275,15463,16560,17602,18526,19342,23039
+      },
+      /*Y'  qi=21  OC_MDOE_INTER_MV_LAST*/
+      {
+          255,  437, 1605, 3905, 6179, 8165,10025,11692,
+        13173,14477,15638,16712,17674,18558,19310,23276
+      },
+      /*Y'  qi=21  OC_MODE_INTER_MV_LAST2*/
+      {
+          293,  493, 1677, 3850, 6174, 8322,10141,11685,
+        13102,14390,15571,16707,17682,18506,19335,23498
+      },
+      /*Y'  qi=21  OC_MODE_INTER_MV_FOUR*/
+      {
+          359,  565, 1834, 4016, 6300, 8377,10225,11881,
+        13320,14699,15859,16922,17866,18722,19507,22496
+      },
+      /*Y'  qi=21  OC_MODE_GOLDEN_NOMV*/
+      {
+          380,  783, 2183, 4215, 6315, 8150, 9656,10770,
+        11952,12853,13487,14032,15813,16917,17169,23932
+      },
+      /*Y'  qi=21  OC_MODE_GOLDEN_MV*/
+      {
+          427,  671, 1984, 4034, 6273, 8356,10302,12113,
+        13652,15012,16190,17054,18026,18711,19410,23171
+      }
+    },
+    {
+      /*Cb  qi=21  OC_MODE_INTRA*/
+      {
+         1164, 3538, 5889, 8311,10184,11578,12804,14085,
+        15424,17023,18349,19934,20615,21422,22725,27372
+      },
+      /*Cb  qi=21  OC_MODE_INTER_NOMV*/
+      {
+          190,  845, 3117, 6245, 8009, 9871,12618,13100,
+        16486,15773,17227,17207,18807,18512,17662, 7697
+      },
+      /*Cb  qi=21  OC_MODE_INTER_MV*/
+      {
+          125, 1267, 3897, 6899,10069,13502,15804,17667,
+        19452,19588,21005,21682,22662,25876,25580,28092
+      },
+      /*Cb  qi=21  OC_MDOE_INTER_MV_LAST*/
+      {
+          180, 1144, 4048, 6606, 9616,13044,15236,16536,
+        17486,17507,17489,17646,16933,16085,16219,16378
+      },
+      /*Cb  qi=21  OC_MODE_INTER_MV_LAST2*/
+      {
+          227, 1250, 4204, 6474, 9213,12598,14882,16576,
+        18393,19014,20203,19765,22140,25783,28198,24604
+      },
+      /*Cb  qi=21  OC_MODE_INTER_MV_FOUR*/
+      {
+          158, 1259, 3988, 6566, 9297,12283,14603,16415,
+        18031,19362,20417,21004,22355,22932,26220,27668
+      },
+      /*Cb  qi=21  OC_MODE_GOLDEN_NOMV*/
+      {
+          355, 1280, 3186, 6071, 8709, 9582,10224,10327,
+        10969,12058,12722,13485,12920,13410,13461,15949
+      },
+      /*Cb  qi=21  OC_MODE_GOLDEN_MV*/
+      {
+          181, 1422, 4220, 6691, 9324,11687,12680,12862,
+        12970,13060,13112,13294,13426,13649,14103,16128
+      }
+    },
+    {
+      /*Cr  qi=21  OC_MODE_INTRA*/
+      {
+          737, 2583, 4460, 6094, 7495, 8849,10084,11321,
+        12560,13226,14145,15042,16251,17044,17744,21268
+      },
+      /*Cr  qi=21  OC_MODE_INTER_NOMV*/
+      {
+          116,  407, 1166, 2895, 5596, 6950, 7739, 8365,
+         8667, 8380, 9345, 8799,12540, 9575,10352, 7498
+      },
+      /*Cr  qi=21  OC_MODE_INTER_MV*/
+      {
+           78,  621, 1844, 4052, 6436, 8659,10403,11580,
+        12287,13136,13809,14659,15957,14770,16590,17305
+      },
+      /*Cr  qi=21  OC_MDOE_INTER_MV_LAST*/
+      {
+          120,  591, 1675, 4188, 6498, 8684,10282,11364,
+        11284,10917,10061, 9486, 9571, 9562,10272, 8597
+      },
+      /*Cr  qi=21  OC_MODE_INTER_MV_LAST2*/
+      {
+          157,  635, 1765, 4264, 6452, 8518,10176,11436,
+        11647,11231,11627,10450,11507, 8604,11349,11265
+      },
+      /*Cr  qi=21  OC_MODE_INTER_MV_FOUR*/
+      {
+          103,  645, 1924, 4271, 6432, 8401,10006,11278,
+        12568,13539,14772,15868,16788,16866,18425,19876
+      },
+      /*Cr  qi=21  OC_MODE_GOLDEN_NOMV*/
+      {
+          198,  698, 1637, 3273, 5324, 5959, 6395, 6702,
+         6527, 7012, 7510, 7811, 8124, 8601, 8741, 9262
+      },
+      /*Cr  qi=21  OC_MODE_GOLDEN_MV*/
+      {
+          125,  698, 1813, 4149, 6106, 7736, 8392, 8460,
+         8361, 8209, 8369, 8606, 8859, 8988, 8844, 9002
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=22  OC_MODE_INTRA*/
+      {
+          879, 1494, 3451, 5782, 7442, 8895,10208,11362,
+        12523,13621,14625,15361,16229,17182,17820,23388
+      },
+      /*Y'  qi=22  OC_MODE_INTER_NOMV*/
+      {
+          152,  402, 1659, 3785, 6576, 9111,11091,12846,
+        14284,15623,16834,17994,18970,19671,20461,27884
+      },
+      /*Y'  qi=22  OC_MODE_INTER_MV*/
+      {
+          359,  649, 2125, 4462, 6685, 8659,10355,11955,
+        13451,14785,15978,17117,18141,19065,19916,23682
+      },
+      /*Y'  qi=22  OC_MDOE_INTER_MV_LAST*/
+      {
+          270,  505, 1844, 4284, 6634, 8675,10543,12201,
+        13679,14996,16166,17255,18215,19124,19905,24001
+      },
+      /*Y'  qi=22  OC_MODE_INTER_MV_LAST2*/
+      {
+          301,  562, 1951, 4238, 6639, 8825,10643,12197,
+        13605,14959,16101,17250,18218,19190,19928,24240
+      },
+      /*Y'  qi=22  OC_MODE_INTER_MV_FOUR*/
+      {
+          378,  645, 2097, 4408, 6763, 8872,10723,12389,
+        13843,15216,16407,17461,18386,19270,20075,23104
+      },
+      /*Y'  qi=22  OC_MODE_GOLDEN_NOMV*/
+      {
+          391,  813, 2436, 4607, 6808, 8750,10176,11165,
+        12658,13421,14145,14785,15999,17211,17884,24609
+      },
+      /*Y'  qi=22  OC_MODE_GOLDEN_MV*/
+      {
+          449,  750, 2227, 4398, 6728, 8834,10808,12609,
+        14158,15501,16697,17639,18545,19265,19916,23855
+      }
+    },
+    {
+      /*Cb  qi=22  OC_MODE_INTRA*/
+      {
+         1192, 3642, 6050, 8517,10419,11804,13039,14330,
+        15702,17298,18668,20161,20985,21790,23130,27772
+      },
+      /*Cb  qi=22  OC_MODE_INTER_NOMV*/
+      {
+          198,  893, 3297, 6476, 8195,10297,12639,14214,
+        19547,19351,17234,18259,18475,20676,18444, 8103
+      },
+      /*Cb  qi=22  OC_MODE_INTER_MV*/
+      {
+          131, 1339, 4085, 7190,10474,13967,16297,18132,
+        19774,21165,21454,22011,22598,22784,25913,27175
+      },
+      /*Cb  qi=22  OC_MDOE_INTER_MV_LAST*/
+      {
+          195, 1196, 4244, 6861, 9923,13403,15606,16933,
+        17711,17907,17889,18071,16911,16679,16630,16722
+      },
+      /*Cb  qi=22  OC_MODE_INTER_MV_LAST2*/
+      {
+          240, 1278, 4379, 6741, 9575,12974,15457,16924,
+        18510,19687,20166,20711,21671,23384,22366,25799
+      },
+      /*Cb  qi=22  OC_MODE_INTER_MV_FOUR*/
+      {
+          171, 1305, 4153, 6818, 9582,12602,14939,16851,
+        18290,19514,21363,21404,23235,23273,27653,26386
+      },
+      /*Cb  qi=22  OC_MODE_GOLDEN_NOMV*/
+      {
+          353, 1344, 3388, 6224, 8683, 9618,10458,10357,
+        11402,12384,13127,13573,13146,13838,13685,16122
+      },
+      /*Cb  qi=22  OC_MODE_GOLDEN_MV*/
+      {
+          191, 1479, 4408, 6967, 9599,12187,12777,13247,
+        13127,13516,13808,13602,13882,14017,14375,16386
+      }
+    },
+    {
+      /*Cr  qi=22  OC_MODE_INTRA*/
+      {
+          781, 2648, 4544, 6197, 7617, 8998,10242,11508,
+        12771,13430,14370,15273,16517,17266,17933,21537
+      },
+      /*Cr  qi=22  OC_MODE_INTER_NOMV*/
+      {
+          128,  453, 1243, 3018, 5728, 6983, 8065, 8250,
+         8429, 8298, 8600, 9075,11365,11568,11285, 7813
+      },
+      /*Cr  qi=22  OC_MODE_INTER_MV*/
+      {
+           82,  670, 1906, 4177, 6601, 8861,10600,11635,
+        12620,13660,14745,14921,16260,16197,16452,17853
+      },
+      /*Cr  qi=22  OC_MDOE_INTER_MV_LAST*/
+      {
+          134,  635, 1726, 4340, 6710, 8894,10460,11577,
+        11468,10978,10121, 9709, 9342, 9614,10556, 8437
+      },
+      /*Cr  qi=22  OC_MODE_INTER_MV_LAST2*/
+      {
+          166,  676, 1864, 4380, 6562, 8572,10323,11366,
+        11760,11585,12162,11313,11545, 9542,11669,11550
+      },
+      /*Cr  qi=22  OC_MODE_INTER_MV_FOUR*/
+      {
+          113,  693, 2007, 4400, 6614, 8623,10244,11560,
+        12736,13873,15137,16377,17386,18283,18726,20161
+      },
+      /*Cr  qi=22  OC_MODE_GOLDEN_NOMV*/
+      {
+          205,  764, 1703, 3465, 5259, 6170, 6653, 6770,
+         6883, 7260, 7984, 8018, 8342, 8634, 8831, 9526
+      },
+      /*Cr  qi=22  OC_MODE_GOLDEN_MV*/
+      {
+          130,  739, 1885, 4288, 6224, 7811, 8611, 8314,
+         8624, 8439, 8476, 8857, 9171, 8775, 8959, 9175
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=23  OC_MODE_INTRA*/
+      {
+          916, 1648, 3771, 6208, 7945, 9436,10786,11943,
+        13144,14287,15301,16031,16941,17907,18606,24258
+      },
+      /*Y'  qi=23  OC_MODE_INTER_NOMV*/
+      {
+          156,  482, 1973, 4425, 7428, 9952,11912,13603,
+        15139,16469,17523,18863,19816,20530,21395,28515
+      },
+      /*Y'  qi=23  OC_MODE_INTER_MV*/
+      {
+          365,  777, 2523, 5037, 7370, 9387,11109,12715,
+        14250,15594,16799,17939,18988,19920,20793,24676
+      },
+      /*Y'  qi=23  OC_MDOE_INTER_MV_LAST*/
+      {
+          267,  575, 2215, 4868, 7331, 9445,11325,12981,
+        14458,15783,16962,18050,19050,19960,20783,24966
+      },
+      /*Y'  qi=23  OC_MODE_INTER_MV_LAST2*/
+      {
+          300,  646, 2307, 4813, 7362, 9598,11415,12948,
+        14373,15722,16877,18009,18920,19892,20659,25139
+      },
+      /*Y'  qi=23  OC_MODE_INTER_MV_FOUR*/
+      {
+          382,  728, 2461, 4970, 7427, 9604,11469,13120,
+        14577,15920,17163,18225,19175,20089,20917,24003
+      },
+      /*Y'  qi=23  OC_MODE_GOLDEN_NOMV*/
+      {
+          383,  871, 2719, 5163, 7490, 9481,10691,11940,
+        13266,14098,15082,16227,16927,17832,18481,25523
+      },
+      /*Y'  qi=23  OC_MODE_GOLDEN_MV*/
+      {
+          435,  842, 2530, 4941, 7415, 9582,11593,13414,
+        14988,16302,17449,18458,19425,20089,20819,24768
+      }
+    },
+    {
+      /*Cb  qi=23  OC_MODE_INTRA*/
+      {
+         1262, 3995, 6517, 9074,11067,12444,13690,15008,
+        16470,18016,19385,21086,21768,22822,23951,28726
+      },
+      /*Cb  qi=23  OC_MODE_INTER_NOMV*/
+      {
+          227, 1022, 3792, 7082, 8790,10912,13470,15105,
+        17338,17380,19046,17676,21909,20672,20108, 9649
+      },
+      /*Cb  qi=23  OC_MODE_INTER_MV*/
+      {
+          158, 1526, 4633, 7872,11187,14697,17084,19001,
+        20547,22010,22425,23034,24591,25610,26706,30113
+      },
+      /*Cb  qi=23  OC_MDOE_INTER_MV_LAST*/
+      {
+          222, 1350, 4763, 7548,10780,14328,16428,17701,
+        18490,18462,18727,18797,17682,17413,17587,17564
+      },
+      /*Cb  qi=23  OC_MODE_INTER_MV_LAST2*/
+      {
+          273, 1450, 4909, 7407,10384,13693,16444,18130,
+        19888,21095,21715,21966,25170,25525,26252,26123
+      },
+      /*Cb  qi=23  OC_MODE_INTER_MV_FOUR*/
+      {
+          207, 1465, 4649, 7461,10353,13448,15802,17914,
+        19215,20849,21876,22297,24443,24801,26495,28669
+      },
+      /*Cb  qi=23  OC_MODE_GOLDEN_NOMV*/
+      {
+          393, 1508, 3891, 6634, 9473,10147,11021,11105,
+        11994,13226,13810,14393,14232,14684,14309,17107
+      },
+      /*Cb  qi=23  OC_MODE_GOLDEN_MV*/
+      {
+          226, 1661, 4931, 7602,10373,12826,13392,14015,
+        14186,14099,14257,14465,14639,14933,15201,17335
+      }
+    },
+    {
+      /*Cr  qi=23  OC_MODE_INTRA*/
+      {
+          807, 2826, 4840, 6563, 8036, 9452,10785,12081,
+        13396,14085,14966,15870,17087,18011,18676,22323
+      },
+      /*Cr  qi=23  OC_MODE_INTER_NOMV*/
+      {
+          137,  510, 1451, 3583, 6310, 7660, 8871, 9369,
+         9292, 8871, 9858, 9930,12408,10753,12069, 9619
+      },
+      /*Cr  qi=23  OC_MODE_INTER_MV*/
+      {
+           87,  756, 2203, 4726, 7327, 9551,11211,12390,
+        12862,13551,14920,14994,18269,17077,16480,18466
+      },
+      /*Cr  qi=23  OC_MDOE_INTER_MV_LAST*/
+      {
+          141,  711, 1960, 4855, 7411, 9632,11160,12191,
+        11937,11445,10672, 9870,10044,10075,10088, 8973
+      },
+      /*Cr  qi=23  OC_MODE_INTER_MV_LAST2*/
+      {
+          180,  765, 2112, 4839, 7272, 9485,11108,12166,
+        12354,11972,12321,10789,11730,11851,12477,12672
+      },
+      /*Cr  qi=23  OC_MODE_INTER_MV_FOUR*/
+      {
+          130,  771, 2271, 4878, 7227, 9287,10940,12285,
+        13489,14558,15968,16519,17502,19044,19067,20788
+      },
+      /*Cr  qi=23  OC_MODE_GOLDEN_NOMV*/
+      {
+          211,  854, 1878, 3762, 5715, 6439, 6939, 7272,
+         7256, 7595, 8396, 8547, 8793, 8929, 9660, 9849
+      },
+      /*Cr  qi=23  OC_MODE_GOLDEN_MV*/
+      {
+          138,  829, 2146, 4797, 6788, 8388, 8961, 9034,
+         8928, 9049, 9055, 9338, 9400, 9302, 9253, 9584
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=24  OC_MODE_INTRA*/
+      {
+          925, 1659, 3781, 6234, 7979, 9478,10827,11984,
+        13196,14345,15358,16088,16990,17953,18682,24311
+      },
+      /*Y'  qi=24  OC_MODE_INTER_NOMV*/
+      {
+          154,  481, 1989, 4482, 7498,10016,11962,13685,
+        15232,16509,17649,18887,19723,20618,21484,28686
+      },
+      /*Y'  qi=24  OC_MODE_INTER_MV*/
+      {
+          369,  779, 2565, 5096, 7415, 9414,11160,12793,
+        14313,15654,16877,18000,19024,19968,20825,24748
+      },
+      /*Y'  qi=24  OC_MDOE_INTER_MV_LAST*/
+      {
+          266,  600, 2245, 4918, 7392, 9509,11388,13042,
+        14529,15853,17055,18129,19108,20053,20872,25036
+      },
+      /*Y'  qi=24  OC_MODE_INTER_MV_LAST2*/
+      {
+          300,  649, 2331, 4868, 7422, 9658,11453,12987,
+        14433,15754,16952,18069,19005,19776,20672,25197
+      },
+      /*Y'  qi=24  OC_MODE_INTER_MV_FOUR*/
+      {
+          383,  736, 2485, 5014, 7482, 9665,11520,13165,
+        14624,15965,17212,18267,19234,20137,20956,24079
+      },
+      /*Y'  qi=24  OC_MODE_GOLDEN_NOMV*/
+      {
+          388,  900, 2740, 5208, 7544, 9524,10697,12006,
+        13240,14289,15212,16465,17042,17835,18463,25589
+      },
+      /*Y'  qi=24  OC_MODE_GOLDEN_MV*/
+      {
+          441,  856, 2564, 4999, 7463, 9661,11681,13489,
+        15010,16407,17514,18524,19423,20160,20852,24829
+      }
+    },
+    {
+      /*Cb  qi=24  OC_MODE_INTRA*/
+      {
+         1326, 4124, 6699, 9285,11285,12642,13877,15209,
+        16703,18225,19650,21316,22089,23092,24251,29098
+      },
+      /*Cb  qi=24  OC_MODE_INTER_NOMV*/
+      {
+          238, 1085, 3985, 7297, 9037,11027,13527,14819,
+        18605,20637,21479,17006,19967,22144,20165, 9407
+      },
+      /*Cb  qi=24  OC_MODE_INTER_MV*/
+      {
+          175, 1599, 4875, 8104,11378,14879,17227,19181,
+        20975,22072,22521,23249,25771,24770,27741,31130
+      },
+      /*Cb  qi=24  OC_MDOE_INTER_MV_LAST*/
+      {
+          239, 1440, 4958, 7781,11033,14588,16710,17782,
+        18971,18729,19192,19136,18264,17614,17965,17907
+      },
+      /*Cb  qi=24  OC_MODE_INTER_MV_LAST2*/
+      {
+          297, 1545, 5102, 7624,10595,14003,16491,18495,
+        20200,21250,21195,22919,24174,24981,27546,26388
+      },
+      /*Cb  qi=24  OC_MODE_INTER_MV_FOUR*/
+      {
+          225, 1548, 4841, 7678,10602,13740,16169,18097,
+        19555,21049,22294,23345,24447,24158,28239,29073
+      },
+      /*Cb  qi=24  OC_MODE_GOLDEN_NOMV*/
+      {
+          412, 1574, 4056, 6817, 9862,10542,11442,11190,
+        12430,13298,13998,14689,14259,14915,14706,17386
+      },
+      /*Cb  qi=24  OC_MODE_GOLDEN_MV*/
+      {
+          249, 1765, 5120, 7805,10509,12978,13750,14139,
+        14218,14561,14343,14854,14945,15137,15465,17690
+      }
+    },
+    {
+      /*Cr  qi=24  OC_MODE_INTRA*/
+      {
+          854, 2906, 4937, 6669, 8151, 9573,10896,12205,
+        13504,14218,15067,16026,17218,18125,18839,22443
+      },
+      /*Cr  qi=24  OC_MODE_INTER_NOMV*/
+      {
+          140,  529, 1505, 3686, 6360, 7687, 8769, 8678,
+         8934, 8156, 9306,10385,10890,10996,12755, 8948
+      },
+      /*Cr  qi=24  OC_MODE_INTER_MV*/
+      {
+           97,  787, 2299, 4871, 7455, 9713,11277,12289,
+        13022,14286,14557,15484,17137,18756,17715,20175
+      },
+      /*Cr  qi=24  OC_MDOE_INTER_MV_LAST*/
+      {
+          153,  740, 2039, 4942, 7534, 9762,11345,12192,
+        12106,11510,10813, 9636,10196,10190,10228, 9195
+      },
+      /*Cr  qi=24  OC_MODE_INTER_MV_LAST2*/
+      {
+          194,  804, 2184, 4946, 7377, 9579,11451,12293,
+        12252,12295,12048,12679,12847,12288,13791,12703
+      },
+      /*Cr  qi=24  OC_MODE_INTER_MV_FOUR*/
+      {
+          142,  806, 2360, 4983, 7365, 9400,11112,12422,
+        13547,14752,16200,16996,18016,18588,18964,22103
+      },
+      /*Cr  qi=24  OC_MODE_GOLDEN_NOMV*/
+      {
+          224,  895, 1957, 3830, 5807, 6593, 7090, 7207,
+         7424, 7696, 8421, 8509, 8817, 9023, 9359, 9893
+      },
+      /*Cr  qi=24  OC_MODE_GOLDEN_MV*/
+      {
+          154,  878, 2240, 4903, 6815, 8412, 9279, 8888,
+         9040, 8955, 9227, 9033, 9233, 9253, 9232, 9567
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=25  OC_MODE_INTRA*/
+      {
+          963, 1877, 4170, 6710, 8531,10066,11444,12602,
+        13856,15046,16073,16795,17731,18715,19470,25206
+      },
+      /*Y'  qi=25  OC_MODE_INTER_NOMV*/
+      {
+          158,  581, 2377, 5216, 8377,10847,12780,14487,
+        15977,17336,18528,19672,20734,21509,22403,29163
+      },
+      /*Y'  qi=25  OC_MODE_INTER_MV*/
+      {
+          354,  906, 2832, 5486, 8125,10286,12074,13632,
+        15098,16460,17750,18893,19838,20827,21788,25948
+      },
+      /*Y'  qi=25  OC_MDOE_INTER_MV_LAST*/
+      {
+          261,  707, 2692, 5569, 8145,10279,12146,13825,
+        15310,16649,17906,19010,20016,20982,21859,26007
+      },
+      /*Y'  qi=25  OC_MODE_INTER_MV_LAST2*/
+      {
+          292,  775, 2783, 5542, 8169,10357,12179,13772,
+        15241,16616,17857,18942,19987,20865,21769,26111
+      },
+      /*Y'  qi=25  OC_MODE_INTER_MV_FOUR*/
+      {
+          383,  842, 2926, 5670, 8207,10383,12241,13859,
+        15346,16690,17928,19018,20024,20952,21851,25087
+      },
+      /*Y'  qi=25  OC_MODE_GOLDEN_NOMV*/
+      {
+          394, 1061, 3165, 5849, 8243,10121,11349,12649,
+        13877,14927,15973,17191,17802,18348,19377,26510
+      },
+      /*Y'  qi=25  OC_MODE_GOLDEN_MV*/
+      {
+          448,  976, 2952, 5609, 8205,10448,12492,14276,
+        15808,17181,18331,19326,20282,21036,21793,25809
+      }
+    },
+    {
+      /*Cb  qi=25  OC_MODE_INTRA*/
+      {
+         1404, 4461, 7141, 9818,11908,13289,14525,15921,
+        17497,19096,20487,22219,23012,24140,25167,30177
+      },
+      /*Cb  qi=25  OC_MODE_INTER_NOMV*/
+      {
+          253, 1210, 4481, 7896, 9722,11954,14933,15636,
+        22272,19058,20018,19333,21440,24549,19414,11606
+      },
+      /*Cb  qi=25  OC_MODE_INTER_MV*/
+      {
+          308, 2183, 5637, 8349,11556,14800,17119,18967,
+        21053,21802,22667,23629,26332,24444,27675,30190
+      },
+      /*Cb  qi=25  OC_MDOE_INTER_MV_LAST*/
+      {
+          252, 1624, 5548, 8487,11823,15401,17400,18457,
+        19541,19530,19639,19357,18990,18223,18480,18672
+      },
+      /*Cb  qi=25  OC_MODE_INTER_MV_LAST2*/
+      {
+          294, 1689, 5596, 8409,11721,15153,17718,19706,
+        20954,22461,25656,24975,25295,28032,26898,29577
+      },
+      /*Cb  qi=25  OC_MODE_INTER_MV_FOUR*/
+      {
+          243, 1686, 5306, 8410,11481,14762,17160,19127,
+        20504,22072,23403,23936,25231,26217,30722,31060
+      },
+      /*Cb  qi=25  OC_MODE_GOLDEN_NOMV*/
+      {
+          459, 1728, 4508, 7295,10509,11326,12027,11945,
+        13262,13950,14535,15670,15156,15757,15342,18241
+      },
+      /*Cb  qi=25  OC_MODE_GOLDEN_MV*/
+      {
+          267, 1957, 5658, 8501,11297,13659,14578,14653,
+        14902,15207,14974,16046,15557,16177,16364,18469
+      }
+    },
+    {
+      /*Cr  qi=25  OC_MODE_INTRA*/
+      {
+          911, 3115, 5286, 7089, 8634,10086,11490,12849,
+        14184,14936,15764,16826,18108,18958,19641,23323
+      },
+      /*Cr  qi=25  OC_MODE_INTER_NOMV*/
+      {
+          144,  593, 1805, 4359, 7002, 8352, 9370,10684,
+        10398, 8849, 9175,11421,11651,12592,12223, 9732
+      },
+      /*Cr  qi=25  OC_MODE_INTER_MV*/
+      {
+          185,  941, 2737, 5594, 8094,10219,11868,12926,
+        13854,14567,15303,16914,18354,19943,19749,22938
+      },
+      /*Cr  qi=25  OC_MDOE_INTER_MV_LAST*/
+      {
+          161,  852, 2398, 5561, 8349,10562,12105,12841,
+        12707,11883,11274,10426,10302,10611,11157, 9541
+      },
+      /*Cr  qi=25  OC_MODE_INTER_MV_LAST2*/
+      {
+          186,  886, 2521, 5575, 8200,10427,11912,12857,
+        13256,12301,12533,13018,12412,13235,13423,13367
+      },
+      /*Cr  qi=25  OC_MODE_INTER_MV_FOUR*/
+      {
+          152,  917, 2741, 5556, 8071,10155,11775,13176,
+        14585,15677,17045,17651,18442,20112,20461,21667
+      },
+      /*Cr  qi=25  OC_MODE_GOLDEN_NOMV*/
+      {
+          251,  979, 2175, 4587, 6224, 6993, 7590, 7465,
+         7957, 8166, 8830, 8961, 9365, 9431, 9871,10171
+      },
+      /*Cr  qi=25  OC_MODE_GOLDEN_MV*/
+      {
+          175, 1006, 2593, 5447, 7460, 9017, 9737, 9342,
+         9620, 9282, 9642, 9586, 9850, 9845, 9759,10073
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=26  OC_MODE_INTRA*/
+      {
+          969, 1886, 4210, 6763, 8608,10162,11549,12721,
+        13989,15197,16233,16967,17906,18902,19676,25632
+      },
+      /*Y'  qi=26  OC_MODE_INTER_NOMV*/
+      {
+          168,  646, 2460, 5394, 8602,11051,12999,14790,
+        16265,17533,18729,19753,20568,21243,22033,27751
+      },
+      /*Y'  qi=26  OC_MODE_INTER_MV*/
+      {
+          385,  948, 2934, 5689, 8287,10454,12210,13787,
+        15286,16643,17898,19047,20071,21051,21986,26224
+      },
+      /*Y'  qi=26  OC_MDOE_INTER_MV_LAST*/
+      {
+          226,  697, 2721, 5704, 8330,10480,12356,14027,
+        15529,16891,18118,19190,20203,21144,22029,25814
+      },
+      /*Y'  qi=26  OC_MODE_INTER_MV_LAST2*/
+      {
+          272,  796, 2829, 5626, 8333,10619,12487,14021,
+        15432,16772,18058,19204,20244,21305,22120,26780
+      },
+      /*Y'  qi=26  OC_MODE_INTER_MV_FOUR*/
+      {
+          394,  879, 2999, 5802, 8394,10603,12506,14146,
+        15619,17004,18238,19330,20346,21284,22170,25523
+      },
+      /*Y'  qi=26  OC_MODE_GOLDEN_NOMV*/
+      {
+          403, 1071, 3131, 5987, 8393,10293,11504,12911,
+        14126,15106,15976,17316,17912,18499,19403,27092
+      },
+      /*Y'  qi=26  OC_MODE_GOLDEN_MV*/
+      {
+          449, 1005, 3017, 5721, 8372,10660,12714,14497,
+        16058,17422,18586,19545,20482,21323,22053,26411
+      }
+    },
+    {
+      /*Cb  qi=26  OC_MODE_INTRA*/
+      {
+         1485, 4776, 7553,10293,12424,13818,15031,16479,
+        18080,19719,21109,22942,23798,24886,25968,30987
+      },
+      /*Cb  qi=26  OC_MODE_INTER_NOMV*/
+      {
+          295, 1367, 4939, 8508,10598,13501,15519,15755,
+        16825,17198,17562,17930,18107,18120,18221,18816
+      },
+      /*Cb  qi=26  OC_MODE_INTER_MV*/
+      {
+          282, 2128, 5945, 9132,12780,16230,18561,20345,
+        21906,23145,24325,25481,26333,28054,29258,31492
+      },
+      /*Cb  qi=26  OC_MDOE_INTER_MV_LAST*/
+      {
+          290, 1759, 6016, 8969,12225,15835,18144,19800,
+        21353,22582,23857,24489,23848,28160,24989,26860
+      },
+      /*Cb  qi=26  OC_MODE_INTER_MV_LAST2*/
+      {
+          371, 1874, 6050, 8804,12255,15613,17976,19944,
+        21569,23069,23534,23337,26953,27461,27673,31600
+      },
+      /*Cb  qi=26  OC_MODE_INTER_MV_FOUR*/
+      {
+          290, 1865, 5753, 8901,12015,15156,17585,19632,
+        21189,22967,23970,24890,26253,28234,28848,31823
+      },
+      /*Cb  qi=26  OC_MODE_GOLDEN_NOMV*/
+      {
+          519, 1892, 4943, 7711,10604,11778,12020,12339,
+        13679,14720,14883,16549,15926,16604,16341,19894
+      },
+      /*Cb  qi=26  OC_MODE_GOLDEN_MV*/
+      {
+          311, 2162, 6131, 9040,11797,14170,15245,15303,
+        15392,15879,16206,16490,16477,17025,17448,20547
+      }
+    },
+    {
+      /*Cr  qi=26  OC_MODE_INTRA*/
+      {
+          937, 3290, 5580, 7453, 9066,10557,11999,13380,
+        14774,15523,16355,17535,18710,19556,20328,24080
+      },
+      /*Cr  qi=26  OC_MODE_INTER_NOMV*/
+      {
+          153,  656, 2115, 5167, 7962, 9355,10456,10810,
+        10818,10354,10738,10540,10776,11372,11489, 9252
+      },
+      /*Cr  qi=26  OC_MODE_INTER_MV*/
+      {
+          155, 1007, 3017, 6181, 8911,11210,12944,14503,
+        15055,15060,17437,17701,18167,19569,20056,21443
+      },
+      /*Cr  qi=26  OC_MDOE_INTER_MV_LAST*/
+      {
+          172,  930, 2717, 6070, 9038,11365,13249,14778,
+        15521,15619,17974,17221,19531,18452,17394,16846
+      },
+      /*Cr  qi=26  OC_MODE_INTER_MV_LAST2*/
+      {
+          220,  974, 2850, 6201, 8866,10983,12805,14361,
+        14833,14566,15278,16277,14890,12779,14562,15468
+      },
+      /*Cr  qi=26  OC_MODE_INTER_MV_FOUR*/
+      {
+          174, 1004, 3053, 6108, 8677,10757,12470,13917,
+        15284,16482,17742,18557,19280,20322,21645,23491
+      },
+      /*Cr  qi=26  OC_MODE_GOLDEN_NOMV*/
+      {
+          267, 1048, 2388, 5109, 6283, 6973, 7712, 7843,
+         8320, 8688, 9410, 9565, 9976,10254,10624,10795
+      },
+      /*Cr  qi=26  OC_MODE_GOLDEN_MV*/
+      {
+          199, 1103, 2913, 5992, 8039, 9507,10358,10100,
+        10241,10130,10242,10273,10704,10745,10889,10981
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=27  OC_MODE_INTRA*/
+      {
+         1020, 2098, 4577, 7168, 9052,10626,12030,13207,
+        14504,15736,16772,17504,18449,19448,20250,26046
+      },
+      /*Y'  qi=27  OC_MODE_INTER_NOMV*/
+      {
+          174,  754, 2797, 5947, 9197,11608,13542,15316,
+        16737,17992,19356,20503,21450,22288,23312,29974
+      },
+      /*Y'  qi=27  OC_MODE_INTER_MV*/
+      {
+          372, 1070, 3323, 6161, 8854,10963,12774,14332,
+        15835,17282,18535,19658,20738,21775,22526,26787
+      },
+      /*Y'  qi=27  OC_MDOE_INTER_MV_LAST*/
+      {
+          238,  814, 3115, 6203, 8863,11032,12907,14587,
+        16076,17427,18696,19792,20844,21847,22768,26945
+      },
+      /*Y'  qi=27  OC_MODE_INTER_MV_LAST2*/
+      {
+          277,  918, 3154, 6129, 8925,11209,13043,14624,
+        16047,17357,18576,19668,20710,21677,22449,27088
+      },
+      /*Y'  qi=27  OC_MODE_INTER_MV_FOUR*/
+      {
+          403, 1013, 3288, 6231, 8868,11065,12927,14566,
+        16061,17455,18712,19820,20837,21810,22707,25986
+      },
+      /*Y'  qi=27  OC_MODE_GOLDEN_NOMV*/
+      {
+          398, 1193, 3482, 6519, 8972,10805,11952,13519,
+        14632,15520,16569,17931,18645,19115,19967,27435
+      },
+      /*Y'  qi=27  OC_MODE_GOLDEN_MV*/
+      {
+          452, 1142, 3393, 6249, 8919,11218,13237,15041,
+        16562,17903,19095,20082,20999,21815,22604,26700
+      }
+    },
+    {
+      /*Cb  qi=27  OC_MODE_INTRA*/
+      {
+         1531, 4845, 7638,10380,12498,13859,15098,16497,
+        18117,19763,21206,23004,23844,24935,25995,31061
+      },
+      /*Cb  qi=27  OC_MODE_INTER_NOMV*/
+      {
+          333, 1420, 4973, 8466,10346,13347,15560,16385,
+        20482,18920,21658,20564,25754,24832,23293,13981
+      },
+      /*Cb  qi=27  OC_MODE_INTER_MV*/
+      {
+          457, 2665, 6262, 9122,12326,15427,17955,18876,
+        20483,22388,23419,24784,25889,29127,28575,32410
+      },
+      /*Cb  qi=27  OC_MDOE_INTER_MV_LAST*/
+      {
+          322, 1814, 6094, 9099,12546,16072,18008,19005,
+        19933,19937,20396,19881,19445,18912,18652,19393
+      },
+      /*Cb  qi=27  OC_MODE_INTER_MV_LAST2*/
+      {
+          399, 1968, 6186, 8929,12112,15470,18015,20032,
+        21422,22571,24770,23473,24685,27733,27232,34169
+      },
+      /*Cb  qi=27  OC_MODE_INTER_MV_FOUR*/
+      {
+          311, 1919, 5848, 8987,12153,15375,17792,19737,
+        21334,22588,23883,24384,26867,26786,28608,32011
+      },
+      /*Cb  qi=27  OC_MODE_GOLDEN_NOMV*/
+      {
+          540, 1932, 4949, 7754,10972,12093,12133,12526,
+        13899,14916,15294,16280,15920,16353,16070,18965
+      },
+      /*Cb  qi=27  OC_MODE_GOLDEN_MV*/
+      {
+          332, 2220, 6185, 9125,11957,14223,14942,15282,
+        15707,15488,15790,16400,16491,16934,17050,19286
+      }
+    },
+    {
+      /*Cr  qi=27  OC_MODE_INTRA*/
+      {
+          958, 3379, 5687, 7571, 9181,10651,12110,13503,
+        14861,15617,16391,17605,18835,19575,20431,24317
+      },
+      /*Cr  qi=27  OC_MODE_INTER_NOMV*/
+      {
+          157,  678, 2169, 5181, 7777, 9190,10304,10721,
+        10689,10281,10385,12240,13456,10660,12808,13854
+      },
+      /*Cr  qi=27  OC_MODE_INTER_MV*/
+      {
+          240, 1175, 3271, 6293, 8795,10955,12607,13526,
+        14100,14892,17274,17813,19522,21703,21436,21320
+      },
+      /*Cr  qi=27  OC_MDOE_INTER_MV_LAST*/
+      {
+          180,  963, 2831, 6263, 9146,11331,12844,13587,
+        13273,12281,12097,11023,10551,10445,12008, 9881
+      },
+      /*Cr  qi=27  OC_MODE_INTER_MV_LAST2*/
+      {
+          226, 1039, 2909, 6251, 8803,11138,12670,13876,
+        13693,13459,14366,13240,13581,13784,14346,16056
+      },
+      /*Cr  qi=27  OC_MODE_INTER_MV_FOUR*/
+      {
+          179, 1034, 3125, 6187, 8780,10900,12571,13843,
+        15093,16435,17770,18728,19501,20419,20649,23958
+      },
+      /*Cr  qi=27  OC_MODE_GOLDEN_NOMV*/
+      {
+          265, 1093, 2517, 5167, 6637, 7338, 8004, 8001,
+         8402, 8463, 9176, 9434, 9728, 9775,10366,10585
+      },
+      /*Cr  qi=27  OC_MODE_GOLDEN_MV*/
+      {
+          203, 1158, 2985, 6088, 8128, 9618,10292,10021,
+         9965,10006,10056,10140,10660,10552,10112,10397
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=28  OC_MODE_INTRA*/
+      {
+         1042, 2249, 4805, 7405, 9335,10930,12355,13553,
+        14884,16129,17186,17926,18885,19884,20739,26640
+      },
+      /*Y'  qi=28  OC_MODE_INTER_NOMV*/
+      {
+          192,  846, 3061, 6419, 9713,12033,14045,15854,
+        17123,18494,19755,20895,21847,22842,23664,30681
+      },
+      /*Y'  qi=28  OC_MODE_INTER_MV*/
+      {
+          388, 1160, 3488, 6472, 9261,11452,13250,14845,
+        16323,17699,19009,20122,21217,22213,23140,27498
+      },
+      /*Y'  qi=28  OC_MDOE_INTER_MV_LAST*/
+      {
+          217,  896, 3363, 6612, 9318,11442,13305,14998,
+        16485,17886,19146,20288,21335,22355,23296,27635
+      },
+      /*Y'  qi=28  OC_MODE_INTER_MV_LAST2*/
+      {
+          297, 1013, 3398, 6520, 9440,11717,13520,15084,
+        16471,17812,19061,20201,21240,22269,23078,27667
+      },
+      /*Y'  qi=28  OC_MODE_INTER_MV_FOUR*/
+      {
+          406, 1103, 3544, 6624, 9317,11563,13436,15096,
+        16595,17990,19240,20355,21401,22397,23325,26638
+      },
+      /*Y'  qi=28  OC_MODE_GOLDEN_NOMV*/
+      {
+          203,  986, 3529, 6793, 9381,11151,12377,14017,
+        15022,15919,17154,18454,19059,19608,20615,28195
+      },
+      /*Y'  qi=28  OC_MODE_GOLDEN_MV*/
+      {
+          436, 1220, 3596, 6603, 9371,11695,13671,15485,
+        17013,18375,19641,20698,21749,22524,23555,27726
+      }
+    },
+    {
+      /*Cb  qi=28  OC_MODE_INTRA*/
+      {
+         1651, 5231, 8127,10919,13108,14460,15726,17122,
+        18843,20512,22012,23782,24723,25814,26804,31978
+      },
+      /*Cb  qi=28  OC_MODE_INTER_NOMV*/
+      {
+          417, 1632, 5536, 9246,11008,14183,17042,18551,
+        21603,19461,21416,24172,27648,26262,23048,16867
+      },
+      /*Cb  qi=28  OC_MODE_INTER_MV*/
+      {
+          431, 2803, 6751, 9600,12899,16300,18618,20152,
+        23610,23184,24281,25502,26150,27452,31287,31986
+      },
+      /*Cb  qi=28  OC_MDOE_INTER_MV_LAST*/
+      {
+          362, 1994, 6620, 9713,13199,16648,18609,19706,
+        20673,21006,21167,20902,19965,20178,20011,20435
+      },
+      /*Cb  qi=28  OC_MODE_INTER_MV_LAST2*/
+      {
+          448, 2229, 6750, 9542,12812,16344,18623,20713,
+        21818,22677,22964,27255,27352,27520,29541,32815
+      },
+      /*Cb  qi=28  OC_MODE_INTER_MV_FOUR*/
+      {
+          363, 2121, 6326, 9583,12789,15985,18501,20354,
+        22037,23511,24685,25800,26672,27421,31166,32497
+      },
+      /*Cb  qi=28  OC_MODE_GOLDEN_NOMV*/
+      {
+          471, 2029, 5308, 7884,11137,12228,12984,13465,
+        14671,15644,16133,17691,17299,17773,17539,19972
+      },
+      /*Cb  qi=28  OC_MODE_GOLDEN_MV*/
+      {
+          377, 2428, 6753, 9681,12548,15546,17468,17725,
+        18450,17646,19289,17644,17634,17975,18580,19051
+      }
+    },
+    {
+      /*Cr  qi=28  OC_MODE_INTRA*/
+      {
+         1002, 3557, 6014, 7984, 9658,11150,12650,14092,
+        15527,16291,17075,18343,19575,20297,21240,25136
+      },
+      /*Cr  qi=28  OC_MODE_INTER_NOMV*/
+      {
+          186,  768, 2528, 5851, 8515,10021,11106,12151,
+        12600,10581, 9604,10801,11600,12494,12542,12766
+      },
+      /*Cr  qi=28  OC_MODE_INTER_MV*/
+      {
+          237, 1192, 3516, 6913, 9556,11669,13357,14421,
+        14805,15981,16973,17495,20224,22253,21081,22640
+      },
+      /*Cr  qi=28  OC_MDOE_INTER_MV_LAST*/
+      {
+          190, 1046, 3221, 6893, 9852,12007,13537,14135,
+        13734,13016,12537,11439,11078,11840,12385,10495
+      },
+      /*Cr  qi=28  OC_MODE_INTER_MV_LAST2*/
+      {
+          250, 1169, 3197, 6856, 9463,11751,13449,14288,
+        14132,14789,14380,13871,14268,14874,17894,18031
+      },
+      /*Cr  qi=28  OC_MODE_INTER_MV_FOUR*/
+      {
+          202, 1141, 3522, 6770, 9434,11568,13166,14701,
+        15934,17390,18713,18951,20733,21810,21587,24700
+      },
+      /*Cr  qi=28  OC_MODE_GOLDEN_NOMV*/
+      {
+          219, 1128, 2763, 5656, 6883, 7583, 8403, 8453,
+         8509, 9003, 9713, 9922,10571,10736,10899,11418
+      },
+      /*Cr  qi=28  OC_MODE_GOLDEN_MV*/
+      {
+          228, 1276, 3351, 6889, 9183,11072,12095,12312,
+        11545,10391,10239,10620,11128,11131,10927,11872
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=29  OC_MODE_INTRA*/
+      {
+         1114, 2616, 5385, 7984, 9968,11594,13073,14294,
+        15643,16905,17955,18689,19657,20658,21513,27544
+      },
+      /*Y'  qi=29  OC_MODE_INTER_NOMV*/
+      {
+          215, 1069, 3638, 7274,10566,12827,14936,16663,
+        17934,19256,20504,21636,22741,23416,24266,31396
+      },
+      /*Y'  qi=29  OC_MODE_INTER_MV*/
+      {
+          437, 1396, 4049, 7209,10044,12216,14010,15600,
+        17087,18508,19827,20996,22082,23183,24110,28506
+      },
+      /*Y'  qi=29  OC_MDOE_INTER_MV_LAST*/
+      {
+          284, 1157, 3954, 7377,10111,12238,14090,15783,
+        17292,18716,19981,21174,22308,23297,24242,28633
+      },
+      /*Y'  qi=29  OC_MODE_INTER_MV_LAST2*/
+      {
+          306, 1243, 3941, 7369,10348,12520,14284,15813,
+        17218,18577,19872,20995,22083,23048,24008,28520
+      },
+      /*Y'  qi=29  OC_MODE_INTER_MV_FOUR*/
+      {
+          402, 1333, 4078, 7336,10091,12331,14202,15877,
+        17387,18807,20061,21228,22309,23311,24280,27603
+      },
+      /*Y'  qi=29  OC_MODE_GOLDEN_NOMV*/
+      {
+          211, 1003, 3967, 7553,10088,11840,13136,14676,
+        15583,16671,18242,19337,19900,20553,21345,29165
+      },
+      /*Y'  qi=29  OC_MODE_GOLDEN_MV*/
+      {
+          430, 1444, 4112, 7294,10170,12490,14493,16265,
+        17801,19196,20461,21617,22654,23388,24698,28665
+      }
+    },
+    {
+      /*Cb  qi=29  OC_MODE_INTRA*/
+      {
+         1794, 5650, 8640,11437,13654,15046,16334,17734,
+        19548,21238,22753,24553,25536,26646,27595,32691
+      },
+      /*Cb  qi=29  OC_MODE_INTER_NOMV*/
+      {
+          505, 1858, 6151, 9951,11910,15248,19305,18491,
+        24640,22562,23381,23224,24763,28297,32424,20931
+      },
+      /*Cb  qi=29  OC_MODE_INTER_MV*/
+      {
+          545, 3113, 7315,10202,13589,16916,19401,21229,
+        22755,24450,24629,28367,27982,27559,32036,32032
+      },
+      /*Cb  qi=29  OC_MDOE_INTER_MV_LAST*/
+      {
+          427, 2318, 7205,10369,13976,17415,19386,20450,
+        21413,21867,22013,21928,21301,20584,21113,21281
+      },
+      /*Cb  qi=29  OC_MODE_INTER_MV_LAST2*/
+      {
+          527, 2548, 7355,10162,13537,16847,19922,21576,
+        23044,24158,25447,26211,27020,28227,30794,30722
+      },
+      /*Cb  qi=29  OC_MODE_INTER_MV_FOUR*/
+      {
+          438, 2373, 6852,10192,13454,16682,19141,21214,
+        22757,24379,25482,26481,27630,28485,31612,32604
+      },
+      /*Cb  qi=29  OC_MODE_GOLDEN_NOMV*/
+      {
+          554, 2197, 5762, 7968,11559,12994,13747,13883,
+        15396,16474,17354,18656,17894,18520,18518,21054
+      },
+      /*Cb  qi=29  OC_MODE_GOLDEN_MV*/
+      {
+          470, 2688, 7325,10336,13225,16148,18086,19287,
+        19057,19858,21301,19523,19518,20009,20248,21213
+      }
+    },
+    {
+      /*Cr  qi=29  OC_MODE_INTRA*/
+      {
+         1060, 3774, 6296, 8297,10008,11536,13080,14574,
+        16016,16878,17629,18970,20088,20777,21745,25700
+      },
+      /*Cr  qi=29  OC_MODE_INTER_NOMV*/
+      {
+          214,  842, 2779, 6378, 8921,10553,11727,16171,
+        12743,10157, 8325,10563,10328,13563,13407, 8771
+      },
+      /*Cr  qi=29  OC_MODE_INTER_MV*/
+      {
+          290, 1286, 3754, 7316,10022,12196,13845,14601,
+        15515,16184,17469,18897,20356,21606,20251,23554
+      },
+      /*Cr  qi=29  OC_MDOE_INTER_MV_LAST*/
+      {
+          217, 1149, 3550, 7328,10311,12416,13956,14650,
+        14434,13210,12966,12585,11438,12211,12543,11006
+      },
+      /*Cr  qi=29  OC_MODE_INTER_MV_LAST2*/
+      {
+          283, 1288, 3457, 7157, 9873,12399,13891,14973,
+        15029,15012,14168,15137,14448,15683,14652,17462
+      },
+      /*Cr  qi=29  OC_MODE_INTER_MV_FOUR*/
+      {
+          229, 1246, 3816, 7168, 9849,11986,13655,15128,
+        16546,17595,19446,19931,20844,21307,22983,24773
+      },
+      /*Cr  qi=29  OC_MODE_GOLDEN_NOMV*/
+      {
+          229, 1234, 2957, 5960, 7197, 7875, 9019, 8840,
+         9056, 9244,10003,10644,10461,10919,11686,11941
+      },
+      /*Cr  qi=29  OC_MODE_GOLDEN_MV*/
+      {
+          259, 1374, 3622, 7259, 9640,11681,12737,13179,
+        13476,11427,11785,11877,12185,13778,12968,12052
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=30  OC_MODE_INTRA*/
+      {
+         1132, 2723, 5519, 8106,10104,11743,13211,14470,
+        15832,17098,18153,18890,19861,20873,21744,27706
+      },
+      /*Y'  qi=30  OC_MODE_INTER_NOMV*/
+      {
+          222, 1122, 3790, 7527,10836,13065,15217,16909,
+        18161,19530,20796,21963,23000,23926,25061,31555
+      },
+      /*Y'  qi=30  OC_MODE_INTER_MV*/
+      {
+          496, 1454, 4238, 7453,10420,12537,14228,15782,
+        17295,18745,20124,21354,22385,23478,24399,28806
+      },
+      /*Y'  qi=30  OC_MDOE_INTER_MV_LAST*/
+      {
+          284, 1208, 4100, 7595,10356,12479,14346,16043,
+        17547,18966,20256,21438,22581,23617,24632,28815
+      },
+      /*Y'  qi=30  OC_MODE_INTER_MV_LAST2*/
+      {
+          300, 1298, 4092, 7602,10577,12746,14493,16035,
+        17456,18828,20092,21252,22273,23338,24105,28707
+      },
+      /*Y'  qi=30  OC_MODE_INTER_MV_FOUR*/
+      {
+          401, 1378, 4190, 7526,10309,12548,14431,16103,
+        17619,19038,20319,21486,22578,23609,24533,27829
+      },
+      /*Y'  qi=30  OC_MODE_GOLDEN_NOMV*/
+      {
+          211, 1048, 4127, 7773,10317,12096,13330,14860,
+        15808,16898,18656,19453,20176,20792,21615,29208
+      },
+      /*Y'  qi=30  OC_MODE_GOLDEN_MV*/
+      {
+          435, 1486, 4267, 7550,10427,12771,14773,16554,
+        18070,19485,20670,21754,22819,23508,24459,28527
+      }
+    },
+    {
+      /*Cb  qi=30  OC_MODE_INTRA*/
+      {
+         1875, 5900, 8960,11778,14007,15393,16701,18106,
+        19979,21699,23236,25061,26079,27177,28285,33412
+      },
+      /*Cb  qi=30  OC_MODE_INTER_NOMV*/
+      {
+          557, 1986, 6483,10306,12135,16136,32988,21821,
+        23333,22089,23451,24653,28243,32688,28240,23215
+      },
+      /*Cb  qi=30  OC_MODE_INTER_MV*/
+      {
+          645, 3366, 7725,10619,13966,17514,19951,21444,
+        23806,24633,25194,29184,28718,29210,30854,32944
+      },
+      /*Cb  qi=30  OC_MDOE_INTER_MV_LAST*/
+      {
+          475, 2473, 7607,10819,14437,17852,19815,20921,
+        21850,22072,22565,21979,20784,20904,21176,21410
+      },
+      /*Cb  qi=30  OC_MODE_INTER_MV_LAST2*/
+      {
+          580, 2795, 7752,10634,14032,17572,20408,22168,
+        23712,24526,26111,26087,28970,28566,30662,31528
+      },
+      /*Cb  qi=30  OC_MODE_INTER_MV_FOUR*/
+      {
+          484, 2514, 7215,10615,13922,17169,19651,21835,
+        23170,25084,26498,26860,28712,28207,31329,33709
+      },
+      /*Cb  qi=30  OC_MODE_GOLDEN_NOMV*/
+      {
+          608, 2316, 6004, 8323,11589,13344,14031,14545,
+        15436,16840,17752,18961,17891,18535,18606,21236
+      },
+      /*Cb  qi=30  OC_MODE_GOLDEN_MV*/
+      {
+          512, 2862, 7721,10818,13688,16105,16682,17215,
+        17233,17756,17844,18549,18122,18909,19031,21435
+      }
+    },
+    {
+      /*Cr  qi=30  OC_MODE_INTRA*/
+      {
+         1095, 3927, 6553, 8584,10317,11852,13401,14938,
+        16400,17287,18037,19461,20571,21382,22353,26214
+      },
+      /*Cr  qi=30  OC_MODE_INTER_NOMV*/
+      {
+          226,  920, 3064, 6757, 9301,10698,11669,19968,
+        14040,10730, 8926, 9147,10583,11143,11759, 8836
+      },
+      /*Cr  qi=30  OC_MODE_INTER_MV*/
+      {
+          341, 1428, 4038, 7764,10495,12740,14320,15464,
+        15996,16937,19705,19040,21586,22355,20191,23474
+      },
+      /*Cr  qi=30  OC_MDOE_INTER_MV_LAST*/
+      {
+          234, 1259, 3880, 7787,10786,12873,14416,15053,
+        14695,13660,13010,12199,11427,12217,12174,11093
+      },
+      /*Cr  qi=30  OC_MODE_INTER_MV_LAST2*/
+      {
+          301, 1414, 3779, 7466,10314,12679,14361,15549,
+        15252,14721,14280,15947,18164,16521,18211,17054
+      },
+      /*Cr  qi=30  OC_MODE_INTER_MV_FOUR*/
+      {
+          249, 1349, 4130, 7567,10283,12414,14076,15597,
+        17205,18145,19724,20572,21321,22567,22814,25543
+      },
+      /*Cr  qi=30  OC_MODE_GOLDEN_NOMV*/
+      {
+          252, 1321, 3165, 6196, 7406, 8135, 9230, 9195,
+         9241, 9570,10080,10504,10432,10746,11208,11700
+      },
+      /*Cr  qi=30  OC_MODE_GOLDEN_MV*/
+      {
+          278, 1507, 3957, 7497, 9389,10908,11524,11374,
+        11336,11022,10925,10980,11143,11534,11127,11510
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=31  OC_MODE_INTRA*/
+      {
+         1243, 3194, 6173, 8714,10746,12418,13880,15098,
+        16507,17856,18942,19676,20668,21695,22573,28604
+      },
+      /*Y'  qi=31  OC_MODE_INTER_NOMV*/
+      {
+          259, 1441, 4459, 8389,11662,13859,16072,17688,
+        18961,20294,21580,22864,23931,24790,25928,33176
+      },
+      /*Y'  qi=31  OC_MODE_INTER_MV*/
+      {
+          710, 1839, 4916, 8249,11183,13277,14981,16538,
+        18052,19536,20875,22064,23189,24323,25227,29847
+      },
+      /*Y'  qi=31  OC_MDOE_INTER_MV_LAST*/
+      {
+          334, 1580, 4791, 8420,11163,13255,15111,16786,
+        18298,19741,21046,22287,23453,24506,25493,29822
+      },
+      /*Y'  qi=31  OC_MODE_INTER_MV_LAST2*/
+      {
+          340, 1660, 4796, 8411,11386,13521,15231,16788,
+        18213,19605,20912,22095,23183,24277,25073,29773
+      },
+      /*Y'  qi=31  OC_MODE_INTER_MV_FOUR*/
+      {
+          398, 1711, 4839, 8308,11100,13325,15206,16867,
+        18415,19860,21183,22375,23479,24548,25532,28945
+      },
+      /*Y'  qi=31  OC_MODE_GOLDEN_NOMV*/
+      {
+          250, 1331, 4688, 8559,11084,12753,14151,15533,
+        16273,17617,19452,20392,20937,21704,22372,30217
+      },
+      /*Y'  qi=31  OC_MODE_GOLDEN_MV*/
+      {
+          462, 1818, 4899, 8330,11244,13556,15492,17306,
+        18834,20273,21493,22590,23733,24462,25371,29530
+      }
+    },
+    {
+      /*Cb  qi=31  OC_MODE_INTRA*/
+      {
+         1969, 6266, 9420,12254,14526,15913,17272,18728,
+        20625,22400,23982,25849,26832,27869,29084,34270
+      },
+      /*Cb  qi=31  OC_MODE_INTER_NOMV*/
+      {
+          602, 2192, 6990,10801,12770,16604,35344,19558,
+        27291,23126,24691,25060,26278,35277,25919,28248
+      },
+      /*Cb  qi=31  OC_MODE_INTER_MV*/
+      {
+          716, 3627, 8237,11193,14656,18188,20843,22277,
+        23979,25632,26623,27331,28221,30677,33286,34856
+      },
+      /*Cb  qi=31  OC_MDOE_INTER_MV_LAST*/
+      {
+          508, 2731, 8162,11409,15073,18614,20576,21665,
+        22523,23016,23205,22822,21761,21927,21581,22295
+      },
+      /*Cb  qi=31  OC_MODE_INTER_MV_LAST2*/
+      {
+          660, 3137, 8289,11192,14635,18103,21061,22876,
+        24301,24757,27361,27336,31414,30016,30911,32270
+      },
+      /*Cb  qi=31  OC_MODE_INTER_MV_FOUR*/
+      {
+          539, 2731, 7697,11175,14555,17841,20452,22510,
+        24147,25889,26820,28375,29408,29754,33360,33947
+      },
+      /*Cb  qi=31  OC_MODE_GOLDEN_NOMV*/
+      {
+          663, 2476, 6402, 8876,11968,13731,15010,14956,
+        16059,17666,18408,19343,18603,19280,19207,22022
+      },
+      /*Cb  qi=31  OC_MODE_GOLDEN_MV*/
+      {
+          573, 3111, 8240,11368,14296,16861,17216,17749,
+        18049,18399,18607,19040,18882,19688,19846,22212
+      }
+    },
+    {
+      /*Cr  qi=31  OC_MODE_INTRA*/
+      {
+         1108, 4103, 6800, 8879,10678,12264,13846,15439,
+        16977,17857,18614,20067,21196,21983,23088,27038
+      },
+      /*Cr  qi=31  OC_MODE_INTER_NOMV*/
+      {
+          243, 1003, 3375, 7242, 9869,11357,12106,14703,
+        13969,20480, 8767, 7802, 9165,11152,10780, 6695
+      },
+      /*Cr  qi=31  OC_MODE_INTER_MV*/
+      {
+          352, 1530, 4451, 8153,10953,13177,14946,16189,
+        16547,18487,19933,19120,21227,24127,18871,23373
+      },
+      /*Cr  qi=31  OC_MDOE_INTER_MV_LAST*/
+      {
+          249, 1375, 4295, 8365,11355,13442,15091,15530,
+        15322,14050,13455,12627,12100,12248,12862,11273
+      },
+      /*Cr  qi=31  OC_MODE_INTER_MV_LAST2*/
+      {
+          327, 1527, 4108, 7880,10890,13359,15189,15926,
+        15917,14872,14336,16691,16635,17637,18716,21662
+      },
+      /*Cr  qi=31  OC_MODE_INTER_MV_FOUR*/
+      {
+          269, 1456, 4455, 8067,10825,13034,14693,16347,
+        17604,19051,20466,21353,21585,23218,20589,26015
+      },
+      /*Cr  qi=31  OC_MODE_GOLDEN_NOMV*/
+      {
+          269, 1423, 3466, 6634, 7720, 8445, 9583, 9507,
+         9585, 9909,10494,10916,10905,11299,11459,12268
+      },
+      /*Cr  qi=31  OC_MODE_GOLDEN_MV*/
+      {
+          301, 1616, 4294, 7896, 9823,11306,11791,11780,
+        11534,11432,11176,11540,11405,12087,11509,11815
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=32  OC_MODE_INTRA*/
+      {
+         1271, 3298, 6329, 8850,10899,12559,14026,15256,
+        16702,18088,19164,19920,20920,21979,22859,28955
+      },
+      /*Y'  qi=32  OC_MODE_INTER_NOMV*/
+      {
+          267, 1525, 4671, 8723,11973,14143,16405,17968,
+        19245,20675,21989,23148,24337,25365,26320,33830
+      },
+      /*Y'  qi=32  OC_MODE_INTER_MV*/
+      {
+          707, 1899, 5099, 8501,11504,13616,15266,16833,
+        18363,19875,21252,22536,23698,24786,25767,30302
+      },
+      /*Y'  qi=32  OC_MDOE_INTER_MV_LAST*/
+      {
+          342, 1676, 4968, 8685,11449,13535,15398,17073,
+        18605,20040,21370,22636,23795,24917,25903,30209
+      },
+      /*Y'  qi=32  OC_MODE_INTER_MV_LAST2*/
+      {
+          346, 1725, 4957, 8657,11660,13788,15517,17077,
+        18514,19935,21238,22447,23559,24625,25470,30262
+      },
+      /*Y'  qi=32  OC_MODE_INTER_MV_FOUR*/
+      {
+          396, 1787, 5006, 8549,11358,13577,15489,17145,
+        18697,20145,21480,22695,23813,24891,25856,29355
+      },
+      /*Y'  qi=32  OC_MODE_GOLDEN_NOMV*/
+      {
+          250, 1375, 4893, 8834,11321,12960,14467,15712,
+        16599,18479,19754,20640,21218,21921,22923,30610
+      },
+      /*Y'  qi=32  OC_MODE_GOLDEN_MV*/
+      {
+          452, 1878, 5054, 8555,11522,13840,15809,17570,
+        19146,20601,21791,22976,24039,24958,25772,29921
+      }
+    },
+    {
+      /*Cb  qi=32  OC_MODE_INTRA*/
+      {
+         2047, 6510, 9723,12559,14845,16217,17606,19077,
+        21033,22790,24396,26315,27318,28472,29468,34646
+      },
+      /*Cb  qi=32  OC_MODE_INTER_NOMV*/
+      {
+          632, 2336, 7255,11079,12978,16747,33804,21393,
+        26808,27554,24382,23564,26545,36253,34739,31423
+      },
+      /*Cb  qi=32  OC_MODE_INTER_MV*/
+      {
+          840, 3859, 8589,11536,14964,18409,20980,22632,
+        24036,25768,26899,27728,29379,30349,33557,34888
+      },
+      /*Cb  qi=32  OC_MDOE_INTER_MV_LAST*/
+      {
+          533, 2916, 8513,11749,15432,18920,20974,22041,
+        22928,23333,23639,23540,22399,22108,22247,22730
+      },
+      /*Cb  qi=32  OC_MODE_INTER_MV_LAST2*/
+      {
+          690, 3247, 8620,11571,14966,18426,21065,23404,
+        24679,25341,26715,25738,28769,29059,30455,34549
+      },
+      /*Cb  qi=32  OC_MODE_INTER_MV_FOUR*/
+      {
+          566, 2901, 8010,11543,14945,18245,20861,23043,
+        24688,26788,27286,28525,30162,29595,33294,35082
+      },
+      /*Cb  qi=32  OC_MODE_GOLDEN_NOMV*/
+      {
+          678, 2610, 6565, 9338,12222,13971,15278,15470,
+        16770,17961,18876,19909,18754,19819,19685,22435
+      },
+      /*Cb  qi=32  OC_MODE_GOLDEN_MV*/
+      {
+          613, 3278, 8564,11721,14710,17208,17628,18242,
+        18491,18941,19013,19211,19229,20124,20427,22622
+      }
+    },
+    {
+      /*Cr  qi=32  OC_MODE_INTRA*/
+      {
+         1155, 4279, 7062, 9177,11005,12602,14186,15784,
+        17336,18205,19011,20476,21562,22217,23443,27368
+      },
+      /*Cr  qi=32  OC_MODE_INTER_NOMV*/
+      {
+          285, 1091, 3616, 7578,10223,11660,25728,13838,
+        13575,10429, 7561, 8383, 9048,10260, 7922, 6986
+      },
+      /*Cr  qi=32  OC_MODE_INTER_MV*/
+      {
+          416, 1659, 4618, 8477,11347,13604,15135,16871,
+        17411,18826,20225,19769,21601,22810,23433,16131
+      },
+      /*Cr  qi=32  OC_MDOE_INTER_MV_LAST*/
+      {
+          279, 1486, 4564, 8673,11667,13699,15345,15804,
+        15683,14358,13769,12840,12095,12500,12988,11537
+      },
+      /*Cr  qi=32  OC_MODE_INTER_MV_LAST2*/
+      {
+          357, 1632, 4354, 8110,11090,13644,15348,16196,
+        16731,15376,15037,16882,15450,19400,18238,18981
+      },
+      /*Cr  qi=32  OC_MODE_INTER_MV_FOUR*/
+      {
+          302, 1566, 4728, 8365,11147,13357,15114,16647,
+        18197,19566,21128,21647,22364,24033,25056,25930
+      },
+      /*Cr  qi=32  OC_MODE_GOLDEN_NOMV*/
+      {
+          314, 1527, 3662, 6743, 7985, 8636, 9778, 9814,
+         9881,10192,10618,10920,11088,11512,11691,12385
+      },
+      /*Cr  qi=32  OC_MODE_GOLDEN_MV*/
+      {
+          336, 1734, 4541, 8192,10056,11657,12109,11901,
+        11894,11589,11247,11796,11629,12519,11988,11980
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=33  OC_MODE_INTRA*/
+      {
+         1418, 3828, 7054, 9524,11597,13299,14788,15961,
+        17474,18957,20099,20875,21885,22963,23860,30051
+      },
+      /*Y'  qi=33  OC_MODE_INTER_NOMV*/
+      {
+          278, 1826, 5471, 9738,12918,15177,17315,18761,
+        20231,21725,23134,24168,25427,26617,27403,35824
+      },
+      /*Y'  qi=33  OC_MODE_INTER_MV*/
+      {
+          664, 2232, 5741, 9451,12182,14295,16115,17782,
+        19360,20874,22243,23522,24710,25868,26880,31212
+      },
+      /*Y'  qi=33  OC_MDOE_INTER_MV_LAST*/
+      {
+          375, 2103, 5697, 9566,12371,14481,16299,17970,
+        19505,20962,22317,23568,24760,25869,26870,31419
+      },
+      /*Y'  qi=33  OC_MODE_INTER_MV_LAST2*/
+      {
+          357, 2109, 5680, 9575,12680,14837,16534,18045,
+        19530,21002,22416,23681,24932,26102,27000,32635
+      },
+      /*Y'  qi=33  OC_MODE_INTER_MV_FOUR*/
+      {
+          408, 2284, 5878, 9497,12356,14583,16542,18238,
+        19840,21330,22757,24003,25189,26255,27255,30874
+      },
+      /*Y'  qi=33  OC_MODE_GOLDEN_NOMV*/
+      {
+          288, 1704, 5633, 9650,12068,13713,15231,16528,
+        17584,19936,21120,21817,22483,23045,24014,31873
+      },
+      /*Y'  qi=33  OC_MODE_GOLDEN_MV*/
+      {
+          504, 2254, 5781, 9466,12421,14694,16720,18511,
+        20111,21635,22924,24084,25249,26132,27074,31199
+      }
+    },
+    {
+      /*Cb  qi=33  OC_MODE_INTRA*/
+      {
+         2179, 7027,10362,13241,15611,17014,18414,19968,
+        21969,23829,25448,27401,28425,29627,30588,35605
+      },
+      /*Cb  qi=33  OC_MODE_INTER_NOMV*/
+      {
+          725, 2616, 7939,11742,14083,17691,33989,21492,
+        27686,34551,27995,38656,26829,32971,31099,37794
+      },
+      /*Cb  qi=33  OC_MODE_INTER_MV*/
+      {
+          625, 3297, 9147,12672,16556,20170,22678,24658,
+        26370,27301,29015,28921,29486,33331,34455,36091
+      },
+      /*Cb  qi=33  OC_MDOE_INTER_MV_LAST*/
+      {
+          657, 3305, 9184,12450,16145,19663,21826,23061,
+        24026,24601,24659,24477,23245,23577,23648,23862
+      },
+      /*Cb  qi=33  OC_MODE_INTER_MV_LAST2*/
+      {
+          830, 3295, 9327,12377,15735,19190,21898,24660,
+        25058,28442,26437,27039,32469,31320,27184,34665
+      },
+      /*Cb  qi=33  OC_MODE_INTER_MV_FOUR*/
+      {
+          662, 3279, 8783,12286,15622,18878,21774,23923,
+        25664,27526,28749,29728,31653,31409,35557,36790
+      },
+      /*Cb  qi=33  OC_MODE_GOLDEN_NOMV*/
+      {
+          791, 2910, 7064, 9566,12641,14893,15589,16251,
+        17729,18891,19660,20748,19798,20840,20383,23473
+      },
+      /*Cb  qi=33  OC_MODE_GOLDEN_MV*/
+      {
+          716, 3594, 9307,12547,15589,18031,18516,19257,
+        19322,19489,19964,20603,20390,20841,21110,23830
+      }
+    },
+    {
+      /*Cr  qi=33  OC_MODE_INTRA*/
+      {
+         1205, 4556, 7452, 9629,11548,13208,14832,16474,
+        18107,19028,19829,21384,22570,23113,24301,28136
+      },
+      /*Cr  qi=33  OC_MODE_INTER_NOMV*/
+      {
+          338, 1237, 4135, 8187,10913,11982,13533,13968,
+        15471,10483, 7468, 6335, 9869, 9886, 8679, 5688
+      },
+      /*Cr  qi=33  OC_MODE_INTER_MV*/
+      {
+          319, 1693, 5231, 9375,12372,14552,16124,17323,
+        18579,20356,21617,22091,23149,24689,22919,26209
+      },
+      /*Cr  qi=33  OC_MDOE_INTER_MV_LAST*/
+      {
+          344, 1718, 5145, 9210,12254,14419,16053,16667,
+        16394,15244,14488,13691,12585,13158,13711,12341
+      },
+      /*Cr  qi=33  OC_MODE_INTER_MV_LAST2*/
+      {
+          398, 1804, 4772, 8885,11975,14031,15750,16290,
+        17374,15497,13530,14946,17620,22459,15097,21146
+      },
+      /*Cr  qi=33  OC_MODE_INTER_MV_FOUR*/
+      {
+          356, 1776, 5208, 8994,11811,14110,15986,17504,
+        19186,20523,22404,22816,23480,25386,21741,27279
+      },
+      /*Cr  qi=33  OC_MODE_GOLDEN_NOMV*/
+      {
+          376, 1690, 4133, 7208, 8328, 9164,10403,10240,
+        10264,10736,11141,11516,11580,11996,12238,13040
+      },
+      /*Cr  qi=33  OC_MODE_GOLDEN_MV*/
+      {
+          381, 1920, 5008, 8864,10777,12249,13101,12287,
+        12695,12092,11815,12054,12258,12725,12561,12706
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=34  OC_MODE_INTRA*/
+      {
+         1423, 3846, 7059, 9532,11589,13298,14784,15947,
+        17469,18968,20105,20883,21893,22971,23876,30061
+      },
+      /*Y'  qi=34  OC_MODE_INTER_NOMV*/
+      {
+          278, 1841, 5485, 9744,12915,15112,17294,18677,
+        20282,21849,23117,24276,25306,26524,27515,35779
+      },
+      /*Y'  qi=34  OC_MODE_INTER_MV*/
+      {
+          814, 2314, 5691, 9364,12196,14334,16160,17749,
+        19326,20831,22157,23423,24608,25801,26838,31287
+      },
+      /*Y'  qi=34  OC_MDOE_INTER_MV_LAST*/
+      {
+          375, 2114, 5773, 9625,12305,14384,16218,17936,
+        19504,20997,22364,23678,24863,26011,26987,31486
+      },
+      /*Y'  qi=34  OC_MODE_INTER_MV_LAST2*/
+      {
+          359, 2158, 5674, 9561,12662,14801,16506,18025,
+        19481,20950,22282,23533,24670,25878,26762,32662
+      },
+      /*Y'  qi=34  OC_MODE_INTER_MV_FOUR*/
+      {
+          404, 2216, 5823, 9463,12305,14535,16498,18182,
+        19782,21263,22679,23910,25116,26185,27217,30861
+      },
+      /*Y'  qi=34  OC_MODE_GOLDEN_NOMV*/
+      {
+          278, 1681, 5643, 9653,12082,13759,15240,16453,
+        17644,20319,21042,21763,22409,23103,23933,31904
+      },
+      /*Y'  qi=34  OC_MODE_GOLDEN_MV*/
+      {
+          516, 2280, 5798, 9462,12438,14705,16711,18510,
+        20094,21584,22899,24069,25228,26109,27082,31215
+      }
+    },
+    {
+      /*Cb  qi=34  OC_MODE_INTRA*/
+      {
+         2191, 7043,10370,13253,15632,17042,18428,19967,
+        22011,23843,25468,27365,28431,29621,30520,35659
+      },
+      /*Cb  qi=34  OC_MODE_INTER_NOMV*/
+      {
+          729, 2638, 8026,11949,13972,17625,36800,21164,
+        27520,22243,30549,24021,26624,35520,34445,33363
+      },
+      /*Cb  qi=34  OC_MODE_INTER_MV*/
+      {
+          741, 3684, 9210,12483,16258,19972,22679,24451,
+        26747,27593,28306,29759,31089,30608,33624,35439
+      },
+      /*Cb  qi=34  OC_MDOE_INTER_MV_LAST*/
+      {
+          614, 3259, 9215,12597,16384,19811,21945,23092,
+        23969,24418,24689,24592,23498,23169,23547,23897
+      },
+      /*Cb  qi=34  OC_MODE_INTER_MV_LAST2*/
+      {
+          808, 3287, 9321,12359,15793,19274,22096,24454,
+        25524,26912,29152,35085,31687,31813,33216,35580
+      },
+      /*Cb  qi=34  OC_MODE_INTER_MV_FOUR*/
+      {
+          673, 3230, 8731,12294,15650,19011,21739,23966,
+        25741,27695,28698,30185,32731,30735,35696,36688
+      },
+      /*Cb  qi=34  OC_MODE_GOLDEN_NOMV*/
+      {
+          790, 2901, 7112, 9517,12631,15040,15684,16315,
+        17687,19094,19546,20991,19857,20779,20454,23605
+      },
+      /*Cb  qi=34  OC_MODE_GOLDEN_MV*/
+      {
+          715, 3622, 9303,12551,15503,18156,18551,19205,
+        19139,19612,20176,20327,20470,20844,21176,23891
+      }
+    },
+    {
+      /*Cr  qi=34  OC_MODE_INTRA*/
+      {
+         1218, 4570, 7463, 9644,11556,13217,14839,16527,
+        18116,19027,19848,21382,22573,23192,24311,28288
+      },
+      /*Cr  qi=34  OC_MODE_INTER_NOMV*/
+      {
+          357, 1256, 4135, 8224,10899,11941,13213,19623,
+        15609,10466, 6997, 6756, 7667, 9547, 9647, 5621
+      },
+      /*Cr  qi=34  OC_MODE_INTER_MV*/
+      {
+          394, 1822, 5197, 9265,12177,14549,16146,17544,
+        18645,20551,21920,22364,22892,22864,25710,26017
+      },
+      /*Cr  qi=34  OC_MDOE_INTER_MV_LAST*/
+      {
+          322, 1659, 5202, 9351,12355,14455,16071,16553,
+        16478,15320,14215,13474,13065,12824,13673,12301
+      },
+      /*Cr  qi=34  OC_MODE_INTER_MV_LAST2*/
+      {
+          399, 1826, 4806, 8858,11735,14137,15857,16566,
+        16713,15566,14334,17076,15440,19211,17441,19567
+      },
+      /*Cr  qi=34  OC_MODE_INTER_MV_FOUR*/
+      {
+          366, 1777, 5226, 9010,11835,14085,16100,17517,
+        19082,20470,22151,22885,23798,24502,25534,27018
+      },
+      /*Cr  qi=34  OC_MODE_GOLDEN_NOMV*/
+      {
+          407, 1697, 4156, 7201, 8277, 9250,10410,10243,
+        10438,10795,11290,11264,11511,11699,12333,12945
+      },
+      /*Cr  qi=34  OC_MODE_GOLDEN_MV*/
+      {
+          389, 1927, 5024, 8880,10744,12232,13213,12541,
+        12834,12250,11880,12238,12035,12511,12324,12697
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=35  OC_MODE_INTRA*/
+      {
+         1458, 3977, 7249, 9717,11790,13509,15011,16170,
+        17719,19253,20394,21181,22217,23296,24211,30497
+      },
+      /*Y'  qi=35  OC_MODE_INTER_NOMV*/
+      {
+          283, 1950, 5762,10117,13224,15451,17646,19100,
+        20727,22145,23453,24656,25754,27193,28353,35975
+      },
+      /*Y'  qi=35  OC_MODE_INTER_MV*/
+      {
+          844, 2451, 5913, 9626,12510,14660,16515,18123,
+        19701,21247,22674,23967,25226,26414,27262,31919
+      },
+      /*Y'  qi=35  OC_MDOE_INTER_MV_LAST*/
+      {
+          382, 2231, 6009, 9917,12635,14735,16578,18278,
+        19878,21353,22739,24028,25283,26404,27470,31982
+      },
+      /*Y'  qi=35  OC_MODE_INTER_MV_LAST2*/
+      {
+          365, 2255, 5874, 9717,12987,15226,16938,18467,
+        19950,21410,22718,23931,24960,26059,26843,33397
+      },
+      /*Y'  qi=35  OC_MODE_INTER_MV_FOUR*/
+      {
+          409, 2309, 6040, 9758,12612,14845,16808,18496,
+        20104,21616,23017,24278,25453,26583,27627,31322
+      },
+      /*Y'  qi=35  OC_MODE_GOLDEN_NOMV*/
+      {
+          282, 1747, 5859, 9967,12329,13991,15483,16737,
+        18066,20613,21428,22237,22735,23543,24263,32395
+      },
+      /*Y'  qi=35  OC_MODE_GOLDEN_MV*/
+      {
+          515, 2368, 6005, 9803,12783,15051,17053,18894,
+        20482,21949,23337,24498,25657,26544,27593,31713
+      }
+    },
+    {
+      /*Cb  qi=35  OC_MODE_INTRA*/
+      {
+         2345, 7462,10863,13760,16182,17613,19023,20555,
+        22601,24482,26091,28037,29166,30336,31144,36295
+      },
+      /*Cb  qi=35  OC_MODE_INTER_NOMV*/
+      {
+          818, 2904, 8494,12298,14666,18428,37824,22192,
+        27782,25110,28008,28675,26830,33600,30790,37299
+      },
+      /*Cb  qi=35  OC_MODE_INTER_MV*/
+      {
+          893, 3985, 9830,13099,16901,20491,23119,25254,
+        27072,28097,29753,29447,31341,31784,34688,36574
+      },
+      /*Cb  qi=35  OC_MDOE_INTER_MV_LAST*/
+      {
+          691, 3622, 9810,13162,16937,20444,22547,23833,
+        24759,25378,25514,24989,24253,23974,24357,24725
+      },
+      /*Cb  qi=35  OC_MODE_INTER_MV_LAST2*/
+      {
+          906, 3399, 9752,12982,16154,19491,22183,25080,
+        26210,28690,31232,28511,30502,34784,36320,36584
+      },
+      /*Cb  qi=35  OC_MODE_INTER_MV_FOUR*/
+      {
+          750, 3524, 9265,12894,16342,19856,22639,25009,
+        26602,28513,28861,30193,32526,31565,35258,37068
+      },
+      /*Cb  qi=35  OC_MODE_GOLDEN_NOMV*/
+      {
+          873, 3149, 7497,10299,13388,15372,16155,16924,
+        18319,19959,20312,21663,20852,21771,21359,24477
+      },
+      /*Cb  qi=35  OC_MODE_GOLDEN_MV*/
+      {
+          808, 3931, 9892,13169,16205,18694,19170,19868,
+        19910,20369,20558,21148,21062,21655,21929,24773
+      }
+    },
+    {
+      /*Cr  qi=35  OC_MODE_INTRA*/
+      {
+         1270, 4720, 7683, 9903,11862,13564,15216,16896,
+        18577,19468,20308,21844,23147,23715,24872,28708
+      },
+      /*Cr  qi=35  OC_MODE_INTER_NOMV*/
+      {
+          393, 1352, 4497, 8673,11667,12576,23656,14957,
+        17280,11736, 7134,16939,10338, 8763, 9114, 5273
+      },
+      /*Cr  qi=35  OC_MODE_INTER_MV*/
+      {
+          450, 1926, 5501, 9780,12713,15004,16595,18209,
+        19201,20418,22188,21924,23574,23374,25170,25270
+      },
+      /*Cr  qi=35  OC_MDOE_INTER_MV_LAST*/
+      {
+          350, 1796, 5561, 9846,12848,14943,16628,16992,
+        16853,15353,14647,13609,13261,13588,14032,12704
+      },
+      /*Cr  qi=35  OC_MODE_INTER_MV_LAST2*/
+      {
+          428, 1902, 5128, 9101,11887,14311,15810,16457,
+        16755,15651,13750,13108,17206,22560,13067,18696
+      },
+      /*Cr  qi=35  OC_MODE_INTER_MV_FOUR*/
+      {
+          394, 1893, 5557, 9455,12337,14587,16561,18036,
+        19596,21233,22420,23050,24136,23837,27248,27160
+      },
+      /*Cr  qi=35  OC_MODE_GOLDEN_NOMV*/
+      {
+          453, 1774, 4420, 7725, 8626, 9449,10738,10604,
+        10652,11073,11578,11727,11891,12109,12618,13282
+      },
+      /*Cr  qi=35  OC_MODE_GOLDEN_MV*/
+      {
+          418, 2045, 5327, 9335,11088,12506,13472,12900,
+        13113,12528,12228,12573,12562,12778,12786,13110
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=36  OC_MODE_INTRA*/
+      {
+         1702, 4611, 8057,10498,12610,14355,15881,17070,
+        18657,20230,21398,22200,23251,24368,25298,31760
+      },
+      /*Y'  qi=36  OC_MODE_INTER_NOMV*/
+      {
+          320, 2413, 6692,11165,14215,16483,18594,20095,
+        21743,23257,24681,26075,27256,28351,29699,37722
+      },
+      /*Y'  qi=36  OC_MODE_INTER_MV*/
+      {
+          936, 3057, 6779,10630,13447,15609,17510,19220,
+        20881,22432,23890,25183,26459,27545,28629,33321
+      },
+      /*Y'  qi=36  OC_MDOE_INTER_MV_LAST*/
+      {
+          434, 2839, 6867,10853,13587,15707,17586,19340,
+        20961,22520,23934,25265,26544,27684,28770,33416
+      },
+      /*Y'  qi=36  OC_MODE_INTER_MV_LAST2*/
+      {
+          409, 2645, 6973,10888,13910,16103,17819,19426,
+        21024,22535,23957,25354,26345,27663,28583,34820
+      },
+      /*Y'  qi=36  OC_MODE_INTER_MV_FOUR*/
+      {
+          442, 2857, 6939,10719,13573,15818,17824,19573,
+        21230,22796,24253,25586,26828,27934,29025,32846
+      },
+      /*Y'  qi=36  OC_MODE_GOLDEN_NOMV*/
+      {
+          346, 2214, 6705,10866,13196,14903,16406,17651,
+        19258,21824,22560,23443,24053,24770,25836,33772
+      },
+      /*Y'  qi=36  OC_MODE_GOLDEN_MV*/
+      {
+          515, 2942, 6860,10758,13737,16020,18053,19937,
+        21566,23118,24515,25731,26977,27852,28847,33085
+      }
+    },
+    {
+      /*Cb  qi=36  OC_MODE_INTRA*/
+      {
+         2490, 7968,11475,14383,16826,18333,19705,21248,
+        23362,25250,26831,28753,29837,31069,31748,36691
+      },
+      /*Cb  qi=36  OC_MODE_INTER_NOMV*/
+      {
+          914, 3212, 9254,13193,15695,19072,38681,24362,
+        24781,28381,26732,24921,38048,33266,31820,38249
+      },
+      /*Cb  qi=36  OC_MODE_INTER_MV*/
+      {
+          915, 3954,10307,13875,17919,21550,24191,26187,
+        28066,29345,30558,31050,31588,33798,37904,35969
+      },
+      /*Cb  qi=36  OC_MDOE_INTER_MV_LAST*/
+      {
+          783, 4026,10500,13889,17680,21245,23410,24766,
+        25638,26132,26414,26378,24850,25092,25080,25349
+      },
+      /*Cb  qi=36  OC_MODE_INTER_MV_LAST2*/
+      {
+         1056, 4627,10563,13647,17028,20416,23252,25441,
+        26259,31854,30829,26947,31940,38632,29080,36458
+      },
+      /*Cb  qi=36  OC_MODE_INTER_MV_FOUR*/
+      {
+          847, 3919, 9956,13632,17085,20546,23465,25801,
+        27516,29565,31044,32328,33150,34350,37366,37726
+      },
+      /*Cb  qi=36  OC_MODE_GOLDEN_NOMV*/
+      {
+          977, 3488, 7952,10660,13708,16254,17146,17710,
+        19011,20908,21231,22156,21643,22437,22252,25296
+      },
+      /*Cb  qi=36  OC_MODE_GOLDEN_MV*/
+      {
+          920, 4337,10578,13865,16859,19309,19847,20511,
+        20451,21144,21599,21774,21879,22176,22801,25468
+      }
+    },
+    {
+      /*Cr  qi=36  OC_MODE_INTRA*/
+      {
+         1362, 5078, 8146,10426,12449,14199,15912,17627,
+        19342,20168,21098,22579,23837,24515,25705,29652
+      },
+      /*Cr  qi=36  OC_MODE_INTER_NOMV*/
+      {
+          456, 1550, 5028, 9427,12288,27456,13974,20724,
+        19887,10460, 6570,19904, 8339, 9050, 8451, 4815
+      },
+      /*Cr  qi=36  OC_MODE_INTER_MV*/
+      {
+          481, 2118, 6073,10425,13334,15531,17425,19006,
+        20457,21433,23840,23801,24102,24284,25173,28673
+      },
+      /*Cr  qi=36  OC_MDOE_INTER_MV_LAST*/
+      {
+          418, 2057, 6179,10504,13467,15645,17326,17639,
+        17500,16169,14816,14489,13673,14268,14300,13171
+      },
+      /*Cr  qi=36  OC_MODE_INTER_MV_LAST2*/
+      {
+          525, 2148, 5624, 9855,12736,14935,16764,17196,
+        18050,15446,13619,13409,18035,23367,16698,20958
+      },
+      /*Cr  qi=36  OC_MODE_INTER_MV_FOUR*/
+      {
+          466, 2150, 6127,10080,12966,15267,17227,18852,
+        20353,22243,23709,23733,24629,26269,24783,28448
+      },
+      /*Cr  qi=36  OC_MODE_GOLDEN_NOMV*/
+      {
+          522, 1979, 4863, 7994, 9073, 9912,11102,11206,
+        11325,11684,12092,12139,12558,12698,13676,14009
+      },
+      /*Cr  qi=36  OC_MODE_GOLDEN_MV*/
+      {
+          497, 2297, 5932, 9919,11696,13199,13998,13671,
+        13402,13416,12800,13293,13020,13286,13004,13686
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=37  OC_MODE_INTRA*/
+      {
+         1773, 4793, 8348,10782,12907,14693,16240,17459,
+        19060,20655,21844,22647,23698,24833,25778,32371
+      },
+      /*Y'  qi=37  OC_MODE_INTER_NOMV*/
+      {
+          332, 2591, 7102,11643,14633,16952,19029,20643,
+        22356,23868,25168,26574,27742,28990,30392,38749
+      },
+      /*Y'  qi=37  OC_MODE_INTER_MV*/
+      {
+          981, 3307, 7131,11019,13877,16046,17967,19689,
+        21371,22964,24470,25753,27023,28229,29349,33999
+      },
+      /*Y'  qi=37  OC_MDOE_INTER_MV_LAST*/
+      {
+          434, 3022, 7222,11273,14023,16169,18062,19835,
+        21493,23055,24509,25867,27143,28341,29417,34118
+      },
+      /*Y'  qi=37  OC_MODE_INTER_MV_LAST2*/
+      {
+          436, 3099, 7189,11329,14443,16617,18359,19912,
+        21489,23030,24530,25895,27121,28629,28935,35662
+      },
+      /*Y'  qi=37  OC_MODE_INTER_MV_FOUR*/
+      {
+          450, 2985, 7240,11091,13991,16269,18291,20057,
+        21742,23332,24825,26171,27431,28562,29669,33520
+      },
+      /*Y'  qi=37  OC_MODE_GOLDEN_NOMV*/
+      {
+          358, 2348, 7010,11218,13557,15315,16704,18026,
+        19881,22355,23135,24054,24572,25413,26583,34456
+      },
+      /*Y'  qi=37  OC_MODE_GOLDEN_MV*/
+      {
+          521, 3112, 7194,11182,14208,16493,18553,20447,
+        22129,23671,25163,26336,27629,28443,29589,33805
+      }
+    },
+    {
+      /*Cb  qi=37  OC_MODE_INTRA*/
+      {
+         2659, 8440,12038,14942,17406,18924,20344,21923,
+        23959,25928,27582,29513,30605,31906,32528,37697
+      },
+      /*Cb  qi=37  OC_MODE_INTER_NOMV*/
+      {
+         1009, 3538, 9812,13792,16205,19915,40064,24199,
+        23807,26456,26257,28297,32510,38357,31614,41967
+      },
+      /*Cb  qi=37  OC_MODE_INTER_MV*/
+      {
+         1044, 4398,11032,14515,18618,22199,24927,27037,
+        28765,30031,30921,32370,32313,34698,35887,38480
+      },
+      /*Cb  qi=37  OC_MDOE_INTER_MV_LAST*/
+      {
+          869, 4359,11138,14563,18353,21922,24113,25512,
+        26406,27018,27228,26883,26161,25696,26038,26168
+      },
+      /*Cb  qi=37  OC_MODE_INTER_MV_LAST2*/
+      {
+         1282, 4577,11219,14404,17663,20877,24029,27649,
+        29896,29600,32588,28234,31853,35712,35205,36756
+      },
+      /*Cb  qi=37  OC_MODE_INTER_MV_FOUR*/
+      {
+          937, 4262,10543,14284,17738,21275,24290,26534,
+        28474,30672,31537,33390,35441,34814,37823,39286
+      },
+      /*Cb  qi=37  OC_MODE_GOLDEN_NOMV*/
+      {
+         1075, 3762, 8373,11099,14114,17044,17644,18435,
+        19879,21520,22194,22964,22662,23255,23118,26197
+      },
+      /*Cb  qi=37  OC_MODE_GOLDEN_MV*/
+      {
+         1026, 4706,11205,14538,17525,20036,20503,21135,
+        21215,21993,21842,22474,22910,23312,23452,26374
+      }
+    },
+    {
+      /*Cr  qi=37  OC_MODE_INTRA*/
+      {
+         1432, 5371, 8566,10917,12994,14787,16530,18303,
+        20033,20893,21837,23432,24622,25225,26572,30616
+      },
+      /*Cr  qi=37  OC_MODE_INTER_NOMV*/
+      {
+          500, 1749, 5597, 9930,12678,13568,17523,16407,
+        20168,10593, 6083, 5331, 9274,11442, 7366, 5114
+      },
+      /*Cr  qi=37  OC_MODE_INTER_MV*/
+      {
+          551, 2384, 6662,11070,13972,16278,18142,19617,
+        21157,22068,23878,22642,24641,24970,25715,28421
+      },
+      /*Cr  qi=37  OC_MDOE_INTER_MV_LAST*/
+      {
+          467, 2280, 6832,11183,14131,16310,18030,18298,
+        18103,16599,15900,14960,14516,14745,15392,13989
+      },
+      /*Cr  qi=37  OC_MODE_INTER_MV_LAST2*/
+      {
+          574, 2433, 6157,10507,13344,15426,17230,17962,
+        18454,15943,16044,18763,20106,23248,21261,22400
+      },
+      /*Cr  qi=37  OC_MODE_INTER_MV_FOUR*/
+      {
+          518, 2375, 6672,10730,13646,15962,17766,19530,
+        21122,22952,24138,24743,25315,27140,27714,29582
+      },
+      /*Cr  qi=37  OC_MODE_GOLDEN_NOMV*/
+      {
+          569, 2140, 5242, 8578, 9574,10373,11763,11754,
+        12039,12084,12665,12853,13143,13320,14246,14533
+      },
+      /*Cr  qi=37  OC_MODE_GOLDEN_MV*/
+      {
+          551, 2517, 6475,10536,12300,13678,14539,14175,
+        13858,13973,13159,13819,13865,13993,13919,14094
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=38  OC_MODE_INTRA*/
+      {
+         1780, 4787, 8358,10794,12920,14714,16268,17499,
+        19104,20688,21860,22682,23727,24862,25815,32553
+      },
+      /*Y'  qi=38  OC_MODE_INTER_NOMV*/
+      {
+          342, 2609, 7140,11667,14642,17052,19036,20740,
+        22348,23839,25144,26372,27581,28719,29624,35794
+      },
+      /*Y'  qi=38  OC_MODE_INTER_MV*/
+      {
+          939, 3319, 7312,11158,13892,16047,17913,19673,
+        21326,22908,24383,25754,27033,28250,29349,34167
+      },
+      /*Y'  qi=38  OC_MDOE_INTER_MV_LAST*/
+      {
+          456, 3027, 7161,11272,14139,16268,18125,19866,
+        21454,22992,24399,25721,26949,28066,29056,33460
+      },
+      /*Y'  qi=38  OC_MODE_INTER_MV_LAST2*/
+      {
+          434, 2879, 7058,11250,14451,16605,18371,20003,
+        21623,23289,24809,26324,27671,28764,29772,35577
+      },
+      /*Y'  qi=38  OC_MODE_INTER_MV_FOUR*/
+      {
+          462, 3025, 7258,11097,14027,16354,18380,20184,
+        21873,23494,25003,26306,27594,28761,29790,33817
+      },
+      /*Y'  qi=38  OC_MODE_GOLDEN_NOMV*/
+      {
+          367, 2362, 7048,11210,13553,15325,16824,18346,
+        20279,22469,23175,24149,24750,25560,26500,34695
+      },
+      /*Y'  qi=38  OC_MODE_GOLDEN_MV*/
+      {
+          555, 3121, 7188,11197,14207,16524,18585,20482,
+        22156,23720,25154,26354,27661,28449,29593,34097
+      }
+    },
+    {
+      /*Cb  qi=38  OC_MODE_INTRA*/
+      {
+         2666, 8449,12054,14964,17429,18983,20381,22022,
+        24036,25951,27588,29657,30790,32078,32745,37862
+      },
+      /*Cb  qi=38  OC_MODE_INTER_NOMV*/
+      {
+         1013, 3554,10046,14169,17179,20775,22118,22709,
+        23700,24324,24802,24798,25513,25419,25415,27056
+      },
+      /*Cb  qi=38  OC_MODE_INTER_MV*/
+      {
+          867, 4420,11094,14679,18684,22431,25018,27300,
+        29071,30664,31949,32791,34233,37183,37472,40515
+      },
+      /*Cb  qi=38  OC_MDOE_INTER_MV_LAST*/
+      {
+          940, 4359,11066,14404,18148,21853,24363,26499,
+        28365,29695,30986,32363,32948,34688,33750,34766
+      },
+      /*Cb  qi=38  OC_MODE_INTER_MV_LAST2*/
+      {
+         1174, 4106,11234,14391,17575,21028,23729,25745,
+        27456,30292,30826,30816,32680,37485,38400,38747
+      },
+      /*Cb  qi=38  OC_MODE_INTER_MV_FOUR*/
+      {
+          947, 4246,10536,14286,17746,21208,24110,26399,
+        28481,30643,31948,33409,34971,36921,35573,40561
+      },
+      /*Cb  qi=38  OC_MODE_GOLDEN_NOMV*/
+      {
+         1078, 3767, 8290,11083,14016,16904,17482,18364,
+        19862,21172,22382,23252,22819,23459,23545,27513
+      },
+      /*Cb  qi=38  OC_MODE_GOLDEN_MV*/
+      {
+         1024, 4693,11191,14533,17553,20053,20623,21346,
+        21424,22175,22267,22520,23166,23562,24059,28088
+      }
+    },
+    {
+      /*Cr  qi=38  OC_MODE_INTRA*/
+      {
+         1434, 5382, 8585,10944,13026,14826,16571,18337,
+        20098,20999,21924,23497,24663,25287,26709,30626
+      },
+      /*Cr  qi=38  OC_MODE_INTER_NOMV*/
+      {
+          510, 1769, 5661,10404,12676,14317,15186,15319,
+        14562,14187,14056,13703,14226,14489,14606,11470
+      },
+      /*Cr  qi=38  OC_MODE_INTER_MV*/
+      {
+          467, 2273, 6875,11323,14359,16820,17105,20802,
+        22009,22808,23671,23620,24123,26468,26129,28914
+      },
+      /*Cr  qi=38  OC_MDOE_INTER_MV_LAST*/
+      {
+          507, 2362, 6656,10824,14032,16657,19213,20866,
+        21477,22286,21873,24563,26229,24029,22848,27272
+      },
+      /*Cr  qi=38  OC_MODE_INTER_MV_LAST2*/
+      {
+          577, 2339, 6328,10706,13570,15634,18054,19472,
+        20027,19226,14586,21056,21841,23237,25527,19373
+      },
+      /*Cr  qi=38  OC_MODE_INTER_MV_FOUR*/
+      {
+          528, 2377, 6675,10769,13704,16014,17908,19643,
+        21269,22785,23695,24873,26008,26659,27755,30604
+      },
+      /*Cr  qi=38  OC_MODE_GOLDEN_NOMV*/
+      {
+          576, 2137, 5248, 8493, 9344,10127,11612,11551,
+        12070,12507,13051,13345,13793,13835,14850,14813
+      },
+      /*Cr  qi=38  OC_MODE_GOLDEN_MV*/
+      {
+          554, 2521, 6463,10561,12244,13758,14626,14545,
+        14174,14362,13644,14244,14300,14563,14791,14924
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=39  OC_MODE_INTRA*/
+      {
+         2040, 5409, 9045,11481,13665,15488,17061,18308,
+        19940,21534,22732,23541,24609,25730,26706,33653
+      },
+      /*Y'  qi=39  OC_MODE_INTER_NOMV*/
+      {
+          424, 3075, 7962,12505,15545,17948,19988,21765,
+        23465,24855,26305,27499,28821,29855,30730,36949
+      },
+      /*Y'  qi=39  OC_MODE_INTER_MV*/
+      {
+         1030, 3576, 8075,11879,14752,16947,18851,20636,
+        22287,23812,25247,26554,27820,28949,30005,34637
+      },
+      /*Y'  qi=39  OC_MDOE_INTER_MV_LAST*/
+      {
+          648, 3826, 8009,12039,14832,17046,19011,20830,
+        22542,24152,25690,27100,28439,29747,30846,35948
+      },
+      /*Y'  qi=39  OC_MODE_INTER_MV_LAST2*/
+      {
+          474, 3682, 8195,12161,15254,17426,19174,20862,
+        22644,24317,25936,27276,28797,29943,30982,37328
+      },
+      /*Y'  qi=39  OC_MODE_INTER_MV_FOUR*/
+      {
+          490, 3394, 7907,11916,14792,17071,19081,20911,
+        22665,24339,25897,27299,28587,29751,30831,35080
+      },
+      /*Y'  qi=39  OC_MODE_GOLDEN_NOMV*/
+      {
+          434, 2838, 7848,11973,14309,16029,17741,19707,
+        21746,23362,24191,25223,25575,26558,27084,35875
+      },
+      /*Y'  qi=39  OC_MODE_GOLDEN_MV*/
+      {
+          596, 3647, 7968,12008,15039,17372,19448,21378,
+        23124,24728,26167,27461,28701,29526,30676,35244
+      }
+    },
+    {
+      /*Cb  qi=39  OC_MODE_INTRA*/
+      {
+         2895, 9021,12711,15632,18165,19750,21157,22822,
+        24894,26818,28610,30619,31742,33119,33922,38896
+      },
+      /*Cb  qi=39  OC_MODE_INTER_NOMV*/
+      {
+         1161, 3947,10709,14904,17739,21606,22695,23431,
+        24346,25125,25646,26059,26171,26802,26659,28101
+      },
+      /*Cb  qi=39  OC_MODE_INTER_MV*/
+      {
+          824, 5699,11598,15619,19439,23267,26217,28322,
+        30048,31842,33247,33628,35743,37755,40397,41728
+      },
+      /*Cb  qi=39  OC_MDOE_INTER_MV_LAST*/
+      {
+         1199, 5248,11993,15269,19061,22851,25388,27113,
+        29063,29267,30172,32132,30855,31186,31736,36850
+      },
+      /*Cb  qi=39  OC_MODE_INTER_MV_LAST2*/
+      {
+         1642, 6008,12049,15169,18533,21925,24632,26863,
+        28245,29947,31311,30986,37035,37490,34728,36826
+      },
+      /*Cb  qi=39  OC_MODE_INTER_MV_FOUR*/
+      {
+         1062, 4578,11252,15058,18676,22272,25211,27447,
+        29643,31945,33535,34562,36212,37567,39779,41733
+      },
+      /*Cb  qi=39  OC_MODE_GOLDEN_NOMV*/
+      {
+         1206, 4124, 8845,11727,14661,17338,18275,19049,
+        20763,22258,23314,24051,23687,24019,24501,28684
+      },
+      /*Cb  qi=39  OC_MODE_GOLDEN_MV*/
+      {
+         1143, 5233,11913,15297,18415,20768,21547,22170,
+        22160,23156,23593,23687,23735,24514,24906,29422
+      }
+    },
+    {
+      /*Cr  qi=39  OC_MODE_INTRA*/
+      {
+         1535, 5715, 9029,11467,13608,15435,17196,19030,
+        20816,21665,22642,24243,25528,25960,27597,31649
+      },
+      /*Cr  qi=39  OC_MODE_INTER_NOMV*/
+      {
+          570, 1980, 6288,10894,13144,14779,15734,15795,
+        15429,14610,13874,13794,14890,15205,14360,12310
+      },
+      /*Cr  qi=39  OC_MODE_INTER_MV*/
+      {
+          382, 2857, 7633,11397,14037,16661,18251,20920,
+        22186,24017,25123,25437,26311,27558,26652,27651
+      },
+      /*Cr  qi=39  OC_MDOE_INTER_MV_LAST*/
+      {
+          618, 2579, 7266,11938,15030,17355,19288,21044,
+        22112,22919,22417,24682,24441,26109,23595,22893
+      },
+      /*Cr  qi=39  OC_MODE_INTER_MV_LAST2*/
+      {
+          749, 2671, 6790,11528,14599,16887,18734,20240,
+        21047,18794,17830,20189,16552,13545,13577, 7731
+      },
+      /*Cr  qi=39  OC_MODE_INTER_MV_FOUR*/
+      {
+          560, 2577, 7241,11512,14495,16777,18730,20453,
+        21955,23438,25158,25914,25885,27454,28770,30897
+      },
+      /*Cr  qi=39  OC_MODE_GOLDEN_NOMV*/
+      {
+          627, 2344, 5711, 9022, 9790,10406,12218,12259,
+        12644,12963,13541,14098,14394,14547,15539,15486
+      },
+      /*Cr  qi=39  OC_MODE_GOLDEN_MV*/
+      {
+          598, 2804, 7070,11127,12870,14222,15418,14768,
+        15145,14787,14233,14690,14863,15279,15563,15533
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=40  OC_MODE_INTRA*/
+      {
+         2342, 5977, 9711,12109,14324,16168,17795,19071,
+        20719,22345,23553,24359,25464,26617,27626,34620
+      },
+      /*Y'  qi=40  OC_MODE_INTER_NOMV*/
+      {
+          519, 3574, 8803,13354,16341,18804,20780,22654,
+        24411,25958,27471,28780,30162,31481,32916,41493
+      },
+      /*Y'  qi=40  OC_MODE_INTER_MV*/
+      {
+         1367, 4344, 8889,12678,15705,17849,19649,21428,
+        23242,24984,26569,28073,29382,30566,31630,36393
+      },
+      /*Y'  qi=40  OC_MDOE_INTER_MV_LAST*/
+      {
+          734, 4406, 8792,12823,15607,17836,19853,21731,
+        23490,25126,26648,28068,29399,30579,31661,36372
+      },
+      /*Y'  qi=40  OC_MODE_INTER_MV_LAST2*/
+      {
+          636, 4483, 8878,12973,15960,18107,19967,21739,
+        23424,25056,26520,27887,29103,30290,31026,37164
+      },
+      /*Y'  qi=40  OC_MODE_INTER_MV_FOUR*/
+      {
+          540, 3861, 8618,12693,15594,17928,19980,21855,
+        23623,25291,26833,28229,29525,30712,31804,35862
+      },
+      /*Y'  qi=40  OC_MODE_GOLDEN_NOMV*/
+      {
+          481, 3258, 8642,12666,15081,16694,18737,20830,
+        22774,24223,25420,26055,26738,27476,28189,36767
+      },
+      /*Y'  qi=40  OC_MODE_GOLDEN_MV*/
+      {
+          647, 4106, 8693,12785,15872,18212,20329,22321,
+        24111,25726,27267,28514,29880,30676,31809,36072
+      }
+    },
+    {
+      /*Cb  qi=40  OC_MODE_INTRA*/
+      {
+         3256, 9823,13541,16511,19100,20670,22078,23745,
+        25879,27898,29715,31600,32809,34363,35093,40240
+      },
+      /*Cb  qi=40  OC_MODE_INTER_NOMV*/
+      {
+         1404, 4535,11191,14847,17779,21889,46198,42837,
+        31627,36224,27226,32523,34227,39467,35533,42171
+      },
+      /*Cb  qi=40  OC_MODE_INTER_MV*/
+      {
+         1941, 7008,12828,15885,19800,23664,26443,28705,
+        31799,32440,34658,36059,33980,39025,40661,41043
+      },
+      /*Cb  qi=40  OC_MDOE_INTER_MV_LAST*/
+      {
+         1196, 6039,12961,16227,20080,23894,26241,27612,
+        28647,29320,29375,29227,28008,28378,28144,28532
+      },
+      /*Cb  qi=40  OC_MODE_INTER_MV_LAST2*/
+      {
+         1866, 7063,12939,15825,19335,23397,26214,28577,
+        30055,30885,32518,34647,34015,39790,41742,44557
+      },
+      /*Cb  qi=40  OC_MODE_INTER_MV_FOUR*/
+      {
+         1265, 5166,12171,15951,19671,23461,26512,28904,
+        31169,33416,34605,35550,37627,38229,40115,42375
+      },
+      /*Cb  qi=40  OC_MODE_GOLDEN_NOMV*/
+      {
+         1403, 4628, 9511,12637,15437,18384,19542,19958,
+        21642,22969,24320,24537,24888,24758,24785,28312
+      },
+      /*Cb  qi=40  OC_MODE_GOLDEN_MV*/
+      {
+         1412, 5912,12872,16034,19063,21539,22443,22915,
+        23169,23954,24073,24297,24757,25573,25288,28562
+      }
+    },
+    {
+      /*Cr  qi=40  OC_MODE_INTRA*/
+      {
+         1690, 6153, 9563,12070,14269,16140,17969,19855,
+        21592,22490,23518,25137,26324,26930,28478,32738
+      },
+      /*Cr  qi=40  OC_MODE_INTER_NOMV*/
+      {
+          661, 2308, 6980,11382,14192,31265,34645,19090,
+        16926, 9416, 6264, 6193,12105,13241, 9378, 5669
+      },
+      /*Cr  qi=40  OC_MODE_INTER_MV*/
+      {
+          851, 3289, 8153,12568,15503,17939,19900,21913,
+        23866,25018,25727,26359,26499,27061,29078,30341
+      },
+      /*Cr  qi=40  OC_MDOE_INTER_MV_LAST*/
+      {
+          628, 2965, 8111,12625,15563,17804,19531,19701,
+        19343,18022,16895,16131,15829,16270,16634,15220
+      },
+      /*Cr  qi=40  OC_MODE_INTER_MV_LAST2*/
+      {
+          895, 3289, 7713,11529,15158,17760,19844,19920,
+        20837,17224,17246,18736,24057,26528,24432,23040
+      },
+      /*Cr  qi=40  OC_MODE_INTER_MV_FOUR*/
+      {
+          643, 2956, 8016,12245,15206,17547,19437,21151,
+        22734,24642,25752,26768,26977,29984,29090,32541
+      },
+      /*Cr  qi=40  OC_MODE_GOLDEN_NOMV*/
+      {
+          714, 2628, 6305, 9566,10721,11382,12923,12865,
+        12917,13444,13707,13830,14351,14547,15373,15925
+      },
+      /*Cr  qi=40  OC_MODE_GOLDEN_MV*/
+      {
+          703, 3234, 7831,11886,13543,14956,15779,15109,
+        15616,14980,14432,14689,14823,15136,15172,15408
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=41  OC_MODE_INTRA*/
+      {
+         2358, 6008, 9721,12128,14342,16190,17808,19086,
+        20738,22357,23553,24372,25476,26625,27634,34626
+      },
+      /*Y'  qi=41  OC_MODE_INTER_NOMV*/
+      {
+          521, 3603, 8830,13360,16355,18843,20791,22690,
+        24437,25885,27450,28706,30286,31491,32638,39675
+      },
+      /*Y'  qi=41  OC_MODE_INTER_MV*/
+      {
+         1434, 4383, 8862,12754,15809,17906,19709,21487,
+        23246,24973,26549,27990,29335,30483,31695,36372
+      },
+      /*Y'  qi=41  OC_MDOE_INTER_MV_LAST*/
+      {
+          664, 4424, 8808,12838,15631,17866,19871,21752,
+        23500,25114,26647,28068,29376,30597,31658,36410
+      },
+      /*Y'  qi=41  OC_MODE_INTER_MV_LAST2*/
+      {
+          685, 4276, 8939,12994,15981,18122,19962,21716,
+        23438,25033,26568,27913,29224,30479,31405,38314
+      },
+      /*Y'  qi=41  OC_MODE_INTER_MV_FOUR*/
+      {
+          556, 3890, 8643,12709,15604,17941,19992,21866,
+        23643,25300,26851,28254,29542,30738,31839,35913
+      },
+      /*Y'  qi=41  OC_MODE_GOLDEN_NOMV*/
+      {
+          501, 3227, 8667,12650,15062,16677,19010,21061,
+        22469,24046,25273,25838,26570,27455,28205,36788
+      },
+      /*Y'  qi=41  OC_MODE_GOLDEN_MV*/
+      {
+          658, 4127, 8695,12832,15905,18239,20360,22344,
+        24128,25780,27290,28558,29887,30688,31841,36096
+      }
+    },
+    {
+      /*Cb  qi=41  OC_MODE_INTRA*/
+      {
+         3255, 9838,13547,16532,19103,20683,22104,23761,
+        25868,27936,29686,31656,32837,34355,35046,40326
+      },
+      /*Cb  qi=41  OC_MODE_INTER_NOMV*/
+      {
+         1406, 4542,11200,14870,18056,22235,25921,42197,
+        29939,31322,30853,31666,29306,32985,34389,36448
+      },
+      /*Cb  qi=41  OC_MODE_INTER_MV*/
+      {
+         2099, 6965,12894,15821,19499,23392,26542,28581,
+        30933,32632,34378,36295,34347,37589,40389,41283
+      },
+      /*Cb  qi=41  OC_MDOE_INTER_MV_LAST*/
+      {
+         1220, 5965,12958,16269,20140,23903,26244,27587,
+        28749,29184,29564,29250,28078,28130,28362,28658
+      },
+      /*Cb  qi=41  OC_MODE_INTER_MV_LAST2*/
+      {
+         1833, 6945,12944,15848,19480,23356,26169,28784,
+        30395,31125,32407,32960,32937,37927,41960,42604
+      },
+      /*Cb  qi=41  OC_MODE_INTER_MV_FOUR*/
+      {
+         1271, 5160,12172,15966,19661,23438,26514,29078,
+        31015,33158,35136,35464,36675,38457,41130,43101
+      },
+      /*Cb  qi=41  OC_MODE_GOLDEN_NOMV*/
+      {
+         1404, 4636, 9492,12552,15372,18466,19364,19940,
+        21649,23104,24388,24609,24679,24806,24793,28303
+      },
+      /*Cb  qi=41  OC_MODE_GOLDEN_MV*/
+      {
+         1436, 5925,12890,16053,19039,21621,22369,22910,
+        23179,24020,24137,23954,24770,25544,25352,28491
+      }
+    },
+    {
+      /*Cr  qi=41  OC_MODE_INTRA*/
+      {
+         1692, 6159, 9566,12069,14275,16147,17972,19868,
+        21594,22503,23519,25148,26339,26892,28541,32725
+      },
+      /*Cr  qi=41  OC_MODE_INTER_NOMV*/
+      {
+          667, 2310, 7004,11719,14203,15678,34133,21660,
+        23152,19744,27520,20718,22343,13273,24704,29632
+      },
+      /*Cr  qi=41  OC_MODE_INTER_MV*/
+      {
+          891, 3340, 8048,12251,15370,17950,19889,20924,
+        23493,25438,25919,25142,26974,27360,28713,30505
+      },
+      /*Cr  qi=41  OC_MDOE_INTER_MV_LAST*/
+      {
+          633, 2950, 8155,12640,15585,17833,19522,19711,
+        19422,17589,16333,15469,15297,16050,16467,15119
+      },
+      /*Cr  qi=41  OC_MODE_INTER_MV_LAST2*/
+      {
+          895, 3269, 7721,11915,15309,17932,19744,19732,
+        20625,16588,13248,12098,29816,16070,12425, 6903
+      },
+      /*Cr  qi=41  OC_MODE_INTER_MV_FOUR*/
+      {
+          649, 2963, 8016,12261,15228,17531,19495,21120,
+        22915,25016,26001,26396,26625,29002,28904,31729
+      },
+      /*Cr  qi=41  OC_MODE_GOLDEN_NOMV*/
+      {
+          718, 2630, 6300, 9588,10684,11451,13023,12811,
+        13131,13355,13686,13821,14336,14517,15427,15792
+      },
+      /*Cr  qi=41  OC_MODE_GOLDEN_MV*/
+      {
+          701, 3240, 7857,11882,13586,14997,15665,15093,
+        15685,14894,14592,14811,14861,15211,15191,15360
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=42  OC_MODE_INTRA*/
+      {
+         2806, 6525,10485,12867,15118,17010,18698,20006,
+        21689,23322,24553,25357,26478,27627,28642,36098
+      },
+      /*Y'  qi=42  OC_MODE_INTER_NOMV*/
+      {
+          703, 4197, 9738,14276,17287,19785,21780,23689,
+        25480,27102,28640,30060,31484,32881,34176,42571
+      },
+      /*Y'  qi=42  OC_MODE_INTER_MV*/
+      {
+         1269, 4860, 9725,13600,16540,18793,20819,22663,
+        24386,25978,27453,28763,30039,31181,32211,36260
+      },
+      /*Y'  qi=42  OC_MDOE_INTER_MV_LAST*/
+      {
+          994, 5296, 9634,13687,16495,18772,20821,22746,
+        24539,26264,27878,29424,30846,31970,33088,37818
+      },
+      /*Y'  qi=42  OC_MODE_INTER_MV_LAST2*/
+      {
+          669, 5332, 9882,13990,16996,19204,21118,22875,
+        24595,26238,27775,29121,30369,32080,32939,39043
+      },
+      /*Y'  qi=42  OC_MODE_INTER_MV_FOUR*/
+      {
+          532, 4443, 9521,13594,16527,18914,21038,22968,
+        24824,26561,28132,29516,30827,31998,33065,37286
+      },
+      /*Y'  qi=42  OC_MODE_GOLDEN_NOMV*/
+      {
+          719, 3923, 9612,13507,15901,17442,19883,22061,
+        23593,24935,26106,26891,27542,28521,29223,38236
+      },
+      /*Y'  qi=42  OC_MODE_GOLDEN_MV*/
+      {
+          795, 4748, 9561,13751,16824,19187,21340,23343,
+        25221,26887,28397,29754,31098,32038,33474,37633
+      }
+    },
+    {
+      /*Cb  qi=42  OC_MODE_INTRA*/
+      {
+         3721,10681,14557,17677,20357,21933,23358,25054,
+        27265,29385,31188,33213,34498,36041,37026,42516
+      },
+      /*Cb  qi=42  OC_MODE_INTER_NOMV*/
+      {
+         1682, 5274,12603,16125,18965,22689,49664,39296,
+        33237,29529,31915,31760,36318,40304,36296,45239
+      },
+      /*Cb  qi=42  OC_MODE_INTER_MV*/
+      {
+         1056, 7345,13853,17711,21564,25614,28764,31146,
+        33377,35114,36673,37350,39041,41533,41871,44977
+      },
+      /*Cb  qi=42  OC_MDOE_INTER_MV_LAST*/
+      {
+         2316, 6853,14024,17273,21343,25353,27722,29400,
+        30505,31099,31053,31164,30464,30433,29806,30618
+      },
+      /*Cb  qi=42  OC_MODE_INTER_MV_LAST2*/
+      {
+         2413, 8215,14039,16931,20467,24379,27489,29589,
+        32602,32806,32368,33133,36089,43232,39334,40921
+      },
+      /*Cb  qi=42  OC_MODE_INTER_MV_FOUR*/
+      {
+         1453, 5889,13236,16958,20795,24702,28085,30440,
+        32845,35205,36611,37657,39740,39846,44547,44641
+      },
+      /*Cb  qi=42  OC_MODE_GOLDEN_NOMV*/
+      {
+         1765, 5358,10489,13487,16487,20068,20874,21438,
+        23180,24745,25849,26805,26138,27015,26655,30344
+      },
+      /*Cb  qi=42  OC_MODE_GOLDEN_MV*/
+      {
+         1707, 6730,13959,17098,20134,23087,25304,25888,
+        26532,26118,28409,26615,27337,28471,29994,30417
+      }
+    },
+    {
+      /*Cr  qi=42  OC_MODE_INTRA*/
+      {
+         1783, 6652,10214,12804,15080,17008,18885,20849,
+        22588,23582,24559,26226,27579,28137,29779,34190
+      },
+      /*Cr  qi=42  OC_MODE_INTER_NOMV*/
+      {
+          786, 2687, 7745,12064,14811,33231,32068,18275,
+        18297,12672, 7174, 6558,12558,11687,10283, 6356
+      },
+      /*Cr  qi=42  OC_MODE_INTER_MV*/
+      {
+          507, 3606, 9278,12984,15313,17857,20335,22273,
+        25646,26739,25877,27635,26516,29914,28594,30124
+      },
+      /*Cr  qi=42  OC_MDOE_INTER_MV_LAST*/
+      {
+          978, 3457, 8960,13774,16794,18966,20693,20880,
+        20640,19003,17924,17064,16934,17737,18049,16160
+      },
+      /*Cr  qi=42  OC_MODE_INTER_MV_LAST2*/
+      {
+         1095, 3753, 8358,12912,16423,19013,20558,21167,
+        21698,18408,17924,19372,25792,28896,23947,27675
+      },
+      /*Cr  qi=42  OC_MODE_INTER_MV_FOUR*/
+      {
+          746, 3378, 8757,13083,16157,18559,20512,22288,
+        24157,26012,26540,27849,27933,30219,30296,33172
+      },
+      /*Cr  qi=42  OC_MODE_GOLDEN_NOMV*/
+      {
+          913, 3044, 7018,10221,11253,12283,13750,13744,
+        14001,13822,14863,15038,15396,16272,16736,17450
+      },
+      /*Cr  qi=42  OC_MODE_GOLDEN_MV*/
+      {
+          839, 3717, 8666,12972,15255,16522,18611,18345,
+        18375,16574,15247,15977,16319,18232,17594,20370
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=43  OC_MODE_INTRA*/
+      {
+         3289, 7190,11308,13678,15948,17875,19595,20968,
+        22674,24337,25596,26402,27552,28744,29761,37437
+      },
+      /*Y'  qi=43  OC_MODE_INTER_NOMV*/
+      {
+          920, 4885,10742,15198,18260,20802,22898,24823,
+        26750,28425,29898,31528,32807,34000,35441,43432
+      },
+      /*Y'  qi=43  OC_MODE_INTER_MV*/
+      {
+         1444, 5464,10577,14543,17567,19922,22016,23917,
+        25650,27229,28692,30015,31227,32344,33358,37112
+      },
+      /*Y'  qi=43  OC_MDOE_INTER_MV_LAST*/
+      {
+         1596, 6088,10589,14660,17474,19763,21888,23870,
+        25745,27474,29134,30643,32055,33255,34450,39096
+      },
+      /*Y'  qi=43  OC_MODE_INTER_MV_LAST2*/
+      {
+          889, 6113,10805,14945,17973,20236,22221,24090,
+        25927,27645,29263,30714,32042,33505,34374,40119
+      },
+      /*Y'  qi=43  OC_MODE_INTER_MV_FOUR*/
+      {
+          610, 5018,10423,14524,17556,20010,22163,24125,
+        25975,27714,29305,30718,32030,33224,34310,38588
+      },
+      /*Y'  qi=43  OC_MODE_GOLDEN_NOMV*/
+      {
+          989, 4622,10601,14290,16652,18176,20942,23072,
+        24598,26249,27263,28263,28790,30047,30751,39354
+      },
+      /*Y'  qi=43  OC_MODE_GOLDEN_MV*/
+      {
+          936, 5259,10456,14775,17863,20307,22546,24590,
+        26475,28205,29665,30865,32128,32991,33963,38590
+      }
+    },
+    {
+      /*Cb  qi=43  OC_MODE_INTRA*/
+      {
+         3964,11162,15101,18273,20994,22585,23965,25683,
+        27901,30083,31877,33987,35176,36670,37782,43478
+      },
+      /*Cb  qi=43  OC_MODE_INTER_NOMV*/
+      {
+         1857, 5699,13165,16796,20112,23867,42634,27893,
+        31641,29870,32895,33651,34475,38438,38218,45563
+      },
+      /*Cb  qi=43  OC_MODE_INTER_MV*/
+      {
+         1173, 7972,14315,18055,21768,25955,29360,31582,
+        33297,35717,37523,38787,38302,42543,46508,46181
+      },
+      /*Cb  qi=43  OC_MDOE_INTER_MV_LAST*/
+      {
+         2514, 7581,14648,17897,22094,26197,28700,30278,
+        31283,31683,31803,31740,31196,30213,30693,31046
+      },
+      /*Cb  qi=43  OC_MODE_INTER_MV_LAST2*/
+      {
+         2608, 8727,14634,17555,21147,25209,28124,30664,
+        32413,32722,32947,33898,35312,40505,44275,40899
+      },
+      /*Cb  qi=43  OC_MODE_INTER_MV_FOUR*/
+      {
+         1552, 6326,13866,17635,21637,25633,28931,31619,
+        34457,36461,38180,39796,40973,42336,45427,45612
+      },
+      /*Cb  qi=43  OC_MODE_GOLDEN_NOMV*/
+      {
+         2018, 5733,10777,13637,16966,20475,21357,22113,
+        23806,25481,26490,27254,26495,27089,27029,30628
+      },
+      /*Cb  qi=43  OC_MODE_GOLDEN_MV*/
+      {
+         1868, 7105,14550,17761,21025,23730,24499,25264,
+        25322,26031,26400,26435,26861,27862,27689,31132
+      }
+    },
+    {
+      /*Cr  qi=43  OC_MODE_INTRA*/
+      {
+         1845, 7034,10741,13411,15740,17682,19602,21548,
+        23424,24322,25379,27031,28433,29061,30595,35063
+      },
+      /*Cr  qi=43  OC_MODE_INTER_NOMV*/
+      {
+          888, 3037, 8551,12928,16075,30592,18798,20979,
+        17966,14385, 8278, 8530,13270,13928,11067, 7091
+      },
+      /*Cr  qi=43  OC_MODE_INTER_MV*/
+      {
+          577, 4124, 9828,13266,15601,18148,21124,22739,
+        25448,27437,28391,29280,28867,31830,29954,32198
+      },
+      /*Cr  qi=43  OC_MDOE_INTER_MV_LAST*/
+      {
+         1141, 3842, 9622,14553,17590,19762,21532,21787,
+        21413,19304,18654,17188,16830,17196,17124,16638
+      },
+      /*Cr  qi=43  OC_MODE_INTER_MV_LAST2*/
+      {
+         1259, 4112, 8979,13874,17159,19481,21220,21440,
+        23092,19620,18345,19040,27648,31098,23883,29664
+      },
+      /*Cr  qi=43  OC_MODE_INTER_MV_FOUR*/
+      {
+          826, 3726, 9451,13888,17019,19451,21325,23373,
+        24943,27373,28554,28820,31212,31274,31500,35704
+      },
+      /*Cr  qi=43  OC_MODE_GOLDEN_NOMV*/
+      {
+         1067, 3368, 7355,10756,11713,12924,14326,14266,
+        14471,14726,15227,15529,15560,16123,16747,17327
+      },
+      /*Cr  qi=43  OC_MODE_GOLDEN_MV*/
+      {
+          940, 4114, 9319,13377,15041,16427,17419,16698,
+        17080,16448,16265,16277,16542,17003,16596,17213
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=44  OC_MODE_INTRA*/
+      {
+         3302, 7203,11316,13689,15961,17895,19619,20993,
+        22718,24366,25609,26426,27580,28772,29797,37464
+      },
+      /*Y'  qi=44  OC_MODE_INTER_NOMV*/
+      {
+          934, 4914,10792,15208,18307,20821,22898,24855,
+        26752,28406,30002,31464,32948,34225,35402,43846
+      },
+      /*Y'  qi=44  OC_MODE_INTER_MV*/
+      {
+         1443, 5500,10592,14642,17592,19897,21969,23852,
+        25586,27224,28701,29994,31281,32390,33448,37361
+      },
+      /*Y'  qi=44  OC_MDOE_INTER_MV_LAST*/
+      {
+         1542, 6108,10566,14639,17484,19813,21917,23894,
+        25754,27492,29128,30705,32029,33337,34419,39153
+      },
+      /*Y'  qi=44  OC_MODE_INTER_MV_LAST2*/
+      {
+          847, 6090,10805,15017,18004,20278,22259,24079,
+        25862,27574,29161,30559,31781,33252,34275,39992
+      },
+      /*Y'  qi=44  OC_MODE_INTER_MV_FOUR*/
+      {
+          621, 5022,10452,14537,17580,20025,22169,24146,
+        26031,27771,29381,30763,32094,33265,34382,38594
+      },
+      /*Y'  qi=44  OC_MODE_GOLDEN_NOMV*/
+      {
+          999, 4636,10592,14245,16639,18351,21000,22927,
+        24572,26163,27223,28249,28793,29997,30788,39374
+      },
+      /*Y'  qi=44  OC_MODE_GOLDEN_MV*/
+      {
+          959, 5279,10449,14792,17869,20306,22549,24611,
+        26489,28214,29665,30877,32182,32964,33986,38590
+      }
+    },
+    {
+      /*Cb  qi=44  OC_MODE_INTRA*/
+      {
+         3967,11162,15103,18268,21002,22572,23964,25678,
+        27911,30086,31906,33978,35198,36703,37860,43555
+      },
+      /*Cb  qi=44  OC_MODE_INTER_NOMV*/
+      {
+         1862, 5690,13111,16642,19690,23069,43156,26780,
+        30887,33322,32225,41792,38505,40732,45312,41531
+      },
+      /*Cb  qi=44  OC_MODE_INTER_MV*/
+      {
+         1144, 7847,14476,18440,22162,26319,29548,31638,
+        33454,36166,37629,38729,39270,40684,45352,47358
+      },
+      /*Cb  qi=44  OC_MDOE_INTER_MV_LAST*/
+      {
+         2610, 7422,14595,17880,22048,26121,28583,30238,
+        31296,31803,31887,31716,30673,30824,30165,31046
+      },
+      /*Cb  qi=44  OC_MODE_INTER_MV_LAST2*/
+      {
+         2614, 8796,14670,17573,21242,25360,28258,30781,
+        32710,33629,33595,35158,33264,38495,42782,41029
+      },
+      /*Cb  qi=44  OC_MODE_INTER_MV_FOUR*/
+      {
+         1555, 6302,13841,17582,21558,25600,28896,31648,
+        33817,36520,38013,38770,41130,40770,44940,47200
+      },
+      /*Cb  qi=44  OC_MODE_GOLDEN_NOMV*/
+      {
+         2010, 5771,10766,13440,16909,20345,21304,22065,
+        23899,25434,26388,27407,26477,27298,27086,30781
+      },
+      /*Cb  qi=44  OC_MODE_GOLDEN_MV*/
+      {
+         1871, 7093,14548,17749,20974,23730,24530,25188,
+        25408,25934,26330,26609,26806,27960,27596,31056
+      }
+    },
+    {
+      /*Cr  qi=44  OC_MODE_INTRA*/
+      {
+         1860, 7044,10761,13428,15760,17706,19624,21539,
+        23456,24346,25400,27086,28498,29087,30725,35136
+      },
+      /*Cr  qi=44  OC_MODE_INTER_NOMV*/
+      {
+          895, 3040, 8557,12905,15752,29405,24992,18027,
+        19781,14480, 8067,22613,25163,14079,11615, 6957
+      },
+      /*Cr  qi=44  OC_MODE_INTER_MV*/
+      {
+          569, 3981, 9948,13596,15800,18084,21082,23134,
+        25271,27538,29416,29548,28698,30269,31990,32680
+      },
+      /*Cr  qi=44  OC_MDOE_INTER_MV_LAST*/
+      {
+         1143, 3832, 9633,14498,17621,19758,21602,21783,
+        21382,19396,18273,16667,16719,17220,18122,16418
+      },
+      /*Cr  qi=44  OC_MODE_INTER_MV_LAST2*/
+      {
+         1260, 4139, 9015,13907,17055,19584,21531,21667,
+        23490,19429,18529,18426,27978,29728,25291,22384
+      },
+      /*Cr  qi=44  OC_MODE_INTER_MV_FOUR*/
+      {
+          834, 3723, 9441,13849,16975,19443,21344,23332,
+        25057,27589,28110,28412,30744,31605,31065,36196
+      },
+      /*Cr  qi=44  OC_MODE_GOLDEN_NOMV*/
+      {
+         1066, 3372, 7323,10743,11909,12994,14361,14211,
+        14637,14674,15316,15618,15699,16062,16940,17378
+      },
+      /*Cr  qi=44  OC_MODE_GOLDEN_MV*/
+      {
+          941, 4111, 9307,13348,15075,16470,17369,16644,
+        16987,16287,16196,16268,16524,17029,16407,17212
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=45  OC_MODE_INTRA*/
+      {
+         3618, 7694,11878,14214,16525,18473,20225,21623,
+        23360,25043,26330,27149,28332,29559,30626,38568
+      },
+      /*Y'  qi=45  OC_MODE_INTER_NOMV*/
+      {
+         1035, 5357,11465,15854,19003,21501,23656,25639,
+        27594,29297,30938,32424,33842,34941,36518,45179
+      },
+      /*Y'  qi=45  OC_MODE_INTER_MV*/
+      {
+         1428, 5941,11236,15286,18292,20706,22842,24765,
+        26509,28122,29564,30863,32170,33285,34312,38171
+      },
+      /*Y'  qi=45  OC_MDOE_INTER_MV_LAST*/
+      {
+         1624, 6652,11232,15339,18176,20480,22609,24625,
+        26533,28369,30107,31669,33125,34384,35544,40341
+      },
+      /*Y'  qi=45  OC_MODE_INTER_MV_LAST2*/
+      {
+          908, 6551,11469,15680,18721,21034,23030,24932,
+        26783,28579,30212,31649,33073,34452,35440,41410
+      },
+      /*Y'  qi=45  OC_MODE_INTER_MV_FOUR*/
+      {
+          663, 5408,11070,15184,18276,20762,22942,24941,
+        26842,28604,30212,31658,33005,34246,35372,39776
+      },
+      /*Y'  qi=45  OC_MODE_GOLDEN_NOMV*/
+      {
+         1036, 4985,11105,14745,17242,19084,21728,23656,
+        25679,26865,28122,29203,29706,30722,31658,40624
+      },
+      /*Y'  qi=45  OC_MODE_GOLDEN_MV*/
+      {
+         1017, 5638,11042,15498,18590,21076,23379,25440,
+        27365,29100,30592,31861,33171,33988,34994,39750
+      }
+    },
+    {
+      /*Cb  qi=45  OC_MODE_INTRA*/
+      {
+         4777,12393,16449,19624,22470,24160,25583,27369,
+        29829,32002,33813,36099,37426,38730,39917,46172
+      },
+      /*Cb  qi=45  OC_MODE_INTER_NOMV*/
+      {
+         2363, 6803,14595,18020,21590,24285,45978,42368,
+        38502,34553,33116,36069,39930,45142,40395,47738
+      },
+      /*Cb  qi=45  OC_MODE_INTER_MV*/
+      {
+         1470, 9351,15587,19387,23205,27617,31304,33825,
+        35985,38250,40048,41204,41553,45963,48442,49882
+      },
+      /*Cb  qi=45  OC_MDOE_INTER_MV_LAST*/
+      {
+         3373, 8778,16070,19322,23709,28094,30775,32440,
+        33647,33849,34067,34075,32594,33100,32775,33239
+      },
+      /*Cb  qi=45  OC_MODE_INTER_MV_LAST2*/
+      {
+         3291, 9969,16065,19074,22833,27088,30137,32659,
+        35108,36255,37279,36357,39942,44854,45931,48298
+      },
+      /*Cb  qi=45  OC_MODE_INTER_MV_FOUR*/
+      {
+         1945, 7431,15253,19094,23353,27683,31043,33877,
+        36675,38613,40273,41306,42988,44300,49010,49087
+      },
+      /*Cb  qi=45  OC_MODE_GOLDEN_NOMV*/
+      {
+         2446, 6805,11895,14139,17923,21575,22614,23828,
+        25500,27463,28004,28752,28249,28994,28962,32895
+      },
+      /*Cb  qi=45  OC_MODE_GOLDEN_MV*/
+      {
+         2315, 8198,15952,19288,22642,25724,26423,27237,
+        27396,27962,28103,28795,28314,29636,29410,33471
+      }
+    },
+    {
+      /*Cr  qi=45  OC_MODE_INTRA*/
+      {
+         2161, 7808,11646,14401,16807,18802,20807,22842,
+        24743,25664,26733,28437,29974,30465,32026,36670
+      },
+      /*Cr  qi=45  OC_MODE_INTER_NOMV*/
+      {
+         1116, 3670, 9743,13835,16525,30454,36404,23131,
+        21962,13590, 8567, 9727,17055,15453,14277, 8225
+      },
+      /*Cr  qi=45  OC_MODE_INTER_MV*/
+      {
+          750, 4917,10839,14292,16804,19625,22367,24326,
+        27406,28054,29071,31502,31134,32962,33327,34408
+      },
+      /*Cr  qi=45  OC_MDOE_INTER_MV_LAST*/
+      {
+         1490, 4481,10620,15611,18782,21105,22864,23232,
+        22722,20518,19609,18577,18072,18370,19646,17753
+      },
+      /*Cr  qi=45  OC_MODE_INTER_MV_LAST2*/
+      {
+         1568, 4762, 9913,14918,18203,20993,22586,23226,
+        24760,20496,19420,21934,22816,30592,32409,29056
+      },
+      /*Cr  qi=45  OC_MODE_INTER_MV_FOUR*/
+      {
+         1048, 4382,10503,15046,18249,20759,22854,24706,
+        26508,28048,29254,30771,31422,32113,33912,36501
+      },
+      /*Cr  qi=45  OC_MODE_GOLDEN_NOMV*/
+      {
+         1292, 4017, 8109,11521,12827,13902,15247,15512,
+        15588,15916,16054,16244,16821,17101,17696,18495
+      },
+      /*Cr  qi=45  OC_MODE_GOLDEN_MV*/
+      {
+         1173, 4794,10313,14434,16063,17568,18828,18155,
+        18191,17488,17168,17656,17596,17853,17665,18369
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=46  OC_MODE_INTRA*/
+      {
+         3629, 7709,11892,14231,16547,18502,20258,21647,
+        23386,25058,26345,27170,28351,29576,30628,38557
+      },
+      /*Y'  qi=46  OC_MODE_INTER_NOMV*/
+      {
+         1049, 5374,11480,15853,19030,21503,23647,25653,
+        27602,29297,30879,32418,33862,35157,36397,45512
+      },
+      /*Y'  qi=46  OC_MODE_INTER_MV*/
+      {
+         1419, 5913,11225,15288,18282,20684,22801,24738,
+        26500,28125,29573,30873,32187,33302,34330,38150
+      },
+      /*Y'  qi=46  OC_MDOE_INTER_MV_LAST*/
+      {
+         1815, 6696,11313,15399,18199,20444,22566,24594,
+        26502,28320,30083,31671,33091,34326,35518,40362
+      },
+      /*Y'  qi=46  OC_MODE_INTER_MV_LAST2*/
+      {
+          926, 6415,11480,15691,18710,21030,23039,24989,
+        26808,28609,30329,31743,33127,34335,35429,41199
+      },
+      /*Y'  qi=46  OC_MODE_INTER_MV_FOUR*/
+      {
+          675, 5447,11076,15190,18293,20787,22957,24955,
+        26842,28617,30248,31655,33048,34237,35403,39808
+      },
+      /*Y'  qi=46  OC_MODE_GOLDEN_NOMV*/
+      {
+         1045, 5001,11126,14736,17229,19445,21829,23707,
+        25770,27020,28229,29430,29869,30763,31781,40598
+      },
+      /*Y'  qi=46  OC_MODE_GOLDEN_MV*/
+      {
+         1032, 5609,11073,15522,18620,21092,23404,25463,
+        27371,29112,30599,31877,33172,33995,35025,39799
+      }
+    },
+    {
+      /*Cb  qi=46  OC_MODE_INTRA*/
+      {
+         4770,12386,16447,19621,22463,24154,25567,27365,
+        29811,32009,33803,36062,37426,38810,39879,46087
+      },
+      /*Cb  qi=46  OC_MODE_INTER_NOMV*/
+      {
+         2357, 6807,14668,18271,21361,24442,45964,29751,
+        36203,44279,33683,34801,38994,42228,46406,46182
+      },
+      /*Cb  qi=46  OC_MODE_INTER_MV*/
+      {
+         1524, 9216,15698,19435,23186,27752,31351,31669,
+        35141,37486,39578,42469,43135,45545,49579,50148
+      },
+      /*Cb  qi=46  OC_MDOE_INTER_MV_LAST*/
+      {
+         3426, 9238,16030,19298,23696,27985,30693,32375,
+        33374,34001,33831,33837,32684,33152,32364,33198
+      },
+      /*Cb  qi=46  OC_MODE_INTER_MV_LAST2*/
+      {
+         3289,10029,16057,19090,22989,26953,30095,32959,
+        34810,35331,35401,37250,37604,40471,41172,46153
+      },
+      /*Cb  qi=46  OC_MODE_INTER_MV_FOUR*/
+      {
+         1951, 7441,15281,19099,23335,27573,31107,33918,
+        36503,38591,40391,41614,43099,43183,48565,49169
+      },
+      /*Cb  qi=46  OC_MODE_GOLDEN_NOMV*/
+      {
+         2439, 6826,11940,14027,17834,21519,22512,23690,
+        25494,27199,28051,28812,28202,28991,29035,32794
+      },
+      /*Cb  qi=46  OC_MODE_GOLDEN_MV*/
+      {
+         2297, 8214,15959,19296,22651,25721,26336,27232,
+        27224,27638,28036,28654,28427,29547,28919,33329
+      }
+    },
+    {
+      /*Cr  qi=46  OC_MODE_INTRA*/
+      {
+         2196, 7820,11650,14400,16806,18811,20813,22845,
+        24780,25657,26726,28429,29995,30496,31982,36695
+      },
+      /*Cr  qi=46  OC_MODE_INTER_NOMV*/
+      {
+         1122, 3681, 9781,13876,16609,30310,22373,22233,
+        19349,12108, 8165,13057,15518,13802, 9205, 8244
+      },
+      /*Cr  qi=46  OC_MODE_INTER_MV*/
+      {
+          774, 4843,10839,14300,16721,19561,22035,24232,
+        28025,29490,31490,31310,30890,33592,34190,33714
+      },
+      /*Cr  qi=46  OC_MDOE_INTER_MV_LAST*/
+      {
+         1588, 4521,10637,15640,18757,21139,22870,23091,
+        22671,20567,19623,18745,17770,18267,19153,17704
+      },
+      /*Cr  qi=46  OC_MODE_INTER_MV_LAST2*/
+      {
+         1548, 4798, 9932,15073,18146,20615,22667,23138,
+        24712,20925,19784,22758,28769,29476,36005,28816
+      },
+      /*Cr  qi=46  OC_MODE_INTER_MV_FOUR*/
+      {
+         1059, 4375,10512,15057,18277,20767,22812,24710,
+        26458,28366,29067,30329,32154,32929,31290,38090
+      },
+      /*Cr  qi=46  OC_MODE_GOLDEN_NOMV*/
+      {
+         1289, 4023, 8162,11280,12776,13848,15320,15469,
+        15691,15998,16041,16235,16806,17089,17531,18554
+      },
+      /*Cr  qi=46  OC_MODE_GOLDEN_MV*/
+      {
+         1174, 4796,10334,14439,16053,17571,18668,18085,
+        18158,17572,17048,17341,17764,18175,17400,18377
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=47  OC_MODE_INTRA*/
+      {
+         4730, 9169,13387,15726,18119,20164,21984,23445,
+        25245,26940,28240,29092,30317,31577,32703,41087
+      },
+      /*Y'  qi=47  OC_MODE_INTER_NOMV*/
+      {
+         1637, 6754,13086,17449,20720,23291,25565,27679,
+        29734,31474,33221,34598,36295,37292,38794,47292
+      },
+      /*Y'  qi=47  OC_MODE_INTER_MV*/
+      {
+         1887, 7379,12801,16928,20013,22466,24619,26588,
+        28368,30037,31497,32867,34174,35312,36366,40413
+      },
+      /*Y'  qi=47  OC_MDOE_INTER_MV_LAST*/
+      {
+         2325, 8258,12863,16948,19873,22310,24559,26643,
+        28579,30373,32117,33710,35154,36455,37687,42883
+      },
+      /*Y'  qi=47  OC_MODE_INTER_MV_LAST2*/
+      {
+         1508, 8285,13060,17322,20413,22865,25036,27006,
+        28825,30524,32076,33442,34799,36226,37474,43806
+      },
+      /*Y'  qi=47  OC_MODE_INTER_MV_FOUR*/
+      {
+         1038, 6684,12664,16810,20019,22639,24913,27002,
+        28964,30739,32366,33791,35177,36427,37589,42215
+      },
+      /*Y'  qi=47  OC_MODE_GOLDEN_NOMV*/
+      {
+         1547, 6321,12645,16274,18837,21201,23682,25754,
+        27800,29272,30511,31368,32191,33319,33924,43252
+      },
+      /*Y'  qi=47  OC_MODE_GOLDEN_MV*/
+      {
+         1523, 6913,12670,17190,20345,22931,25301,27470,
+        29416,31172,32571,33906,35171,36075,37226,42175
+      }
+    },
+    {
+      /*Cb  qi=47  OC_MODE_INTRA*/
+      {
+         5200,13068,17255,20518,23455,25164,26598,28508,
+        30888,33185,35074,37320,38772,40057,41260,47457
+      },
+      /*Cb  qi=47  OC_MODE_INTER_NOMV*/
+      {
+         2677, 7474,15617,19199,23189,27234,44183,45184,
+        35324,38324,35110,36973,39301,43984,44397,51349
+      },
+      /*Cb  qi=47  OC_MODE_INTER_MV*/
+      {
+         1731, 9719,16481,20376,24216,28992,32626,35409,
+        36887,39352,41655,42609,43601,46408,49854,53638
+      },
+      /*Cb  qi=47  OC_MDOE_INTER_MV_LAST*/
+      {
+         3881, 9507,16800,20128,24733,29206,31961,33691,
+        34839,35289,35279,35328,33971,34397,33776,34447
+      },
+      /*Cb  qi=47  OC_MODE_INTER_MV_LAST2*/
+      {
+         3607,10756,16906,20049,24018,28440,31811,33930,
+        36275,37793,38112,38799,38238,45909,44646,52001
+      },
+      /*Cb  qi=47  OC_MODE_INTER_MV_FOUR*/
+      {
+         2181, 7976,16001,19912,24284,28627,32274,35179,
+        37841,40179,42294,43503,45145,44897,50907,51379
+      },
+      /*Cb  qi=47  OC_MODE_GOLDEN_NOMV*/
+      {
+         2783, 7433,12476,14577,18464,22064,23360,24597,
+        26681,27951,29187,29832,29240,29957,29632,33888
+      },
+      /*Cb  qi=47  OC_MODE_GOLDEN_MV*/
+      {
+         2575, 8801,16712,20121,23652,26795,27403,28257,
+        28141,28726,29195,29641,29626,30999,30721,34542
+      }
+    },
+    {
+      /*Cr  qi=47  OC_MODE_INTRA*/
+      {
+         2407, 8398,12393,15229,17711,19704,21795,23916,
+        25887,26813,27913,29720,31073,31733,33403,38050
+      },
+      /*Cr  qi=47  OC_MODE_INTER_NOMV*/
+      {
+         1297, 4218,10634,15021,17893,34880,38592,26482,
+        22476,12298, 9860,14926,17042,15898,10228, 8690
+      },
+      /*Cr  qi=47  OC_MODE_INTER_MV*/
+      {
+          923, 5330,11718,15299,17706,20435,23648,25455,
+        28634,31893,33078,33426,32688,34856,33960,35533
+      },
+      /*Cr  qi=47  OC_MDOE_INTER_MV_LAST*/
+      {
+         1815, 5023,11582,16674,19812,22284,24034,24276,
+        23770,21451,20359,19564,18661,19471,20062,18508
+      },
+      /*Cr  qi=47  OC_MODE_INTER_MV_LAST2*/
+      {
+         1887, 5423,10774,16361,19540,22346,24257,24245,
+        26270,22601,22188,24354,31443,31616,34432,33011
+      },
+      /*Cr  qi=47  OC_MODE_INTER_MV_FOUR*/
+      {
+         1200, 4902,11362,15998,19329,21885,24020,26038,
+        27911,29644,31069,32488,32706,34163,33736,38724
+      },
+      /*Cr  qi=47  OC_MODE_GOLDEN_NOMV*/
+      {
+         1493, 4532, 8580,11789,13337,14681,15964,16289,
+        16359,16452,17025,16886,17725,18041,18338,19060
+      },
+      /*Cr  qi=47  OC_MODE_GOLDEN_MV*/
+      {
+         1346, 5358,11205,15312,16956,18676,19561,18900,
+        18961,18586,18118,18545,18730,18984,18611,19708
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=48  OC_MODE_INTRA*/
+      {
+         4879, 9394,13622,15956,18359,20397,22239,23727,
+        25525,27234,28553,29421,30657,31944,33064,41578
+      },
+      /*Y'  qi=48  OC_MODE_INTER_NOMV*/
+      {
+         1664, 6952,13322,17680,20964,23583,25889,28065,
+        30152,31986,33582,35354,36565,38026,39299,47964
+      },
+      /*Y'  qi=48  OC_MODE_INTER_MV*/
+      {
+         1936, 7615,12986,17128,20178,22632,24867,26915,
+        28764,30437,31942,33318,34662,35788,36914,40982
+      },
+      /*Y'  qi=48  OC_MDOE_INTER_MV_LAST*/
+      {
+         2538, 8636,13261,17341,20281,22716,24986,27078,
+        28983,30838,32537,34097,35502,36906,38187,43390
+      },
+      /*Y'  qi=48  OC_MODE_INTER_MV_LAST2*/
+      {
+         1437, 8113,13306,17540,20699,23188,25334,27388,
+        29320,31161,32742,34095,35283,36732,38159,44466
+      },
+      /*Y'  qi=48  OC_MODE_INTER_MV_FOUR*/
+      {
+         1055, 6908,12891,17040,20258,22917,25237,27347,
+        29318,31143,32775,34231,35606,36899,38075,42762
+      },
+      /*Y'  qi=48  OC_MODE_GOLDEN_NOMV*/
+      {
+         1582, 6494,12877,16505,19074,21439,23890,26036,
+        28222,29561,30848,31764,32589,33483,34491,43788
+      },
+      /*Y'  qi=48  OC_MODE_GOLDEN_MV*/
+      {
+         1563, 7057,12942,17445,20618,23215,25664,27822,
+        29771,31566,33030,34365,35584,36516,37647,42770
+      }
+    },
+    {
+      /*Cb  qi=48  OC_MODE_INTRA*/
+      {
+         5287,13251,17483,20726,23685,25428,26836,28748,
+        31163,33470,35409,37691,39151,40522,41661,47824
+      },
+      /*Cb  qi=48  OC_MODE_INTER_NOMV*/
+      {
+         2733, 7649,15790,19547,23393,26745,44687,33429,
+        34634,35233,38946,36687,39940,48864,44800,55222
+      },
+      /*Cb  qi=48  OC_MODE_INTER_MV*/
+      {
+         1902, 9923,16822,20658,24554,29361,33095,35766,
+        37385,39565,42311,42371,44481,46737,51108,55424
+      },
+      /*Cb  qi=48  OC_MDOE_INTER_MV_LAST*/
+      {
+         3957,10394,17062,20370,25123,29736,32418,34070,
+        35372,35543,35424,35631,34588,34968,33869,34804
+      },
+      /*Cb  qi=48  OC_MODE_INTER_MV_LAST2*/
+      {
+         3657,10905,17160,20309,24026,28241,32017,37442,
+        37405,41344,37864,38926,41875,46621,43949,52480
+      },
+      /*Cb  qi=48  OC_MODE_INTER_MV_FOUR*/
+      {
+         2216, 8204,16322,20220,24624,29040,32654,35557,
+        38477,40434,41705,43662,46704,45342,51120,52149
+      },
+      /*Cb  qi=48  OC_MODE_GOLDEN_NOMV*/
+      {
+         2820, 7587,12603,14782,18757,22390,23905,24854,
+        26748,28208,29640,30002,29438,30067,30077,34131
+      },
+      /*Cb  qi=48  OC_MODE_GOLDEN_MV*/
+      {
+         2599, 8991,16990,20415,23887,26983,27947,28621,
+        28766,29207,29403,29960,30171,31153,30549,34897
+      }
+    },
+    {
+      /*Cr  qi=48  OC_MODE_INTRA*/
+      {
+         2412, 8407,12392,15232,17703,19703,21798,23936,
+        25904,26868,27799,29676,31093,31630,33413,38129
+      },
+      /*Cr  qi=48  OC_MODE_INTER_NOMV*/
+      {
+         1300, 4219,10686,15171,18067,20458,34720,23178,
+        23074,13556,10108,13796,19395,16425,12114, 8993
+      },
+      /*Cr  qi=48  OC_MODE_INTER_MV*/
+      {
+          985, 5299,11672,15333,18104,20968,23798,25722,
+        27979,30311,31122,32800,32918,34221,33294,35616
+      },
+      /*Cr  qi=48  OC_MDOE_INTER_MV_LAST*/
+      {
+         1984, 5132,11475,16856,19802,22229,24024,24370,
+        23619,21436,20360,19365,19242,19227,20418,18369
+      },
+      /*Cr  qi=48  OC_MODE_INTER_MV_LAST2*/
+      {
+         1815, 5356,10766,16075,19527,22055,23832,23954,
+        26195,21376,20645,22591,32992,34279,26112,32256
+      },
+      /*Cr  qi=48  OC_MODE_INTER_MV_FOUR*/
+      {
+         1209, 4891,11379,16057,19358,21842,24087,25855,
+        27800,30102,30844,31684,32802,34478,35500,38822
+      },
+      /*Cr  qi=48  OC_MODE_GOLDEN_NOMV*/
+      {
+         1494, 4538, 8583,11745,13335,14731,15962,16339,
+        16273,16525,16967,16829,17490,17967,18397,18917
+      },
+      /*Cr  qi=48  OC_MODE_GOLDEN_MV*/
+      {
+         1341, 5361,11196,15273,16980,18660,19505,19003,
+        18926,18336,18016,18279,18758,18884,18784,19326
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=49  OC_MODE_INTRA*/
+      {
+         4881, 9394,13621,15953,18353,20399,22238,23725,
+        25530,27238,28555,29425,30656,31944,33076,41598
+      },
+      /*Y'  qi=49  OC_MODE_INTER_NOMV*/
+      {
+         1664, 6952,13325,17678,20958,23581,25883,28060,
+        30119,31921,33617,35146,36518,38117,39204,48627
+      },
+      /*Y'  qi=49  OC_MODE_INTER_MV*/
+      {
+         1923, 7628,12984,17132,20182,22636,24866,26915,
+        28773,30440,31948,33327,34645,35791,36914,41014
+      },
+      /*Y'  qi=49  OC_MDOE_INTER_MV_LAST*/
+      {
+         2511, 8639,13263,17342,20282,22718,24986,27083,
+        28986,30842,32527,34097,35522,36932,38168,43403
+      },
+      /*Y'  qi=49  OC_MODE_INTER_MV_LAST2*/
+      {
+         1434, 8104,13303,17539,20702,23186,25336,27375,
+        29335,31133,32711,34205,35300,36727,37960,44375
+      },
+      /*Y'  qi=49  OC_MODE_INTER_MV_FOUR*/
+      {
+         1055, 6908,12893,17041,20258,22915,25237,27347,
+        29319,31148,32766,34239,35606,36908,38092,42769
+      },
+      /*Y'  qi=49  OC_MODE_GOLDEN_NOMV*/
+      {
+         1583, 6495,12878,16506,19072,21441,23880,26017,
+        28273,29554,30832,31860,32586,33531,34520,43815
+      },
+      /*Y'  qi=49  OC_MODE_GOLDEN_MV*/
+      {
+         1565, 7059,12938,17446,20615,23221,25664,27826,
+        29772,31583,33034,34369,35605,36532,37657,42771
+      }
+    },
+    {
+      /*Cb  qi=49  OC_MODE_INTRA*/
+      {
+         5288,13256,17482,20726,23691,25434,26862,28770,
+        31165,33422,35384,37687,39069,40504,41614,47887
+      },
+      /*Cb  qi=49  OC_MODE_INTER_NOMV*/
+      {
+         2733, 7647,15794,19550,23432,26831,44687,36584,
+        37631,35409,37609,36976,37783,47403,42347,56087
+      },
+      /*Cb  qi=49  OC_MODE_INTER_MV*/
+      {
+         1903, 9931,16816,20661,24585,29349,33030,35485,
+        37467,39441,42259,42727,43914,47935,51269,55437
+      },
+      /*Cb  qi=49  OC_MDOE_INTER_MV_LAST*/
+      {
+         3960,10390,17063,20366,25144,29640,32413,34090,
+        35423,35640,35281,35957,34448,35047,34009,34820
+      },
+      /*Cb  qi=49  OC_MODE_INTER_MV_LAST2*/
+      {
+         3644,10901,17155,20309,24111,28343,31979,35084,
+        37792,40149,38167,39346,41952,47019,44453,53363
+      },
+      /*Cb  qi=49  OC_MODE_INTER_MV_FOUR*/
+      {
+         2215, 8203,16322,20222,24637,29031,32599,35511,
+        38536,40779,42099,43932,45720,44593,51653,52058
+      },
+      /*Cb  qi=49  OC_MODE_GOLDEN_NOMV*/
+      {
+         2819, 7583,12604,14786,18747,22260,23819,24763,
+        26634,28156,29624,29914,29406,29984,30079,34169
+      },
+      /*Cb  qi=49  OC_MODE_GOLDEN_MV*/
+      {
+         2599, 8990,16991,20415,23924,26969,27980,28590,
+        28739,29289,29443,29912,30383,31185,30685,34921
+      }
+    },
+    {
+      /*Cr  qi=49  OC_MODE_INTRA*/
+      {
+         2413, 8408,12397,15238,17709,19713,21800,23931,
+        25890,26850,27775,29671,31112,31721,33416,38152
+      },
+      /*Cr  qi=49  OC_MODE_INTER_NOMV*/
+      {
+         1299, 4222,10695,15007,17734,20428,34720,22770,
+        22189,12874, 9584,13159,17965,14891,11490, 8920
+      },
+      /*Cr  qi=49  OC_MODE_INTER_MV*/
+      {
+          983, 5306,11678,15341,18038,20981,23653,25531,
+        28434,30209,32888,33479,32522,35173,33019,36252
+      },
+      /*Cr  qi=49  OC_MDOE_INTER_MV_LAST*/
+      {
+         1986, 5134,11491,16851,19804,22270,24032,24366,
+        23608,21302,20330,19614,18926,19106,20048,18341
+      },
+      /*Cr  qi=49  OC_MODE_INTER_MV_LAST2*/
+      {
+         1819, 5355,10735,16143,19463,22134,24253,24031,
+        25946,21850,20617,23022,33344,30144,25984,32256
+      },
+      /*Cr  qi=49  OC_MODE_INTER_MV_FOUR*/
+      {
+         1209, 4891,11382,16046,19387,21863,24051,25942,
+        27814,29879,31268,31786,33486,34532,34788,38546
+      },
+      /*Cr  qi=49  OC_MODE_GOLDEN_NOMV*/
+      {
+         1494, 4537, 8586,11738,13265,14710,15869,16211,
+        16291,16433,16939,16921,17536,17974,18516,19126
+      },
+      /*Cr  qi=49  OC_MODE_GOLDEN_MV*/
+      {
+         1343, 5362,11194,15285,17012,18702,19490,18977,
+        18917,18377,17984,18180,18763,18949,18767,19495
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=50  OC_MODE_INTRA*/
+      {
+         5361,10126,14415,16733,19177,21252,23133,24652,
+        26492,28207,29568,30476,31754,33088,34269,43215
+      },
+      /*Y'  qi=50  OC_MODE_INTER_NOMV*/
+      {
+         1830, 7669,14137,18486,21857,24539,26945,29192,
+        31319,33139,34792,36547,37950,39746,40984,49289
+      },
+      /*Y'  qi=50  OC_MODE_INTER_MV*/
+      {
+         2588, 8854,14019,18093,21365,23911,26080,28129,
+        30117,32045,33856,35359,36859,38147,39388,45274
+      },
+      /*Y'  qi=50  OC_MDOE_INTER_MV_LAST*/
+      {
+         2354, 9213,14138,18207,21174,23629,25948,28111,
+        30084,31987,33765,35395,36929,38356,39672,45171
+      },
+      /*Y'  qi=50  OC_MODE_INTER_MV_LAST2*/
+      {
+         1781, 9086,14067,18281,21464,23997,26227,28292,
+        30210,31916,33487,34864,36238,37282,38348,43573
+      },
+      /*Y'  qi=50  OC_MODE_INTER_MV_FOUR*/
+      {
+         1148, 7446,13731,17944,21224,23925,26295,28463,
+        30450,32273,33949,35454,36935,38280,39519,43944
+      },
+      /*Y'  qi=50  OC_MODE_GOLDEN_NOMV*/
+      {
+         1680, 7032,13567,17265,19843,22271,24900,27135,
+        29197,30719,32131,32949,33760,34819,35798,45647
+      },
+      /*Y'  qi=50  OC_MODE_GOLDEN_MV*/
+      {
+         1684, 7654,13760,18383,21586,24276,26771,29027,
+        31094,32836,34481,35825,37178,38090,39337,44599
+      }
+    },
+    {
+      /*Cb  qi=50  OC_MODE_INTRA*/
+      {
+         6275,14635,19082,22443,25609,27411,28891,30882,
+        33423,35766,37844,40263,41724,43266,44505,50809
+      },
+      /*Cb  qi=50  OC_MODE_INTER_NOMV*/
+      {
+         3502, 9124,17309,21126,25603,28700,51217,35675,
+        37791,39051,42442,43576,44020,49689,47979,46874
+      },
+      /*Cb  qi=50  OC_MODE_INTER_MV*/
+      {
+         5092,11943,18624,22043,26497,31495,35220,37695,
+        39478,45589,44037,45666,50413,51230,53471,52168
+      },
+      /*Cb  qi=50  OC_MDOE_INTER_MV_LAST*/
+      {
+         4512,11765,18693,22310,27439,32367,35301,37144,
+        38407,38635,38639,38223,37687,37423,36570,37475
+      },
+      /*Cb  qi=50  OC_MODE_INTER_MV_LAST2*/
+      {
+         4664,12154,18649,22073,26062,30622,34443,38591,
+        39906,41062,40690,43313,44522,54357,45872,55895
+      },
+      /*Cb  qi=50  OC_MODE_INTER_MV_FOUR*/
+      {
+         2794, 9527,18000,22218,26936,31815,35675,38821,
+        41868,43774,46081,46738,50080,52904,55980,56297
+      },
+      /*Cb  qi=50  OC_MODE_GOLDEN_NOMV*/
+      {
+         3487, 8883,13741,16033,20425,24003,25929,27256,
+        28972,30839,32135,32360,32126,32681,32536,36978
+      },
+      /*Cb  qi=50  OC_MODE_GOLDEN_MV*/
+      {
+         3290,10312,18697,22346,26157,29546,30344,30914,
+        31400,32074,31842,32387,32868,33523,33661,37513
+      }
+    },
+    {
+      /*Cr  qi=50  OC_MODE_INTRA*/
+      {
+         2796, 9244,13427,16332,18882,20971,23170,25317,
+        27400,28462,29454,31405,32992,33648,35347,40251
+      },
+      /*Cr  qi=50  OC_MODE_INTER_NOMV*/
+      {
+         1615, 5075,12012,16517,19867,22255,31296,23824,
+        25402,16120,12403,33621,29159,32249,31514,28448
+      },
+      /*Cr  qi=50  OC_MODE_INTER_MV*/
+      {
+         2221, 6192,12505,17561,21045,24040,26036,27808,
+        30539,30854,32352,34101,33029,34248,37564,33992
+      },
+      /*Cr  qi=50  OC_MDOE_INTER_MV_LAST*/
+      {
+         2364, 5897,12788,17999,21266,24020,25865,26100,
+        25537,23189,21625,20983,20747,20601,21546,19153
+      },
+      /*Cr  qi=50  OC_MODE_INTER_MV_LAST2*/
+      {
+         2329, 6199,12066,15423,19308,22974,25247,26117,
+        27830,25277,24568,23862,31606,32832,19173,31544
+      },
+      /*Cr  qi=50  OC_MODE_INTER_MV_FOUR*/
+      {
+         1446, 5686,12632,17328,20690,23398,25618,27783,
+        29987,31675,33484,34389,36527,37395,37820,30062
+      },
+      /*Cr  qi=50  OC_MODE_GOLDEN_NOMV*/
+      {
+         1806, 5306, 9443,12574,14453,15988,17155,17452,
+        17527,17914,18244,18407,18877,19416,19935,20595
+      },
+      /*Cr  qi=50  OC_MODE_GOLDEN_MV*/
+      {
+         1631, 6164,12385,16675,18321,20231,20798,20495,
+        20418,19738,19277,19499,19958,20434,19564,20920
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=51  OC_MODE_INTRA*/
+      {
+         5361,10126,14415,16733,19177,21252,23133,24652,
+        26492,28207,29568,30476,31754,33088,34269,43215
+      },
+      /*Y'  qi=51  OC_MODE_INTER_NOMV*/
+      {
+         1830, 7669,14137,18486,21857,24539,26945,29192,
+        31319,33139,34792,36547,37950,39746,40984,49289
+      },
+      /*Y'  qi=51  OC_MODE_INTER_MV*/
+      {
+         2588, 8854,14019,18093,21365,23911,26080,28129,
+        30117,32045,33856,35359,36859,38147,39388,45274
+      },
+      /*Y'  qi=51  OC_MDOE_INTER_MV_LAST*/
+      {
+         2354, 9213,14138,18207,21174,23629,25948,28111,
+        30084,31987,33765,35395,36929,38356,39672,45171
+      },
+      /*Y'  qi=51  OC_MODE_INTER_MV_LAST2*/
+      {
+         1781, 9086,14067,18281,21464,23997,26227,28292,
+        30210,31916,33487,34864,36238,37282,38348,43573
+      },
+      /*Y'  qi=51  OC_MODE_INTER_MV_FOUR*/
+      {
+         1148, 7446,13731,17944,21224,23925,26295,28463,
+        30450,32273,33949,35454,36935,38280,39519,43944
+      },
+      /*Y'  qi=51  OC_MODE_GOLDEN_NOMV*/
+      {
+         1680, 7032,13567,17265,19843,22271,24900,27135,
+        29197,30719,32131,32949,33760,34819,35798,45647
+      },
+      /*Y'  qi=51  OC_MODE_GOLDEN_MV*/
+      {
+         1684, 7654,13760,18383,21586,24276,26771,29027,
+        31094,32836,34481,35825,37178,38090,39337,44599
+      }
+    },
+    {
+      /*Cb  qi=51  OC_MODE_INTRA*/
+      {
+         6275,14635,19082,22443,25609,27411,28891,30882,
+        33423,35766,37844,40263,41724,43266,44505,50809
+      },
+      /*Cb  qi=51  OC_MODE_INTER_NOMV*/
+      {
+         3502, 9124,17309,21126,25603,28700,51217,35675,
+        37791,39051,42442,43576,44020,49689,47979,46874
+      },
+      /*Cb  qi=51  OC_MODE_INTER_MV*/
+      {
+         5092,11943,18624,22043,26497,31495,35220,37695,
+        39478,45589,44037,45666,50413,51230,53471,52168
+      },
+      /*Cb  qi=51  OC_MDOE_INTER_MV_LAST*/
+      {
+         4512,11765,18693,22310,27439,32367,35301,37144,
+        38407,38635,38639,38223,37687,37423,36570,37475
+      },
+      /*Cb  qi=51  OC_MODE_INTER_MV_LAST2*/
+      {
+         4664,12154,18649,22073,26062,30622,34443,38591,
+        39906,41062,40690,43313,44522,54357,45872,55895
+      },
+      /*Cb  qi=51  OC_MODE_INTER_MV_FOUR*/
+      {
+         2794, 9527,18000,22218,26936,31815,35675,38821,
+        41868,43774,46081,46738,50080,52904,55980,56297
+      },
+      /*Cb  qi=51  OC_MODE_GOLDEN_NOMV*/
+      {
+         3487, 8883,13741,16033,20425,24003,25929,27256,
+        28972,30839,32135,32360,32126,32681,32536,36978
+      },
+      /*Cb  qi=51  OC_MODE_GOLDEN_MV*/
+      {
+         3290,10312,18697,22346,26157,29546,30344,30914,
+        31400,32074,31842,32387,32868,33523,33661,37513
+      }
+    },
+    {
+      /*Cr  qi=51  OC_MODE_INTRA*/
+      {
+         2796, 9244,13427,16332,18882,20971,23170,25317,
+        27400,28462,29454,31405,32992,33648,35347,40251
+      },
+      /*Cr  qi=51  OC_MODE_INTER_NOMV*/
+      {
+         1615, 5075,12012,16517,19867,22255,31296,23824,
+        25402,16120,12403,33621,29159,32249,31514,28448
+      },
+      /*Cr  qi=51  OC_MODE_INTER_MV*/
+      {
+         2221, 6192,12505,17561,21045,24040,26036,27808,
+        30539,30854,32352,34101,33029,34248,37564,33992
+      },
+      /*Cr  qi=51  OC_MDOE_INTER_MV_LAST*/
+      {
+         2364, 5897,12788,17999,21266,24020,25865,26100,
+        25537,23189,21625,20983,20747,20601,21546,19153
+      },
+      /*Cr  qi=51  OC_MODE_INTER_MV_LAST2*/
+      {
+         2329, 6199,12066,15423,19308,22974,25247,26117,
+        27830,25277,24568,23862,31606,32832,19173,31544
+      },
+      /*Cr  qi=51  OC_MODE_INTER_MV_FOUR*/
+      {
+         1446, 5686,12632,17328,20690,23398,25618,27783,
+        29987,31675,33484,34389,36527,37395,37820,30062
+      },
+      /*Cr  qi=51  OC_MODE_GOLDEN_NOMV*/
+      {
+         1806, 5306, 9443,12574,14453,15988,17155,17452,
+        17527,17914,18244,18407,18877,19416,19935,20595
+      },
+      /*Cr  qi=51  OC_MODE_GOLDEN_MV*/
+      {
+         1631, 6164,12385,16675,18321,20231,20798,20495,
+        20418,19738,19277,19499,19958,20434,19564,20920
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=52  OC_MODE_INTRA*/
+      {
+         6942,11991,16457,18879,21454,23664,25677,27337,
+        29250,31064,32508,33477,34840,36279,37573,47403
+      },
+      /*Y'  qi=52  OC_MODE_INTER_NOMV*/
+      {
+         2713, 9544,16191,20730,24399,27375,29921,32262,
+        34455,36337,38148,39941,41531,43352,44834,54542
+      },
+      /*Y'  qi=52  OC_MODE_INTER_MV*/
+      {
+         3061,10561,16064,20393,23669,26399,28758,30909,
+        32895,34700,36347,37845,39331,40676,41895,46387
+      },
+      /*Y'  qi=52  OC_MDOE_INTER_MV_LAST*/
+      {
+         3278,11234,16022,20347,23665,26432,28937,31226,
+        33286,35232,37083,38765,40481,42106,43510,49512
+      },
+      /*Y'  qi=52  OC_MODE_INTER_MV_LAST2*/
+      {
+         2586, 9404,16178,20793,24360,27064,29302,31472,
+        33529,35459,37086,38711,40332,41669,43198,50442
+      },
+      /*Y'  qi=52  OC_MODE_INTER_MV_FOUR*/
+      {
+         1971, 9159,15917,20316,23874,26807,29344,31625,
+        33772,35718,37550,39173,40825,42288,43606,48797
+      },
+      /*Y'  qi=52  OC_MODE_GOLDEN_NOMV*/
+      {
+         2728, 9078,15694,19512,22320,24977,27753,29999,
+        32323,34135,35512,36730,37973,39379,40963,51162
+      },
+      /*Y'  qi=52  OC_MODE_GOLDEN_MV*/
+      {
+         2811, 9650,15823,20601,24155,27078,29706,32086,
+        34196,36070,37745,39181,40696,41610,42919,48703
+      }
+    },
+    {
+      /*Cb  qi=52  OC_MODE_INTRA*/
+      {
+         7001,15640,20268,23732,27068,28932,30519,32606,
+        35300,37860,39882,42553,44256,45890,47586,54469
+      },
+      /*Cb  qi=52  OC_MODE_INTER_NOMV*/
+      {
+         3910,10326,18763,22755,27011,30647,38929,54016,
+        42381,42552,41727,44979,45195,47768,48092,54950
+      },
+      /*Cb  qi=52  OC_MODE_INTER_MV*/
+      {
+         2839,12332,19556,23811,28188,33842,38441,41529,
+        44077,47215,47995,50845,51287,56572,59388,61119
+      },
+      /*Cb  qi=52  OC_MDOE_INTER_MV_LAST*/
+      {
+         5697,11898,20027,23846,29489,34637,37962,39702,
+        41208,41526,41673,41743,40312,40658,39562,40304
+      },
+      /*Cb  qi=52  OC_MODE_INTER_MV_LAST2*/
+      {
+         4898,12851,20173,23885,28565,33455,37149,42363,
+        43435,46882,45839,50182,47159,57128,54509,56084
+      },
+      /*Cb  qi=52  OC_MODE_INTER_MV_FOUR*/
+      {
+         3253,10302,19227,23580,28576,33668,37929,41368,
+        44320,47160,48781,51051,52705,55093,58639,58079
+      },
+      /*Cb  qi=52  OC_MODE_GOLDEN_NOMV*/
+      {
+         4100, 9860,14696,16871,21243,25206,27593,29623,
+        31052,33781,35864,37355,36537,36954,36080,39582
+      },
+      /*Cb  qi=52  OC_MODE_GOLDEN_MV*/
+      {
+         3562,11291,19980,23810,27891,31821,32188,33053,
+        33608,34336,34483,35035,35639,36026,35956,40604
+      }
+    },
+    {
+      /*Cr  qi=52  OC_MODE_INTRA*/
+      {
+         3090,10208,14576,17637,20323,22521,24817,27029,
+        29238,30266,31426,33247,35152,35685,37319,42759
+      },
+      /*Cr  qi=52  OC_MODE_INTER_NOMV*/
+      {
+         1913, 6017,13114,17763,20962,23199,37623,28783,
+        25681,16197,27776,34368,31840,22199,17085,30112
+      },
+      /*Cr  qi=52  OC_MODE_INTER_MV*/
+      {
+         1640, 7068,13902,18090,20975,24542,27264,30163,
+        33166,34515,38615,36838,37795,40035,39768,39071
+      },
+      /*Cr  qi=52  OC_MDOE_INTER_MV_LAST*/
+      {
+         2635, 6712,14395,19858,23101,25867,27705,27713,
+        27415,24943,22739,22318,22147,22455,23541,19607
+      },
+      /*Cr  qi=52  OC_MODE_INTER_MV_LAST2*/
+      {
+         2431, 7250,13547,19061,23102,25840,27660,28193,
+        29441,24942,18720,30388,32843,40704,32960,26487
+      },
+      /*Cr  qi=52  OC_MODE_INTER_MV_FOUR*/
+      {
+         1728, 6590,13857,18883,22513,25372,27725,29862,
+        31584,35000,35402,36247,37820,40576,39450,34776
+      },
+      /*Cr  qi=52  OC_MODE_GOLDEN_NOMV*/
+      {
+         2241, 6300,10332,13768,15832,17725,20399,20062,
+        19519,19881,19100,19828,20381,20863,24843,24792
+      },
+      /*Cr  qi=52  OC_MODE_GOLDEN_MV*/
+      {
+         1949, 7029,13637,17827,19809,21670,22736,22379,
+        22373,21740,21140,21895,22367,22341,22664,23133
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=53  OC_MODE_INTRA*/
+      {
+         6942,11991,16457,18879,21454,23664,25677,27337,
+        29250,31064,32508,33477,34840,36279,37573,47403
+      },
+      /*Y'  qi=53  OC_MODE_INTER_NOMV*/
+      {
+         2713, 9544,16191,20730,24399,27375,29921,32262,
+        34455,36337,38148,39941,41531,43352,44834,54542
+      },
+      /*Y'  qi=53  OC_MODE_INTER_MV*/
+      {
+         3061,10561,16064,20393,23669,26399,28758,30909,
+        32895,34700,36347,37845,39331,40676,41895,46387
+      },
+      /*Y'  qi=53  OC_MDOE_INTER_MV_LAST*/
+      {
+         3278,11234,16022,20347,23665,26432,28937,31226,
+        33286,35232,37083,38765,40481,42106,43510,49512
+      },
+      /*Y'  qi=53  OC_MODE_INTER_MV_LAST2*/
+      {
+         2586, 9404,16178,20793,24360,27064,29302,31472,
+        33529,35459,37086,38711,40332,41669,43198,50442
+      },
+      /*Y'  qi=53  OC_MODE_INTER_MV_FOUR*/
+      {
+         1971, 9159,15917,20316,23874,26807,29344,31625,
+        33772,35718,37550,39173,40825,42288,43606,48797
+      },
+      /*Y'  qi=53  OC_MODE_GOLDEN_NOMV*/
+      {
+         2728, 9078,15694,19512,22320,24977,27753,29999,
+        32323,34135,35512,36730,37973,39379,40963,51162
+      },
+      /*Y'  qi=53  OC_MODE_GOLDEN_MV*/
+      {
+         2811, 9650,15823,20601,24155,27078,29706,32086,
+        34196,36070,37745,39181,40696,41610,42919,48703
+      }
+    },
+    {
+      /*Cb  qi=53  OC_MODE_INTRA*/
+      {
+         7001,15640,20268,23732,27068,28932,30519,32606,
+        35300,37860,39882,42553,44256,45890,47586,54469
+      },
+      /*Cb  qi=53  OC_MODE_INTER_NOMV*/
+      {
+         3910,10326,18763,22755,27011,30647,38929,54016,
+        42381,42552,41727,44979,45195,47768,48092,54950
+      },
+      /*Cb  qi=53  OC_MODE_INTER_MV*/
+      {
+         2839,12332,19556,23811,28188,33842,38441,41529,
+        44077,47215,47995,50845,51287,56572,59388,61119
+      },
+      /*Cb  qi=53  OC_MDOE_INTER_MV_LAST*/
+      {
+         5697,11898,20027,23846,29489,34637,37962,39702,
+        41208,41526,41673,41743,40312,40658,39562,40304
+      },
+      /*Cb  qi=53  OC_MODE_INTER_MV_LAST2*/
+      {
+         4898,12851,20173,23885,28565,33455,37149,42363,
+        43435,46882,45839,50182,47159,57128,54509,56084
+      },
+      /*Cb  qi=53  OC_MODE_INTER_MV_FOUR*/
+      {
+         3253,10302,19227,23580,28576,33668,37929,41368,
+        44320,47160,48781,51051,52705,55093,58639,58079
+      },
+      /*Cb  qi=53  OC_MODE_GOLDEN_NOMV*/
+      {
+         4100, 9860,14696,16871,21243,25206,27593,29623,
+        31052,33781,35864,37355,36537,36954,36080,39582
+      },
+      /*Cb  qi=53  OC_MODE_GOLDEN_MV*/
+      {
+         3562,11291,19980,23810,27891,31821,32188,33053,
+        33608,34336,34483,35035,35639,36026,35956,40604
+      }
+    },
+    {
+      /*Cr  qi=53  OC_MODE_INTRA*/
+      {
+         3090,10208,14576,17637,20323,22521,24817,27029,
+        29238,30266,31426,33247,35152,35685,37319,42759
+      },
+      /*Cr  qi=53  OC_MODE_INTER_NOMV*/
+      {
+         1913, 6017,13114,17763,20962,23199,37623,28783,
+        25681,16197,27776,34368,31840,22199,17085,30112
+      },
+      /*Cr  qi=53  OC_MODE_INTER_MV*/
+      {
+         1640, 7068,13902,18090,20975,24542,27264,30163,
+        33166,34515,38615,36838,37795,40035,39768,39071
+      },
+      /*Cr  qi=53  OC_MDOE_INTER_MV_LAST*/
+      {
+         2635, 6712,14395,19858,23101,25867,27705,27713,
+        27415,24943,22739,22318,22147,22455,23541,19607
+      },
+      /*Cr  qi=53  OC_MODE_INTER_MV_LAST2*/
+      {
+         2431, 7250,13547,19061,23102,25840,27660,28193,
+        29441,24942,18720,30388,32843,40704,32960,26487
+      },
+      /*Cr  qi=53  OC_MODE_INTER_MV_FOUR*/
+      {
+         1728, 6590,13857,18883,22513,25372,27725,29862,
+        31584,35000,35402,36247,37820,40576,39450,34776
+      },
+      /*Cr  qi=53  OC_MODE_GOLDEN_NOMV*/
+      {
+         2241, 6300,10332,13768,15832,17725,20399,20062,
+        19519,19881,19100,19828,20381,20863,24843,24792
+      },
+      /*Cr  qi=53  OC_MODE_GOLDEN_MV*/
+      {
+         1949, 7029,13637,17827,19809,21670,22736,22379,
+        22373,21740,21140,21895,22367,22341,22664,23133
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=54  OC_MODE_INTRA*/
+      {
+         6939,11990,16457,18878,21450,23659,25678,27336,
+        29251,31065,32507,33479,34845,36274,37577,47400
+      },
+      /*Y'  qi=54  OC_MODE_INTER_NOMV*/
+      {
+         2714, 9542,16185,20720,24387,27359,29909,32274,
+        34436,36342,38197,39982,41647,43476,44928,54250
+      },
+      /*Y'  qi=54  OC_MODE_INTER_MV*/
+      {
+         3074,10564,16064,20386,23675,26400,28754,30908,
+        32893,34703,36346,37850,39332,40684,41898,46358
+      },
+      /*Y'  qi=54  OC_MDOE_INTER_MV_LAST*/
+      {
+         3269,11234,16023,20348,23666,26432,28939,31218,
+        33282,35230,37084,38756,40494,42097,43535,49507
+      },
+      /*Y'  qi=54  OC_MODE_INTER_MV_LAST2*/
+      {
+         2575, 9412,16189,20801,24356,27057,29317,31482,
+        33498,35456,37086,38697,40176,41632,43225,50519
+      },
+      /*Y'  qi=54  OC_MODE_INTER_MV_FOUR*/
+      {
+         1971, 9160,15916,20315,23876,26807,29343,31631,
+        33772,35714,37551,39181,40814,42286,43618,48781
+      },
+      /*Y'  qi=54  OC_MODE_GOLDEN_NOMV*/
+      {
+         2725, 9089,15716,19548,22368,24993,27748,30002,
+        32304,34062,35559,36764,37966,39313,40934,51150
+      },
+      /*Y'  qi=54  OC_MODE_GOLDEN_MV*/
+      {
+         2813, 9646,15829,20606,24154,27079,29708,32082,
+        34194,36087,37751,39172,40708,41616,42938,48690
+      }
+    },
+    {
+      /*Cb  qi=54  OC_MODE_INTRA*/
+      {
+         7000,15639,20267,23731,27079,28935,30496,32612,
+        35348,37832,39874,42628,44225,45853,47624,54619
+      },
+      /*Cb  qi=54  OC_MODE_INTER_NOMV*/
+      {
+         3915,10331,18770,22716,26688,31032,39280,54016,
+        43067,44141,44586,46656,48242,48233,48662,52872
+      },
+      /*Cb  qi=54  OC_MODE_INTER_MV*/
+      {
+         2835,12328,19552,23794,28180,33859,38359,41700,
+        43980,47825,47205,51052,53495,54940,58546,62077
+      },
+      /*Cb  qi=54  OC_MDOE_INTER_MV_LAST*/
+      {
+         5693,11900,20026,23847,29503,34609,37953,39765,
+        41155,41539,41989,41578,40179,40732,39851,40295
+      },
+      /*Cb  qi=54  OC_MODE_INTER_MV_LAST2*/
+      {
+         4903,12896,20178,23879,28654,33442,36822,41682,
+        44267,45093,45580,48273,48344,51596,56965,53573
+      },
+      /*Cb  qi=54  OC_MODE_INTER_MV_FOUR*/
+      {
+         3251,10299,19221,23581,28570,33719,37991,41428,
+        44370,47240,48805,50934,51936,54540,59269,58003
+      },
+      /*Cb  qi=54  OC_MODE_GOLDEN_NOMV*/
+      {
+         4106, 9870,14715,16873,21676,25221,27562,29680,
+        31095,33664,35938,37511,36796,36684,36510,39624
+      },
+      /*Cb  qi=54  OC_MODE_GOLDEN_MV*/
+      {
+         3568,11287,19977,23806,27891,31789,32200,33087,
+        33661,34285,34478,34806,35537,36018,35758,40676
+      }
+    },
+    {
+      /*Cr  qi=54  OC_MODE_INTRA*/
+      {
+         3089,10206,14573,17636,20324,22528,24827,27012,
+        29227,30299,31497,33252,35183,35703,37458,42839
+      },
+      /*Cr  qi=54  OC_MODE_INTER_NOMV*/
+      {
+         1915, 6014,13097,17803,21132,22981,37623,29168,
+        26427,17279,27776,35296,32160,20701,16395,30112
+      },
+      /*Cr  qi=54  OC_MODE_INTER_MV*/
+      {
+         1643, 7071,13899,18069,21037,24370,27377,29606,
+        33654,34600,38237,37134,36995,40729,39803,39966
+      },
+      /*Cr  qi=54  OC_MDOE_INTER_MV_LAST*/
+      {
+         2635, 6711,14398,19825,23117,25902,27668,27671,
+        27408,25053,22765,22355,21909,22539,24022,19497
+      },
+      /*Cr  qi=54  OC_MODE_INTER_MV_LAST2*/
+      {
+         2433, 7248,13472,19130,23128,25802,27590,28323,
+        29628,25838,18991,30792,32605,40704,32720,25655
+      },
+      /*Cr  qi=54  OC_MODE_INTER_MV_FOUR*/
+      {
+         1728, 6588,13854,18893,22505,25340,27735,29968,
+        31700,34893,35627,36436,38711,40614,37385,34772
+      },
+      /*Cr  qi=54  OC_MODE_GOLDEN_NOMV*/
+      {
+         2243, 6319,10398,13773,15874,17831,20498,20199,
+        19730,20041,19071,19875,20495,21167,24878,24920
+      },
+      /*Cr  qi=54  OC_MODE_GOLDEN_MV*/
+      {
+         1950, 7028,13617,17823,19815,21669,22761,22381,
+        22366,21860,21100,21856,22408,22441,22429,23113
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=55  OC_MODE_INTRA*/
+      {
+         7585,12859,17340,19754,22352,24594,26651,28354,
+        30320,32169,33644,34653,36101,37580,38931,49238
+      },
+      /*Y'  qi=55  OC_MODE_INTER_NOMV*/
+      {
+         3105,10351,16966,21522,25295,28435,31088,33482,
+        35618,37695,39549,41565,43324,45349,46520,56481
+      },
+      /*Y'  qi=55  OC_MODE_INTER_MV*/
+      {
+         3284,11146,16951,21383,24779,27567,29980,32168,
+        34211,36078,37807,39385,40925,42302,43603,48003
+      },
+      /*Y'  qi=55  OC_MDOE_INTER_MV_LAST*/
+      {
+         3538,12132,16985,21382,24751,27551,30132,32514,
+        34675,36760,38747,40499,42257,44002,45477,51573
+      },
+      /*Y'  qi=55  OC_MODE_INTER_MV_LAST2*/
+      {
+         2702,11774,17584,22060,25538,28260,30554,32757,
+        34893,36812,38666,40431,42064,43617,45302,52231
+      },
+      /*Y'  qi=55  OC_MODE_INTER_MV_FOUR*/
+      {
+         2188, 9916,16802,21261,24912,27930,30562,32936,
+        35166,37222,39180,40866,42607,44166,45563,50923
+      },
+      /*Y'  qi=55  OC_MODE_GOLDEN_NOMV*/
+      {
+         2933, 9597,16328,20313,23215,25961,28848,31210,
+        33585,35498,36962,38124,39194,40411,41845,53158
+      },
+      /*Y'  qi=55  OC_MODE_GOLDEN_MV*/
+      {
+         3063,10372,16822,21658,25252,28244,30988,33452,
+        35634,37588,39373,40874,42472,43583,44796,50811
+      }
+    },
+    {
+      /*Cb  qi=55  OC_MODE_INTRA*/
+      {
+         7416,16297,21039,24504,27870,29777,31345,33558,
+        36278,38899,41080,43724,45586,47217,49085,56651
+      },
+      /*Cb  qi=55  OC_MODE_INTER_NOMV*/
+      {
+         4217,11174,19493,23702,28146,32313,38831,38804,
+        42737,42272,44050,50053,49242,52475,48444,55586
+      },
+      /*Cb  qi=55  OC_MODE_INTER_MV*/
+      {
+         3126,13212,20271,24583,28998,35094,39781,43271,
+        45360,49496,50351,52691,53234,59560,61704,61128
+      },
+      /*Cb  qi=55  OC_MDOE_INTER_MV_LAST*/
+      {
+         6190,12780,20942,24785,30629,35826,39366,41367,
+        42680,43065,43422,42682,41616,41920,41311,41791
+      },
+      /*Cb  qi=55  OC_MODE_INTER_MV_LAST2*/
+      {
+         5413,14398,21074,24820,29903,35286,39037,43983,
+        45659,46868,44402,47100,47702,54990,56656,56413
+      },
+      /*Cb  qi=55  OC_MODE_INTER_MV_FOUR*/
+      {
+         3496,10924,20086,24578,29799,35015,39448,42932,
+        46074,48597,50950,50467,55799,54860,62281,61182
+      },
+      /*Cb  qi=55  OC_MODE_GOLDEN_NOMV*/
+      {
+         4228,10369,15068,17132,21717,25401,28176,30286,
+        32341,34567,37443,38820,37404,37780,36951,41108
+      },
+      /*Cb  qi=55  OC_MODE_GOLDEN_MV*/
+      {
+         3682,11981,20881,24812,29116,32852,33284,34239,
+        34720,34839,36051,35597,36435,37083,37247,41844
+      }
+    },
+    {
+      /*Cr  qi=55  OC_MODE_INTRA*/
+      {
+         3575,11455,16124,19346,22204,24571,27013,29342,
+        31740,32916,34184,36135,37848,38617,40319,46117
+      },
+      /*Cr  qi=55  OC_MODE_INTER_NOMV*/
+      {
+         2422, 7403,15067,20396,23597,28400,27352,29243,
+        31348,19303,15051,35360,36689,30081,36568,28259
+      },
+      /*Cr  qi=55  OC_MODE_INTER_MV*/
+      {
+         2053, 8481,15452,19927,23193,26884,29707,33217,
+        37089,38607,42357,40236,41840,43810,43112,43514
+      },
+      /*Cr  qi=55  OC_MDOE_INTER_MV_LAST*/
+      {
+         3370, 7873,16195,22017,25435,28319,30041,30460,
+        29632,27090,25774,24567,24113,24757,23945,21423
+      },
+      /*Cr  qi=55  OC_MODE_INTER_MV_LAST2*/
+      {
+         3306, 8435,15231,21116,25011,28261,30169,30911,
+        32197,28294,28318,25999,32496,40277,37973,30352
+      },
+      /*Cr  qi=55  OC_MODE_INTER_MV_FOUR*/
+      {
+         2167, 7840,15704,21039,24888,27850,30421,32616,
+        34906,37697,38563,39848,42179,43795,43041,33918
+      },
+      /*Cr  qi=55  OC_MODE_GOLDEN_NOMV*/
+      {
+         2680, 7436,11333,15200,17644,19595,22134,22281,
+        21595,21810,21651,22292,23404,23402,25650,27281
+      },
+      /*Cr  qi=55  OC_MODE_GOLDEN_MV*/
+      {
+         2398, 8253,15611,20188,22074,24116,25295,24498,
+        24616,24259,23507,24188,24720,24464,25070,25328
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=56  OC_MODE_INTRA*/
+      {
+         7585,12871,17341,19762,22365,24609,26666,28356,
+        30322,32178,33644,34656,36112,37592,38942,49248
+      },
+      /*Y'  qi=56  OC_MODE_INTER_NOMV*/
+      {
+         3121,10358,16966,21526,25334,28436,31069,33529,
+        35690,37771,39683,41528,43362,45109,47107,57055
+      },
+      /*Y'  qi=56  OC_MODE_INTER_MV*/
+      {
+         3268,11129,16954,21392,24792,27588,30009,32182,
+        34219,36117,37871,39476,41006,42465,43735,48208
+      },
+      /*Y'  qi=56  OC_MDOE_INTER_MV_LAST*/
+      {
+         3564,12171,16992,21380,24753,27554,30144,32560,
+        34769,36829,38755,40542,42318,44082,45553,51566
+      },
+      /*Y'  qi=56  OC_MODE_INTER_MV_LAST2*/
+      {
+         2690,11759,17505,21957,25491,28249,30577,32787,
+        34853,36837,38708,40500,42108,43688,45325,52288
+      },
+      /*Y'  qi=56  OC_MODE_INTER_MV_FOUR*/
+      {
+         2192, 9938,16778,21252,24908,27924,30555,32946,
+        35186,37237,39188,40898,42617,44168,45536,50910
+      },
+      /*Y'  qi=56  OC_MODE_GOLDEN_NOMV*/
+      {
+         2926, 9654,16330,20260,23144,25931,28960,31157,
+        33637,35476,37077,38276,39201,40397,42148,53164
+      },
+      /*Y'  qi=56  OC_MODE_GOLDEN_MV*/
+      {
+         3072,10306,16797,21655,25247,28252,31000,33464,
+        35623,37587,39371,40874,42470,43532,44777,50830
+      }
+    },
+    {
+      /*Cb  qi=56  OC_MODE_INTRA*/
+      {
+         7384,16297,21041,24492,27858,29762,31381,33577,
+        36301,38884,41052,43782,45687,47311,49165,56729
+      },
+      /*Cb  qi=56  OC_MODE_INTER_NOMV*/
+      {
+         4223,11150,19540,23732,27696,31896,40399,54400,
+        50339,42353,42818,46207,43150,50352,50234,62960
+      },
+      /*Cb  qi=56  OC_MODE_INTER_MV*/
+      {
+         3021,13192,20359,24749,29312,35323,40121,43538,
+        45848,48121,51429,53594,53762,57173,63242,64059
+      },
+      /*Cb  qi=56  OC_MDOE_INTER_MV_LAST*/
+      {
+         6264,12799,20919,24744,30556,35734,39322,41250,
+        42683,42894,43396,42804,41778,42385,41013,41546
+      },
+      /*Cb  qi=56  OC_MODE_INTER_MV_LAST2*/
+      {
+         5338,14356,21063,24855,30098,34982,38422,45065,
+        45664,49718,47681,51025,51086,58656,56594,62306
+      },
+      /*Cb  qi=56  OC_MODE_INTER_MV_FOUR*/
+      {
+         3498,10926,20081,24560,29744,35008,39490,43082,
+        46331,48458,50790,53181,55030,55308,63275,65277
+      },
+      /*Cb  qi=56  OC_MODE_GOLDEN_NOMV*/
+      {
+         4232,10278,14962,17178,21532,25310,28372,30519,
+        32394,34840,37637,39115,38061,38234,37777,41266
+      },
+      /*Cb  qi=56  OC_MODE_GOLDEN_MV*/
+      {
+         3698,11978,20885,24812,29131,32844,33268,34137,
+        34757,34844,35813,35865,36478,36963,37343,42009
+      }
+    },
+    {
+      /*Cr  qi=56  OC_MODE_INTRA*/
+      {
+         3595,11453,16130,19349,22206,24589,27043,29340,
+        31752,32985,34194,36177,37945,38793,40537,46143
+      },
+      /*Cr  qi=56  OC_MODE_INTER_NOMV*/
+      {
+         2424, 7381,15014,20073,23315,26847,41872,27792,
+        28959,18367,14623,19797,25436,22354,17966,12709
+      },
+      /*Cr  qi=56  OC_MODE_INTER_MV*/
+      {
+         2018, 8424,15590,20045,23493,27155,29904,33587,
+        36718,38442,41587,40860,42112,44183,42955,45661
+      },
+      /*Cr  qi=56  OC_MDOE_INTER_MV_LAST*/
+      {
+         3394, 7865,16102,21999,25449,28282,30023,30411,
+        29506,27349,25705,25074,24243,25718,26203,23613
+      },
+      /*Cr  qi=56  OC_MODE_INTER_MV_LAST2*/
+      {
+         3295, 8490,15246,21248,25320,28358,30311,32545,
+        32226,28425,27738,32309,38061,34880,35728,42547
+      },
+      /*Cr  qi=56  OC_MODE_INTER_MV_FOUR*/
+      {
+         2167, 7849,15688,21025,24893,27870,30426,32651,
+        34917,37723,39130,39769,41273,44617,43303,47247
+      },
+      /*Cr  qi=56  OC_MODE_GOLDEN_NOMV*/
+      {
+         2685, 7397,11313,15310,17675,19678,22323,22299,
+        21613,22043,21820,22601,23258,23773,26846,27682
+      },
+      /*Cr  qi=56  OC_MODE_GOLDEN_MV*/
+      {
+         2402, 8253,15590,20113,22107,24125,25160,24464,
+        24541,24316,23503,24236,24757,24559,24980,25583
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=57  OC_MODE_INTRA*/
+      {
+         7586,12855,17352,19773,22374,24626,26680,28373,
+        30345,32210,33673,34677,36132,37624,38970,49274
+      },
+      /*Y'  qi=57  OC_MODE_INTER_NOMV*/
+      {
+         3121,10402,16880,21450,25354,28477,31076,33416,
+        35529,37699,39490,41251,43209,45324,46774,57834
+      },
+      /*Y'  qi=57  OC_MODE_INTER_MV*/
+      {
+         3294,11185,16991,21364,24762,27506,29955,32150,
+        34228,36092,37833,39415,40978,42342,43678,48175
+      },
+      /*Y'  qi=57  OC_MDOE_INTER_MV_LAST*/
+      {
+         3586,12162,16976,21367,24746,27557,30137,32542,
+        34691,36722,38715,40502,42320,43970,45524,51590
+      },
+      /*Y'  qi=57  OC_MODE_INTER_MV_LAST2*/
+      {
+         2656,11583,17454,21988,25511,28238,30524,32695,
+        34816,36787,38537,40314,41963,43523,45134,52245
+      },
+      /*Y'  qi=57  OC_MODE_INTER_MV_FOUR*/
+      {
+         2209, 9948,16743,21280,24932,27938,30562,32947,
+        35187,37230,39169,40885,42620,44167,45587,50900
+      },
+      /*Y'  qi=57  OC_MODE_GOLDEN_NOMV*/
+      {
+         2928, 9834,16255,20101,23088,26009,28802,31163,
+        33702,35361,37149,38340,39222,40450,41953,53207
+      },
+      /*Y'  qi=57  OC_MODE_GOLDEN_MV*/
+      {
+         3100,10292,16821,21663,25244,28233,30998,33463,
+        35621,37594,39368,40869,42456,43536,44778,50849
+      }
+    },
+    {
+      /*Cb  qi=57  OC_MODE_INTRA*/
+      {
+         7423,16292,21043,24501,27863,29784,31384,33604,
+        36261,38926,41043,43769,45708,47330,49174,56573
+      },
+      /*Cb  qi=57  OC_MODE_INTER_NOMV*/
+      {
+         4177,11235,19594,23757,27222,31517,39359,54656,
+        43467,50889,41737,42532,49158,52144,47945,56449
+      },
+      /*Cb  qi=57  OC_MODE_INTER_MV*/
+      {
+         2973,13176,20352,24693,29228,35174,39978,43546,
+        45192,48203,51132,52948,53287,58653,64472,65138
+      },
+      /*Cb  qi=57  OC_MDOE_INTER_MV_LAST*/
+      {
+         6237,12731,20914,24767,30636,35872,39337,41328,
+        42751,43011,43264,42554,41819,42063,42195,41683
+      },
+      /*Cb  qi=57  OC_MODE_INTER_MV_LAST2*/
+      {
+         5262,14258,21053,24859,30101,35355,39030,43759,
+        45385,50760,48525,48502,51213,56576,56753,63022
+      },
+      /*Cb  qi=57  OC_MODE_INTER_MV_FOUR*/
+      {
+         3501,10892,20085,24557,29730,35021,39449,43086,
+        45774,48760,50899,53835,54580,57073,64425,61761
+      },
+      /*Cb  qi=57  OC_MODE_GOLDEN_NOMV*/
+      {
+         4277,10237,14889,17099,21219,24892,27698,30154,
+        32181,34756,37616,38767,37628,38391,38034,40967
+      },
+      /*Cb  qi=57  OC_MODE_GOLDEN_MV*/
+      {
+         3691,11971,20888,24806,29092,32818,33207,34163,
+        34811,34959,36092,35901,36805,37152,37381,42040
+      }
+    },
+    {
+      /*Cr  qi=57  OC_MODE_INTRA*/
+      {
+         3581,11456,16128,19350,22200,24575,27000,29315,
+        31757,32960,34233,36195,38006,38690,40432,46117
+      },
+      /*Cr  qi=57  OC_MODE_INTER_NOMV*/
+      {
+         2390, 7475,15027,20114,23606,26567,47488,29806,
+        27168,16763,13333,20055,24279,18928,15239,11996
+      },
+      /*Cr  qi=57  OC_MODE_INTER_MV*/
+      {
+         2057, 8403,15491,19986,23442,27101,29997,33075,
+        36533,38268,40159,41724,41447,43596,42287,45303
+      },
+      /*Cr  qi=57  OC_MDOE_INTER_MV_LAST*/
+      {
+         3358, 7868,16179,22001,25462,28262,30015,30294,
+        29770,27661,25554,25621,24831,26117,25522,23901
+      },
+      /*Cr  qi=57  OC_MODE_INTER_MV_LAST2*/
+      {
+         3203, 8472,15289,21221,25366,28243,30157,32358,
+        32142,28049,27928,33351,35872,39738,37472,40934
+      },
+      /*Cr  qi=57  OC_MODE_INTER_MV_FOUR*/
+      {
+         2166, 7807,15692,21023,24874,27880,30443,32707,
+        35103,37921,38523,40494,41108,44124,42001,45736
+      },
+      /*Cr  qi=57  OC_MODE_GOLDEN_NOMV*/
+      {
+         2731, 7355,11248,14946,17637,19683,22173,22182,
+        21510,21880,21610,22377,22977,23626,25965,27288
+      },
+      /*Cr  qi=57  OC_MODE_GOLDEN_MV*/
+      {
+         2401, 8251,15608,20189,22068,24140,25231,24577,
+        24702,24374,23531,24371,24815,24890,24857,25540
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=58  OC_MODE_INTRA*/
+      {
+         9977,15841,20720,23042,25852,28204,30557,32457,
+        34628,36710,38352,39461,41099,42803,44300,55700
+      },
+      /*Y'  qi=58  OC_MODE_INTER_NOMV*/
+      {
+         4708,13186,20448,25800,29419,32290,34647,36938,
+        39477,41690,43829,46363,48217,50592,53434,63064
+      },
+      /*Y'  qi=58  OC_MODE_INTER_MV*/
+      {
+         4894,15280,20870,25222,28735,31424,33789,36195,
+        38579,40922,43217,45211,47184,48886,50606,57540
+      },
+      /*Y'  qi=58  OC_MDOE_INTER_MV_LAST*/
+      {
+         4848,15713,21053,25430,28691,31396,33894,36274,
+        38538,40745,42900,44859,46713,48264,49942,57074
+      },
+      /*Y'  qi=58  OC_MODE_INTER_MV_LAST2*/
+      {
+         4913,14273,20156,25100,28730,31533,34022,36471,
+        38780,41181,43404,45378,47248,48962,50814,58654
+      },
+      /*Y'  qi=58  OC_MODE_INTER_MV_FOUR*/
+      {
+         3622,12798,19914,24876,28723,31824,34542,37063,
+        39435,41710,43831,45778,47696,49470,51079,56822
+      },
+      /*Y'  qi=58  OC_MODE_GOLDEN_NOMV*/
+      {
+         4462,12361,19266,23612,27041,30258,33292,35731,
+        38178,39897,41795,43235,44181,45479,47075,59417
+      },
+      /*Y'  qi=58  OC_MODE_GOLDEN_MV*/
+      {
+         4734,12917,20352,25419,29036,31970,34747,37263,
+        39721,41967,43987,45821,47597,48948,50446,56684
+      }
+    },
+    {
+      /*Cb  qi=58  OC_MODE_INTRA*/
+      {
+         7382,16784,21595,24852,28243,30090,31591,33827,
+        36626,39224,41482,44298,46191,47634,49552,57567
+      },
+      /*Cb  qi=58  OC_MODE_INTER_NOMV*/
+      {
+         5258,12657,21444,25131,29236,34301,38339,37906,
+        47915,43269,46811,42285,47324,47125,58518,62304
+      },
+      /*Cb  qi=58  OC_MODE_INTER_MV*/
+      {
+         5495,14061,21342,25271,30612,35804,39867,43376,
+        43196,50963,51748,52862,55003,56510,64768,59848
+      },
+      /*Cb  qi=58  OC_MDOE_INTER_MV_LAST*/
+      {
+         2959,14209,21425,25415,30837,36301,39780,41995,
+        43185,43428,43764,43605,42625,42408,42350,42341
+      },
+      /*Cb  qi=58  OC_MODE_INTER_MV_LAST2*/
+      {
+         5645,13461,21411,25385,30369,35320,39253,44419,
+        46993,48328,45686,50755,48981,58627,50523,57217
+      },
+      /*Cb  qi=58  OC_MODE_INTER_MV_FOUR*/
+      {
+         3619,11280,20558,25194,30269,35629,40322,44038,
+        46971,49765,51025,52656,56950,55936,60694,60055
+      },
+      /*Cb  qi=58  OC_MODE_GOLDEN_NOMV*/
+      {
+         4337,10335,14813,17017,21075,24441,27550,30311,
+        32556,35667,37076,39095,37896,38037,38469,41921
+      },
+      /*Cb  qi=58  OC_MODE_GOLDEN_MV*/
+      {
+         3480,12298,21550,25498,29605,33271,34051,34843,
+        34776,35514,36624,36715,36887,37594,38124,42711
+      }
+    },
+    {
+      /*Cr  qi=58  OC_MODE_INTRA*/
+      {
+         4165,12467,17381,20765,23798,26284,28820,31413,
+        33880,35298,36489,38562,40133,40865,42859,48961
+      },
+      /*Cr  qi=58  OC_MODE_INTER_NOMV*/
+      {
+         3462, 8884,17548,22970,25569,31411,31220,33168,
+        30952,36032,14234,39694,34436,32896,39211,35212
+      },
+      /*Cr  qi=58  OC_MODE_INTER_MV*/
+      {
+         4127, 9528,17455,22786,26788,30685,33320,34808,
+        37309,39336,42532,40669,42004,40812,42220,41171
+      },
+      /*Cr  qi=58  OC_MDOE_INTER_MV_LAST*/
+      {
+         3324, 9372,17248,22657,26761,30077,31901,32302,
+        31793,29032,27803,26443,26064,27230,28172,24536
+      },
+      /*Cr  qi=58  OC_MODE_INTER_MV_LAST2*/
+      {
+         3495, 9698,17298,23143,26985,30248,32325,33497,
+        34459,26332,30242,26226,32413,36294,34474,30592
+      },
+      /*Cr  qi=58  OC_MODE_INTER_MV_FOUR*/
+      {
+         2623, 8879,17180,22756,26776,29873,32491,35108,
+        37423,40548,41935,41627,42581,40586,36359,27151
+      },
+      /*Cr  qi=58  OC_MODE_GOLDEN_NOMV*/
+      {
+         3196, 8291,11952,15640,18778,21048,23723,23803,
+        23872,24238,23392,24236,24499,25635,26774,28810
+      },
+      /*Cr  qi=58  OC_MODE_GOLDEN_MV*/
+      {
+         2693, 9483,17195,21918,23982,25880,27041,26600,
+        26539,26189,25242,26242,26972,26806,26422,27101
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=59  OC_MODE_INTRA*/
+      {
+         9985,15837,20723,23049,25866,28216,30588,32484,
+        34636,36716,38357,39473,41116,42811,44317,55694
+      },
+      /*Y'  qi=59  OC_MODE_INTER_NOMV*/
+      {
+         4760,13189,20360,25766,29387,32264,34563,36913,
+        39342,41838,44369,46832,49157,51466,52925,63586
+      },
+      /*Y'  qi=59  OC_MODE_INTER_MV*/
+      {
+         4870,15122,20915,25414,28852,31499,33926,36246,
+        38641,40986,43278,45329,47221,49064,50568,57919
+      },
+      /*Y'  qi=59  OC_MDOE_INTER_MV_LAST*/
+      {
+         4904,15769,21069,25435,28679,31375,33873,36267,
+        38546,40733,42868,44878,46663,48356,49938,56975
+      },
+      /*Y'  qi=59  OC_MODE_INTER_MV_LAST2*/
+      {
+         4951,14635,20578,25106,28631,31399,33869,36293,
+        38660,40918,43140,45154,47035,48824,50464,57905
+      },
+      /*Y'  qi=59  OC_MODE_INTER_MV_FOUR*/
+      {
+         3628,12842,19882,24858,28724,31836,34548,37071,
+        39463,41715,43883,45786,47741,49508,51075,56876
+      },
+      /*Y'  qi=59  OC_MODE_GOLDEN_NOMV*/
+      {
+         4475,12377,19169,23626,27127,30316,33371,35814,
+        38391,40046,41951,43367,44225,45622,47291,59594
+      },
+      /*Y'  qi=59  OC_MODE_GOLDEN_MV*/
+      {
+         4693,12913,20378,25404,29008,31964,34691,37233,
+        39686,41861,43995,45732,47576,48785,50318,56845
+      }
+    },
+    {
+      /*Cb  qi=59  OC_MODE_INTRA*/
+      {
+         7372,16773,21590,24851,28227,30074,31599,33816,
+        36598,39231,41472,44353,46161,47732,49501,57493
+      },
+      /*Cb  qi=59  OC_MODE_INTER_NOMV*/
+      {
+         5285,12649,21403,25113,28231,32964,38449,55552,
+        40714,44559,44432,44261,46268,61382,53840,51049
+      },
+      /*Cb  qi=59  OC_MODE_INTER_MV*/
+      {
+         6214,14101,21416,25129,30183,35110,39374,42010,
+        43449,49577,51859,51481,54555,54482,63349,58561
+      },
+      /*Cb  qi=59  OC_MDOE_INTER_MV_LAST*/
+      {
+         2823,14174,21423,25414,30830,36378,39773,41911,
+        43133,43754,43483,44253,42823,42260,42302,42528
+      },
+      /*Cb  qi=59  OC_MODE_INTER_MV_LAST2*/
+      {
+         4982,13884,21450,25550,30930,36777,40630,45982,
+        47414,47950,47692,49047,50714,56896,50295,62940
+      },
+      /*Cb  qi=59  OC_MODE_INTER_MV_FOUR*/
+      {
+         3620,11265,20531,25185,30270,35657,40215,43857,
+        46736,49790,51312,52904,56487,57927,65535,60459
+      },
+      /*Cb  qi=59  OC_MODE_GOLDEN_NOMV*/
+      {
+         4340,10437,14872,17001,20800,24414,28027,29983,
+        31894,35314,36802,38744,37641,37854,38115,41611
+      },
+      /*Cb  qi=59  OC_MODE_GOLDEN_MV*/
+      {
+         3685,12280,21529,25489,29625,33216,34128,34571,
+        35070,35505,36335,36675,37687,37797,38441,42841
+      }
+    },
+    {
+      /*Cr  qi=59  OC_MODE_INTRA*/
+      {
+         4161,12472,17378,20766,23802,26274,28811,31393,
+        33901,35286,36520,38509,40228,40873,42717,49068
+      },
+      /*Cr  qi=59  OC_MODE_INTER_NOMV*/
+      {
+         3490, 8947,17508,22319,26083,27291,52096,34546,
+        29664,33104,14177,38873,35328,34213,37863,35712
+      },
+      /*Cr  qi=59  OC_MODE_INTER_MV*/
+      {
+         4175, 9443,17203,22852,27037,30814,33252,34575,
+        37849,39027,42681,41848,41944,42120,35733,43603
+      },
+      /*Cr  qi=59  OC_MDOE_INTER_MV_LAST*/
+      {
+         3265, 9360,17245,22628,26777,30081,31880,32343,
+        31555,28979,27596,26933,26312,27081,28294,24931
+      },
+      /*Cr  qi=59  OC_MODE_INTER_MV_LAST2*/
+      {
+         3651, 9475,17388,23120,26883,30049,32269,33432,
+        34798,26300,29855,25327,35831,35846,33472,29216
+      },
+      /*Cr  qi=59  OC_MODE_INTER_MV_FOUR*/
+      {
+         2624, 8879,17183,22745,26765,29843,32481,35029,
+        36856,40486,41191,42268,40367,40227,33864,27617
+      },
+      /*Cr  qi=59  OC_MODE_GOLDEN_NOMV*/
+      {
+         3198, 8348,11831,15653,18693,20958,23656,23823,
+        23560,23963,23177,24460,24322,25948,26493,28168
+      },
+      /*Cr  qi=59  OC_MODE_GOLDEN_MV*/
+      {
+         2789, 9470,17106,21552,23982,26037,27088,26555,
+        26459,26370,25559,26401,26724,26827,26588,27047
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=60  OC_MODE_INTRA*/
+      {
+         9989,15795,20725,23040,25874,28230,30597,32510,
+        34649,36723,38362,39464,41116,42829,44309,55704
+      },
+      /*Y'  qi=60  OC_MODE_INTER_NOMV*/
+      {
+         4803,14017,20706,25852,29388,32199,34519,36666,
+        38879,41285,43645,46439,47627,50542,52023,65205
+      },
+      /*Y'  qi=60  OC_MODE_INTER_MV*/
+      {
+         4895,15459,20922,25347,28791,31460,33848,36179,
+        38483,40891,43140,45143,47109,48779,50585,57423
+      },
+      /*Y'  qi=60  OC_MDOE_INTER_MV_LAST*/
+      {
+         4777,15688,21071,25437,28676,31373,33883,36244,
+        38517,40709,42845,44795,46626,48314,49921,57076
+      },
+      /*Y'  qi=60  OC_MODE_INTER_MV_LAST2*/
+      {
+         4801,14129,19902,24898,28727,31721,34320,36793,
+        39218,41597,43832,45809,47670,49545,51306,58720
+      },
+      /*Y'  qi=60  OC_MODE_INTER_MV_FOUR*/
+      {
+         3632,12802,19870,24875,28731,31832,34543,37060,
+        39458,41699,43852,45789,47693,49493,51044,56866
+      },
+      /*Y'  qi=60  OC_MODE_GOLDEN_NOMV*/
+      {
+         4487,12402,19121,23622,27352,30307,33232,35604,
+        37952,39918,41718,43273,44100,45523,47105,59585
+      },
+      /*Y'  qi=60  OC_MODE_GOLDEN_MV*/
+      {
+         4702,12961,20428,25430,29021,31961,34681,37212,
+        39639,41833,43985,45739,47496,48756,50348,56609
+      }
+    },
+    {
+      /*Cb  qi=60  OC_MODE_INTRA*/
+      {
+         7465,16759,21595,24851,28229,30062,31566,33820,
+        36589,39236,41478,44300,46086,47793,49491,57505
+      },
+      /*Cb  qi=60  OC_MODE_INTER_NOMV*/
+      {
+         5662,13349,21455,25128,29002,35389,38071,39104,
+        42424,44037,44532,49867,47728,55221,60384,53546
+      },
+      /*Cb  qi=60  OC_MODE_INTER_MV*/
+      {
+         5830,14191,21372,25199,30247,35302,38538,42341,
+        45315,47771,51055,52060,53609,56354,60436,61795
+      },
+      /*Cb  qi=60  OC_MDOE_INTER_MV_LAST*/
+      {
+         2916,14139,21415,25405,30803,36262,39888,41756,
+        42655,43611,43373,43843,42542,42523,42389,42302
+      },
+      /*Cb  qi=60  OC_MODE_INTER_MV_LAST2*/
+      {
+         5484,11924,21179,25418,30580,35539,40376,45080,
+        46764,50926,47082,50634,51376,65535,59046,62132
+      },
+      /*Cb  qi=60  OC_MODE_INTER_MV_FOUR*/
+      {
+         3612,11249,20535,25190,30182,35655,40281,43722,
+        46394,50113,50920,52757,55478,56901,63591,60000
+      },
+      /*Cb  qi=60  OC_MODE_GOLDEN_NOMV*/
+      {
+         4363,10484,14910,17054,20776,24952,28021,30266,
+        32285,34798,37065,39207,37763,37864,37924,41679
+      },
+      /*Cb  qi=60  OC_MODE_GOLDEN_MV*/
+      {
+         3475,12359,21533,25495,29579,33236,33902,34378,
+        34900,35435,36299,36672,37446,37491,38209,42652
+      }
+    },
+    {
+      /*Cr  qi=60  OC_MODE_INTRA*/
+      {
+         4111,12466,17381,20757,23793,26257,28818,31390,
+        33906,35238,36438,38526,40218,40834,42918,48997
+      },
+      /*Cr  qi=60  OC_MODE_INTER_NOMV*/
+      {
+         3443, 8872,17662,23237,25625,31398,32068,33079,
+        28191,18193,12811,29696,22918,38089,37056,36352
+      },
+      /*Cr  qi=60  OC_MODE_INTER_MV*/
+      {
+         4228, 9493,17340,22629,26924,30470,31941,34882,
+        37498,39027,40754,41215,40290,40303,44942,40944
+      },
+      /*Cr  qi=60  OC_MDOE_INTER_MV_LAST*/
+      {
+         3294, 9337,17197,22570,26680,30022,31849,32159,
+        31477,29347,27996,26718,26604,27397,26411,24694
+      },
+      /*Cr  qi=60  OC_MODE_INTER_MV_LAST2*/
+      {
+         3339, 9305,17390,23307,27242,30424,32236,32735,
+        34811,29880,29567,25640,44768,37568,37200,30528
+      },
+      /*Cr  qi=60  OC_MODE_INTER_MV_FOUR*/
+      {
+         2615, 8873,17167,22697,26759,29826,32478,35146,
+        36988,40718,41498,40447,44015,39468,38076,27337
+      },
+      /*Cr  qi=60  OC_MODE_GOLDEN_NOMV*/
+      {
+         3211, 8380,11715,15760,18683,20890,23493,23653,
+        23497,23705,23170,24503,24123,26067,26602,28112
+      },
+      /*Cr  qi=60  OC_MODE_GOLDEN_MV*/
+      {
+         2697, 9478,17120,21480,23913,25934,27245,26386,
+        26332,26279,25478,26393,26603,26898,26850,27019
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=61  OC_MODE_INTRA*/
+      {
+         9983,15827,20737,23064,25890,28250,30622,32541,
+        34679,36732,38370,39468,41114,42825,44320,55702
+      },
+      /*Y'  qi=61  OC_MODE_INTER_NOMV*/
+      {
+         4811,14103,20721,25851,29381,32184,34474,36605,
+        38885,41228,43527,46218,47613,50721,51832,63429
+      },
+      /*Y'  qi=61  OC_MODE_INTER_MV*/
+      {
+         4887,15381,20937,25380,28798,31459,33864,36236,
+        38554,40944,43212,45181,47157,48824,50535,57596
+      },
+      /*Y'  qi=61  OC_MDOE_INTER_MV_LAST*/
+      {
+         4856,15738,21082,25443,28711,31393,33901,36249,
+        38518,40707,42833,44834,46672,48263,49881,57188
+      },
+      /*Y'  qi=61  OC_MODE_INTER_MV_LAST2*/
+      {
+         4741,13976,19919,24909,28730,31759,34391,36839,
+        39301,41620,43840,45876,47740,49495,51328,58790
+      },
+      /*Y'  qi=61  OC_MODE_INTER_MV_FOUR*/
+      {
+         3629,12837,19864,24871,28743,31851,34572,37092,
+        39478,41719,43862,45805,47732,49496,51054,56816
+      },
+      /*Y'  qi=61  OC_MODE_GOLDEN_NOMV*/
+      {
+         4495,12401,19103,23606,27290,30266,33189,35582,
+        37945,39717,41615,43236,44036,45385,47125,59643
+      },
+      /*Y'  qi=61  OC_MODE_GOLDEN_MV*/
+      {
+         4693,12930,20409,25428,29031,31977,34683,37214,
+        39627,41823,43962,45703,47570,48660,50261,56526
+      }
+    },
+    {
+      /*Cb  qi=61  OC_MODE_INTRA*/
+      {
+         7405,16765,21589,24852,28230,30064,31544,33785,
+        36553,39188,41457,44308,46190,47529,49455,57486
+      },
+      /*Cb  qi=61  OC_MODE_INTER_NOMV*/
+      {
+         5681,13362,21458,25118,28486,35183,38314,45978,
+        40914,43822,43208,41307,48260,47036,52749,55641
+      },
+      /*Cb  qi=61  OC_MODE_INTER_MV*/
+      {
+         5115,14267,21370,25243,30302,35264,38561,42119,
+        44416,47098,49259,54928,52825,55191,59258,61690
+      },
+      /*Cb  qi=61  OC_MDOE_INTER_MV_LAST*/
+      {
+         3022,14154,21415,25394,30698,36199,39937,41625,
+        42699,43295,43516,43798,43046,42494,41823,42324
+      },
+      /*Cb  qi=61  OC_MODE_INTER_MV_LAST2*/
+      {
+         5385,11885,21152,25496,30508,35431,40588,45604,
+        46888,50844,47119,48062,50234,63936,56316,61708
+      },
+      /*Cb  qi=61  OC_MODE_INTER_MV_FOUR*/
+      {
+         3614,11263,20556,25179,30197,35540,40210,43859,
+        46541,49712,50696,53132,57093,56213,61448,59422
+      },
+      /*Cb  qi=61  OC_MODE_GOLDEN_NOMV*/
+      {
+         4378,10474,14895,17089,20741,24939,27994,30126,
+        32203,34738,36752,39014,37508,37694,37560,41476
+      },
+      /*Cb  qi=61  OC_MODE_GOLDEN_MV*/
+      {
+         3501,12297,21537,25493,29517,33267,33735,34383,
+        34998,35417,36396,36485,37423,37386,38173,42790
+      }
+    },
+    {
+      /*Cr  qi=61  OC_MODE_INTRA*/
+      {
+         4144,12471,17388,20758,23786,26258,28804,31378,
+        33896,35240,36442,38423,40216,40843,42852,49074
+      },
+      /*Cr  qi=61  OC_MODE_INTER_NOMV*/
+      {
+         3430, 8893,17358,22812,26482,27239,38656,32364,
+        28199,35296,13753,33383,34664,27328,39040,35648
+      },
+      /*Cr  qi=61  OC_MODE_INTER_MV*/
+      {
+         4034, 9500,17380,22684,26997,30365,32415,34385,
+        36832,38251,39807,44565,42925,41803,36868,38131
+      },
+      /*Cr  qi=61  OC_MDOE_INTER_MV_LAST*/
+      {
+         3396, 9349,17190,22579,26655,29993,31776,32075,
+        31307,28978,27950,26731,26357,26876,27313,24595
+      },
+      /*Cr  qi=61  OC_MODE_INTER_MV_LAST2*/
+      {
+         3323, 9431,17361,23241,27215,30229,32266,32313,
+        33883,26348,29338,25467,36192,38944,32624,29664
+      },
+      /*Cr  qi=61  OC_MODE_INTER_MV_FOUR*/
+      {
+         2615, 8870,17164,22709,26742,29849,32447,35236,
+        37025,40547,41884,43228,41193,39505,35281,27504
+      },
+      /*Cr  qi=61  OC_MODE_GOLDEN_NOMV*/
+      {
+         3216, 8379,11650,15792,18756,20805,23623,23360,
+        23343,23693,23148,24074,24013,25617,27006,28736
+      },
+      /*Cr  qi=61  OC_MODE_GOLDEN_MV*/
+      {
+         2682, 9478,17118,21448,23984,25942,27208,26280,
+        26430,26322,25570,25998,26718,26996,26861,26951
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=62  OC_MODE_INTRA*/
+      {
+        11018,17178,22038,24368,27273,29713,32178,34197,
+        36401,38583,40323,41540,43292,45091,46665,58787
+      },
+      /*Y'  qi=62  OC_MODE_INTER_NOMV*/
+      {
+         5286,15155,22186,27460,30988,33858,36403,38804,
+        41287,43880,46356,48822,50694,54408,55514,65535
+      },
+      /*Y'  qi=62  OC_MODE_INTER_MV*/
+      {
+         5367,16633,22175,26652,30322,33190,35827,38393,
+        40959,43523,45863,48113,50190,52097,53822,60966
+      },
+      /*Y'  qi=62  OC_MDOE_INTER_MV_LAST*/
+      {
+         4888,17024,22407,26913,30357,33242,35951,38532,
+        40993,43409,45684,47823,49795,51335,53162,60633
+      },
+      /*Y'  qi=62  OC_MODE_INTER_MV_LAST2*/
+      {
+         5372,14075,21491,26761,30539,33615,36450,39162,
+        41801,44363,46647,48883,50783,52593,54468,62380
+      },
+      /*Y'  qi=62  OC_MODE_INTER_MV_FOUR*/
+      {
+         4846,14082,21164,26387,30456,33759,36682,39405,
+        41977,44421,46704,48793,50841,52734,54400,60296
+      },
+      /*Y'  qi=62  OC_MODE_GOLDEN_NOMV*/
+      {
+         3685,13164,20179,24874,28828,32215,35186,37760,
+        40368,42298,44232,45577,46556,47619,50034,62971
+      },
+      /*Y'  qi=62  OC_MODE_GOLDEN_MV*/
+      {
+         5333,14474,21825,26971,30764,33909,36865,39646,
+        42273,44714,47006,48863,50734,52041,53690,59811
+      }
+    },
+    {
+      /*Cb  qi=62  OC_MODE_INTRA*/
+      {
+         7337,16810,21625,24876,28257,30082,31527,33742,
+        36564,39185,41399,44283,46019,47440,49325,57568
+      },
+      /*Cb  qi=62  OC_MODE_INTER_NOMV*/
+      {
+         5378,13726,21489,25132,29673,33311,41502,56448,
+        50320,44824,50439,48279,51128,55841,48480,57757
+      },
+      /*Cb  qi=62  OC_MODE_INTER_MV*/
+      {
+         5144,14062,21411,25415,30512,35868,39404,41985,
+        44284,48052,51784,53453,52167,56340,58552,60869
+      },
+      /*Cb  qi=62  OC_MDOE_INTER_MV_LAST*/
+      {
+         2885,14056,21466,25443,30674,36009,39656,41545,
+        42356,43329,43065,43321,42358,42030,41688,41967
+      },
+      /*Cb  qi=62  OC_MODE_INTER_MV_LAST2*/
+      {
+         5139,12562,21441,25364,30396,35304,39595,44650,
+        46141,48736,45932,47478,47534,59975,58432,62510
+      },
+      /*Cb  qi=62  OC_MODE_INTER_MV_FOUR*/
+      {
+         3779,11325,20578,25216,30210,35513,40210,43889,
+        46266,49365,51051,53438,54664,56114,62846,60338
+      },
+      /*Cb  qi=62  OC_MODE_GOLDEN_NOMV*/
+      {
+         3433, 9865,14779,16892,20249,24336,28108,30079,
+        32351,35133,37843,38935,37118,37969,38528,41402
+      },
+      /*Cb  qi=62  OC_MODE_GOLDEN_MV*/
+      {
+         3447,12505,21556,25523,29502,33333,33671,34174,
+        34557,35350,35813,36809,36831,37765,37790,42547
+      }
+    },
+    {
+      /*Cr  qi=62  OC_MODE_INTRA*/
+      {
+         4504,13374,18493,21970,25144,27738,30516,33273,
+        35926,37393,38671,40835,42604,43726,45949,52439
+      },
+      /*Cr  qi=62  OC_MODE_INTER_NOMV*/
+      {
+         3889, 9831,18689,23797,28291,33033,57344,29186,
+        30473,40010,16136,41104,36443,20952,42048,38502
+      },
+      /*Cr  qi=62  OC_MODE_INTER_MV*/
+      {
+         4591,10528,18803,24268,28556,32637,34346,37536,
+        40198,41989,45421,43745,48797,48139,44224,39491
+      },
+      /*Cr  qi=62  OC_MDOE_INTER_MV_LAST*/
+      {
+         3704,10255,18516,24224,28650,32124,34011,34265,
+        33644,30560,29563,29050,27798,28884,29648,26379
+      },
+      /*Cr  qi=62  OC_MODE_INTER_MV_LAST2*/
+      {
+         3997,10408,18610,24726,28794,32108,34519,35308,
+        36674,27699,31603,27547,36475,43285,39307,40192
+      },
+      /*Cr  qi=62  OC_MODE_INTER_MV_FOUR*/
+      {
+         3066, 9886,18515,24367,28635,31972,34783,37316,
+        39659,42795,44154,45479,43653,53192,39624,29015
+      },
+      /*Cr  qi=62  OC_MODE_GOLDEN_NOMV*/
+      {
+         2788, 8873,12400,16679,19909,22191,25460,24946,
+        24748,25269,24967,26102,26496,27615,28677,30437
+      },
+      /*Cr  qi=62  OC_MODE_GOLDEN_MV*/
+      {
+         2958,10483,18422,23048,25590,27821,29005,28341,
+        28241,28060,27219,27610,28279,28657,28210,29042
+      }
+    }
+  },
+  {
+    {
+      /*Y'  qi=63  OC_MODE_INTRA*/
+      {
+        11558,17955,22921,25284,28269,30774,33291,35373,
+        37646,39911,41732,43011,44834,46687,48369,61056
+      },
+      /*Y'  qi=63  OC_MODE_INTER_NOMV*/
+      {
+         5704,16338,23392,28558,32177,35129,37786,40327,
+        43088,45889,48684,51353,53472,56645,57877,65535
+      },
+      /*Y'  qi=63  OC_MODE_INTER_MV*/
+      {
+         5608,17430,23193,27851,31629,34601,37344,40081,
+        42921,45718,48290,50641,52734,54872,56634,63699
+      },
+      /*Y'  qi=63  OC_MDOE_INTER_MV_LAST*/
+      {
+         5507,17905,23395,27970,31505,34491,37346,40088,
+        42757,45372,47836,50136,52160,53994,55751,63144
+      },
+      /*Y'  qi=63  OC_MODE_INTER_MV_LAST2*/
+      {
+         5656,14910,22171,27549,31627,34942,37918,40634,
+        43194,45760,48338,50591,52958,54882,57023,64999
+      },
+      /*Y'  qi=63  OC_MODE_INTER_MV_FOUR*/
+      {
+         5189,14819,22100,27479,31678,35114,38168,41027,
+        43716,46309,48696,50885,53024,55000,56708,62715
+      },
+      /*Y'  qi=63  OC_MODE_GOLDEN_NOMV*/
+      {
+         3863,13809,20993,25730,29805,33316,36484,39105,
+        41746,43824,45969,47273,48882,49880,51888,65431
+      },
+      /*Y'  qi=63  OC_MODE_GOLDEN_MV*/
+      {
+         5618,14999,22838,28117,32036,35354,38465,41431,
+        44224,46853,49142,51269,53225,54451,56158,62225
+      }
+    },
+    {
+      /*Cb  qi=63  OC_MODE_INTRA*/
+      {
+         7335,16805,21644,24903,28332,30135,31627,33856,
+        36612,39157,41402,44354,46124,47578,49435,57762
+      },
+      /*Cb  qi=63  OC_MODE_INTER_NOMV*/
+      {
+         5570,14249,21497,25176,30004,36027,38748,41937,
+        48640,46098,47623,48411,52140,50397,53303,62859
+      },
+      /*Cb  qi=63  OC_MODE_INTER_MV*/
+      {
+         5103,14047,21414,25245,30286,35396,38446,42150,
+        42730,46850,48970,51030,53658,55834,59934,62206
+      },
+      /*Cb  qi=63  OC_MDOE_INTER_MV_LAST*/
+      {
+         3135,14085,21472,25438,30643,35934,39704,41482,
+        42565,43119,42766,43219,42671,41921,41429,41668
+      },
+      /*Cb  qi=63  OC_MODE_INTER_MV_LAST2*/
+      {
+         5045,12541,21374,25850,30909,36393,41013,45814,
+        47198,50085,45739,49842,51627,60091,62336,64899
+      },
+      /*Cb  qi=63  OC_MODE_INTER_MV_FOUR*/
+      {
+         3764,11331,20599,25235,30201,35556,40046,43664,
+        46298,49688,50541,52289,54587,55953,62024,61965
+      },
+      /*Cb  qi=63  OC_MODE_GOLDEN_NOMV*/
+      {
+         3448, 9737,14801,16948,20288,24726,28083,30080,
+        32603,34916,37185,38691,37611,38978,38254,41762
+      },
+      /*Cb  qi=63  OC_MODE_GOLDEN_MV*/
+      {
+         3384,12465,21541,25511,29472,33169,33776,34310,
+        34919,34996,35791,36164,36665,37309,37453,42492
+      }
+    },
+    {
+      /*Cr  qi=63  OC_MODE_INTRA*/
+      {
+         4731,14048,19421,23021,26358,29096,31971,34869,
+        37665,39194,40570,42899,44920,45586,48385,55323
+      },
+      /*Cr  qi=63  OC_MODE_INTER_NOMV*/
+      {
+         4672,10842,20473,26017,30252,34195,42240,36258,
+        40438,26514,19893,42624,42191,44576,23717,35456
+      },
+      /*Cr  qi=63  OC_MODE_INTER_MV*/
+      {
+         5013,11465,19912,26015,30548,34611,37458,38948,
+        42717,45724,49301,44595,45208,44149,48865,45369
+      },
+      /*Cr  qi=63  OC_MDOE_INTER_MV_LAST*/
+      {
+         4383,11291,19830,25779,30402,34283,36263,36423,
+        35857,33041,31324,30471,28939,29927,31898,27794
+      },
+      /*Cr  qi=63  OC_MODE_INTER_MV_LAST2*/
+      {
+         4233,11664,20034,26638,30913,34172,36486,38263,
+        39196,32849,32392,34608,37843,41750,42240,33403
+      },
+      /*Cr  qi=63  OC_MODE_INTER_MV_FOUR*/
+      {
+         3324,10804,19858,25938,30354,33911,36693,39624,
+        41989,45559,46904,41902,49312,43578,51593,30360
+      },
+      /*Cr  qi=63  OC_MODE_GOLDEN_NOMV*/
+      {
+         2957, 9412,12794,17537,21090,23556,26774,26498,
+        26616,27479,26969,27537,28664,29173,30867,31724
+      },
+      /*Cr  qi=63  OC_MODE_GOLDEN_MV*/
+      {
+         3141,11491,19876,24885,27337,29503,30714,29953,
+        30092,29909,28929,29603,29853,30442,30411,30485
+      }
+    }
+  }
+};
+



More information about the commits mailing list