[xiph-commits] r15359 - branches/theora-thusnelda/lib/enc
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed Oct 1 01:53:20 PDT 2008
Author: xiphmont
Date: 2008-10-01 01:53:16 -0700 (Wed, 01 Oct 2008)
New Revision: 15359
Modified:
branches/theora-thusnelda/lib/enc/codec_internal.h
branches/theora-thusnelda/lib/enc/frarray.c
branches/theora-thusnelda/lib/enc/mode.c
Log:
Fix the frflag bitcounting code; corrects the 'mangling' bug as well as
getting a nice 5%-ish savings for effectively free.
Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h 2008-10-01 01:07:29 UTC (rev 15358)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h 2008-10-01 08:53:16 UTC (rev 15359)
@@ -22,7 +22,7 @@
# include "config.h"
#endif
-#define COLLECT_METRICS
+#undef COLLECT_METRICS
#include "theora/theora.h"
#include "encoder_huffman.h"
@@ -255,7 +255,11 @@
unsigned char *fr_full_bits;
ogg_int16_t *fr_block;
unsigned char *fr_block_bits;
+ int fr_partial_count;
+ int fr_full_count;
+ int fr_block_count;
+
int stack_offset;
unsigned char *dct_token_storage;
ogg_uint16_t *dct_token_eb_storage;
@@ -386,11 +390,7 @@
extern void ClearFrameInfo (CP_INSTANCE *cpi);
typedef struct {
- int cpi_partial_count;
- int cpi_full_count;
- int cpi_block_count;
-
- ogg_uint16_t sb_partial_count;
+ ogg_uint16_t sb_partial_count;
ogg_uint16_t sb_full_count;
signed char sb_partial_last;
@@ -407,13 +407,15 @@
int cost;
} fr_state_t;
-void fr_clear(CP_INSTANCE *cpi, fr_state_t *fr);
-void fr_skipblock(CP_INSTANCE *cpi, fr_state_t *fr);
-void fr_codeblock(CP_INSTANCE *cpi, fr_state_t *fr);
-void fr_finishsb(CP_INSTANCE *cpi, fr_state_t *fr);
-void fr_write(CP_INSTANCE *cpi, fr_state_t *fr);
-int fr_block_coding_cost(CP_INSTANCE *cpi, fr_state_t *fr);
+extern void fr_clear(CP_INSTANCE *cpi, fr_state_t *fr);
+extern void fr_skipblock(CP_INSTANCE *cpi, fr_state_t *fr);
+extern void fr_codeblock(CP_INSTANCE *cpi, fr_state_t *fr);
+extern void fr_finishsb(CP_INSTANCE *cpi, fr_state_t *fr);
+extern void fr_write(CP_INSTANCE *cpi, fr_state_t *fr);
+extern int fr_cost1(fr_state_t *fr);
+extern int fr_cost4(fr_state_t *pre, fr_state_t *post);
+
#ifdef COLLECT_METRICS
extern void ModeMetrics(CP_INSTANCE *cpi);
extern void DumpMetrics(CP_INSTANCE *cpi);
Modified: branches/theora-thusnelda/lib/enc/frarray.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frarray.c 2008-10-01 01:07:29 UTC (rev 15358)
+++ branches/theora-thusnelda/lib/enc/frarray.c 2008-10-01 08:53:16 UTC (rev 15359)
@@ -35,14 +35,10 @@
fr->sb_partial=0;
fr->sb_coded=0;
- fr->cpi_partial_count=0;
- fr->cpi_full_count=0;
- fr->cpi_block_count=0;
-
fr->cost=0;
}
-static int Brun( ogg_uint32_t value, ogg_int16_t *token) {
+static int BRun( ogg_uint32_t value, ogg_int16_t *token) {
/* Coding scheme:
Codeword RunLength
@@ -74,9 +70,11 @@
}
}
-static int BrunCost( ogg_uint32_t value ) {
+static int BRunCost( ogg_uint32_t value ) {
- if ( value <= 2 ) {
+ if ( value <= 0 ) {
+ return 0;
+ } else if ( value <= 2 ) {
return 2;
} else if ( value <= 4 ) {
return 3;
@@ -91,6 +89,63 @@
}
}
+static int SBRun(ogg_uint32_t value, int *token){
+
+ /* Coding scheme:
+ Codeword RunLength
+ 0 1
+ 10x 2-3
+ 110x 4-5
+ 1110xx 6-9
+ 11110xxx 10-17
+ 111110xxxx 18-33
+ 111111xxxxxxxxxxxx 34-4129 */
+
+ if ( value == 1 ){
+ *token = 0;
+ return 1;
+ } else if ( value <= 3 ) {
+ *token = 0x0004 + (value - 2);
+ return 3;
+ } else if ( value <= 5 ) {
+ *token = 0x000C + (value - 4);
+ return 4;
+ } else if ( value <= 9 ) {
+ *token = 0x0038 + (value - 6);
+ return 6;
+ } else if ( value <= 17 ) {
+ *token = 0x00F0 + (value - 10);
+ return 8;
+ } else if ( value <= 33 ) {
+ *token = 0x03E0 + (value - 18);
+ return 10;
+ } else {
+ *token = 0x3F000 + (value - 34);
+ return 18;
+ }
+}
+
+static int SBRunCost(ogg_uint32_t value){
+
+ if ( value == 0 ){
+ return 0;
+ } else if ( value == 1 ){
+ return 1;
+ } else if ( value <= 3 ) {
+ return 3;
+ } else if ( value <= 5 ) {
+ return 4;
+ } else if ( value <= 9 ) {
+ return 6;
+ } else if ( value <= 17 ) {
+ return 8;
+ } else if ( value <= 33 ) {
+ return 10;
+ } else {
+ return 18;
+ }
+}
+
void fr_skipblock(CP_INSTANCE *cpi, fr_state_t *fr){
if(fr->sb_coded){
if(!fr->sb_partial){
@@ -99,10 +154,11 @@
if(fr->b_last==-1){
/* first run of the frame */
- cpi->fr_block[fr->cpi_block_count]=1;
- cpi->fr_block_bits[fr->cpi_block_count]=1;
+ if(cpi){
+ cpi->fr_block[cpi->fr_block_count]=1;
+ cpi->fr_block_bits[cpi->fr_block_count++]=1;
+ }
fr->cost++;
- fr->cpi_block_count++;
fr->b_last = 1;
}
@@ -111,10 +167,14 @@
fr->b_count += fr->b_pend;
}else{
/* in-progress run an uncoded run; flush */
- fr->cost +=
- cpi->fr_block_bits[fr->cpi_block_count] =
- Brun(fr->b_count, cpi->fr_block+fr->cpi_block_count);
- fr->cpi_block_count++;
+ if(cpi){
+ fr->cost +=
+ cpi->fr_block_bits[cpi->fr_block_count] =
+ BRun(fr->b_count, cpi->fr_block+cpi->fr_block_count);
+ cpi->fr_block_count++;
+ }else
+ fr->cost += BRunCost(fr->b_count);
+
fr->b_count=fr->b_pend;
fr->b_last = 1;
}
@@ -124,10 +184,13 @@
if(fr->b_last == 0){
fr->b_count++;
}else{
- fr->cost+=
- cpi->fr_block_bits[fr->cpi_block_count] =
- Brun(fr->b_count, cpi->fr_block+fr->cpi_block_count);
- fr->cpi_block_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_block_bits[cpi->fr_block_count] =
+ BRun(fr->b_count, cpi->fr_block+cpi->fr_block_count);
+ cpi->fr_block_count++;
+ }else
+ fr->cost+=BRunCost(fr->b_count);
fr->b_count = 1;
fr->b_last = 0;
}
@@ -145,10 +208,11 @@
if(fr->b_last==-1){
/* first run of the frame */
- cpi->fr_block[fr->cpi_block_count]=0;
- cpi->fr_block_bits[fr->cpi_block_count]=1;
+ if(cpi){
+ cpi->fr_block[cpi->fr_block_count]=0;
+ cpi->fr_block_bits[cpi->fr_block_count++]=1;
+ }
fr->cost++;
- fr->cpi_block_count++;
fr->b_last = 0;
}
@@ -157,23 +221,29 @@
fr->b_count += fr->b_pend;
}else{
/* in-progress run a coded run; flush */
- fr->cost+=
- cpi->fr_block_bits[fr->cpi_block_count] =
- Brun(fr->b_count, cpi->fr_block+fr->cpi_block_count);
- fr->cpi_block_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_block_bits[cpi->fr_block_count] =
+ BRun(fr->b_count, cpi->fr_block+cpi->fr_block_count);
+ cpi->fr_block_count++;
+ }else
+ fr->cost+=BRunCost(fr->b_count);
fr->b_count=fr->b_pend;
fr->b_last = 0;
}
}
-
+
/* add a coded block */
if(fr->b_last == 1){
fr->b_count++;
}else{
- fr->cost+=
- cpi->fr_block_bits[fr->cpi_block_count] =
- Brun(fr->b_count, cpi->fr_block+fr->cpi_block_count);
- fr->cpi_block_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_block_bits[cpi->fr_block_count] =
+ BRun(fr->b_count, cpi->fr_block+cpi->fr_block_count);
+ cpi->fr_block_count++;
+ }else
+ fr->cost+=BRunCost(fr->b_count);
fr->b_count = 1;
fr->b_last = 1;
}
@@ -183,69 +253,15 @@
fr->sb_coded=1;
}
-static int SBRun(ogg_uint32_t value, int *token){
-
- /* Coding scheme:
- Codeword RunLength
- 0 1
- 10x 2-3
- 110x 4-5
- 1110xx 6-9
- 11110xxx 10-17
- 111110xxxx 18-33
- 111111xxxxxxxxxxxx 34-4129 */
-
- if ( value == 1 ){
- *token = 0;
- return 1;
- } else if ( value <= 3 ) {
- *token = 0x0004 + (value - 2);
- return 3;
- } else if ( value <= 5 ) {
- *token = 0x000C + (value - 4);
- return 4;
- } else if ( value <= 9 ) {
- *token = 0x0038 + (value - 6);
- return 6;
- } else if ( value <= 17 ) {
- *token = 0x00F0 + (value - 10);
- return 8;
- } else if ( value <= 33 ) {
- *token = 0x03E0 + (value - 18);
- return 10;
- } else {
- *token = 0x3F000 + (value - 34);
- return 18;
- }
-}
-
-static int SBRunCost(ogg_uint32_t value){
-
- if ( value == 1 ){
- return 1;
- } else if ( value <= 3 ) {
- return 3;
- } else if ( value <= 5 ) {
- return 4;
- } else if ( value <= 9 ) {
- return 6;
- } else if ( value <= 17 ) {
- return 8;
- } else if ( value <= 33 ) {
- return 10;
- } else {
- return 18;
- }
-}
-
void fr_finishsb(CP_INSTANCE *cpi, fr_state_t *fr){
/* update partial state */
int partial = (fr->sb_partial & fr->sb_coded);
if(fr->sb_partial_last == -1){
- cpi->fr_partial[fr->cpi_partial_count] = partial;
- cpi->fr_partial_bits[fr->cpi_partial_count] = 1;
+ if(cpi){
+ cpi->fr_partial[cpi->fr_partial_count] = partial;
+ cpi->fr_partial_bits[cpi->fr_partial_count++] = 1;
+ }
fr->cost++;
- fr->cpi_partial_count++;
fr->sb_partial_last = partial;
}
@@ -253,31 +269,36 @@
fr->sb_partial_count++;
}else{
if(fr->sb_partial_break){
- cpi->fr_partial[fr->cpi_partial_count] = partial;
- cpi->fr_partial_bits[fr->cpi_partial_count] = 1;
+ if(cpi){
+ cpi->fr_partial[cpi->fr_partial_count] = partial;
+ cpi->fr_partial_bits[cpi->fr_partial_count++] = 1;
+ }
fr->cost++;
- fr->cpi_partial_count++;
}
fr->sb_partial_break=0;
- fr->cost+=
- cpi->fr_partial_bits[fr->cpi_partial_count] =
- SBRun( fr->sb_partial_count, cpi->fr_partial+fr->cpi_partial_count);
- fr->cpi_partial_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_partial_bits[cpi->fr_partial_count] =
+ SBRun( fr->sb_partial_count, cpi->fr_partial+cpi->fr_partial_count);
+ cpi->fr_partial_count++;
+ }else
+ fr->cost+=SBRunCost(fr->sb_partial_count);
if(fr->sb_partial_count >= 4129) fr->sb_partial_break = 1;
fr->sb_partial_count=1;
}
fr->sb_partial_last=partial;
-
+
/* fully coded/uncoded state */
if(!fr->sb_partial || !fr->sb_coded){
if(fr->sb_full_last == -1){
- cpi->fr_full[fr->cpi_full_count] = fr->sb_coded;
- cpi->fr_full_bits[fr->cpi_full_count] = 1;
+ if(cpi){
+ cpi->fr_full[cpi->fr_full_count] = fr->sb_coded;
+ cpi->fr_full_bits[cpi->fr_full_count++] = 1;
+ }
fr->cost++;
- fr->cpi_full_count++;
fr->sb_full_last = fr->sb_coded;
}
@@ -285,17 +306,21 @@
fr->sb_full_count++;
}else{
if(fr->sb_full_break){
- cpi->fr_full[fr->cpi_full_count] = fr->sb_coded;
- cpi->fr_full_bits[fr->cpi_full_count] = 1;
+ if(cpi){
+ cpi->fr_full[cpi->fr_full_count] = fr->sb_coded;
+ cpi->fr_full_bits[cpi->fr_full_count++] = 1;
+ }
fr->cost++;
- fr->cpi_full_count++;
}
fr->sb_full_break=0;
- fr->cost+=
- cpi->fr_full_bits[fr->cpi_full_count] =
- SBRun( fr->sb_full_count, cpi->fr_full+fr->cpi_full_count);
- fr->cpi_full_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_full_bits[cpi->fr_full_count] =
+ SBRun( fr->sb_full_count, cpi->fr_full+cpi->fr_full_count);
+ cpi->fr_full_count++;
+ }else
+ fr->cost+= SBRunCost( fr->sb_full_count);
if(fr->sb_full_count >= 4129) fr->sb_full_break = 1;
fr->sb_full_count=1;
}
@@ -308,123 +333,52 @@
fr->sb_coded=0;
}
-int fr_block_coding_cost(CP_INSTANCE *cpi, fr_state_t *fr){
- int coded=0, uncoded=0;
-
- if(fr->b_pend == 0){
- /* first block in SB */
-
- /* if(fr->sb_partial_last==1){ */
- /* last SB was partially coded; no opportunity cost one way or the other */
- /* } */
-
- if(fr->sb_partial_last==0){
- if(fr->sb_full_last==1){
- /* last SB was fully coded */
- /* if next block is uncoded, the result may be a partial or
- fully uncoded superblock, but we don't know which yet.
- The certain cost is the minimum of the two. */
- int uncoded1 = SBRunCost( fr->sb_full_count );
- int uncoded2 = SBRunCost( fr->sb_partial_count );
- uncoded += OC_MINI(uncoded1, uncoded2);
-
- if(fr->sb_full_count+1 >= 4129)
- coded += SBRunCost( fr->sb_full_count )+1;
-
- }
- if(fr->sb_full_last==0){
- /* last SB was fully uncoded */
- /* if next block is coded, the result may be a partial or
- fully coded superblock, but we don't know which yet.
- The certain cost is the minimum of the two. */
- int coded1 = SBRunCost( fr->sb_full_count );
- int coded2 = SBRunCost( fr->sb_partial_count );
- coded += OC_MINI(coded1, coded2);
- if(fr->sb_full_count+1 >= 4129)
- uncoded += SBRunCost( fr->sb_full_count )+1;
-
- }
- }
-
- /* this is the first block in the SB, so it always begins a block-run; there is no block opportunity cost either way */
-
- }else{
- if(fr->sb_partial){
- if(fr->sb_coded){
- /* SB is partially coded to this point; only new costs are block-run costs */
-
- if(fr->b_last == 0){
- coded += BrunCost(fr->b_count);
- }else{
- uncoded += BrunCost(fr->b_count);
- }
-
- }else{
- /* SB is fully uncoded to this point */
-
- /* coded cost reflects transition from uncoded -> partial */
- coded += BrunCost(fr->b_pend);
-
- if(fr->sb_partial_last==0){
- coded += SBRunCost( fr->sb_partial_count );
- }else
- if(fr->sb_partial_count+1 >= 4129)
- coded += SBRunCost( fr->sb_partial_count )+1;
-
- }
- }else{
- /* SB is fully coded to this point */
-
- uncoded += BrunCost(fr->b_pend);
-
- /* uncoded cost reflects transition from coded -> partial */
- uncoded += BrunCost(fr->b_pend);
-
- if(fr->sb_partial_last==0){
- uncoded += SBRunCost( fr->sb_partial_count );
- }else
- if(fr->sb_partial_count+1 >= 4129)
- uncoded += SBRunCost( fr->sb_partial_count )+1;
- }
- }
- return coded-uncoded;
-}
-
static void fr_flush(CP_INSTANCE *cpi, fr_state_t *fr){
/* flush any pending partial run */
if(fr->sb_partial_break){
- cpi->fr_partial[fr->cpi_partial_count] = fr->sb_partial_last;
- cpi->fr_partial_bits[fr->cpi_partial_count] = 1;
+ if(cpi){
+ cpi->fr_partial[cpi->fr_partial_count] = fr->sb_partial_last;
+ cpi->fr_partial_bits[cpi->fr_partial_count++] = 1;
+ }
fr->cost++;
- fr->cpi_partial_count++;
}
if(fr->sb_partial_count){
- fr->cost+=
- cpi->fr_partial_bits[fr->cpi_partial_count] =
- SBRun( fr->sb_partial_count, cpi->fr_partial+fr->cpi_partial_count);
- fr->cpi_partial_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_partial_bits[cpi->fr_partial_count] =
+ SBRun( fr->sb_partial_count, cpi->fr_partial+cpi->fr_partial_count);
+ cpi->fr_partial_count++;
+ }else
+ fr->cost+=SBRunCost( fr->sb_partial_count );
}
-
+
/* flush any pending full run */
if(fr->sb_full_break){
- cpi->fr_full[fr->cpi_full_count] = fr->sb_full_last;
- cpi->fr_full_bits[fr->cpi_full_count] = 1;
+ if(cpi){
+ cpi->fr_full[cpi->fr_full_count] = fr->sb_full_last;
+ cpi->fr_full_bits[cpi->fr_full_count++] = 1;
+ }
fr->cost++;
- fr->cpi_full_count++;
}
if(fr->sb_full_count){
- fr->cost+=
- cpi->fr_full_bits[fr->cpi_full_count] =
- SBRun( fr->sb_full_count, cpi->fr_full+fr->cpi_full_count);
- fr->cpi_full_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_full_bits[cpi->fr_full_count] =
+ SBRun( fr->sb_full_count, cpi->fr_full+cpi->fr_full_count);
+ cpi->fr_full_count++;
+ }else
+ fr->cost+=SBRunCost(fr->sb_full_count);
}
-
+
/* flush any pending block run */
if(fr->b_count){
- fr->cost+=
- cpi->fr_block_bits[fr->cpi_block_count] =
- Brun(fr->b_count, cpi->fr_block+fr->cpi_block_count);
- fr->cpi_block_count++;
+ if(cpi){
+ fr->cost+=
+ cpi->fr_block_bits[cpi->fr_block_count] =
+ BRun(fr->b_count, cpi->fr_block+cpi->fr_block_count);
+ cpi->fr_block_count++;
+ }else
+ fr->cost+=BRunCost(fr->b_count);
}
}
@@ -433,10 +387,42 @@
fr_flush(cpi,fr);
- for(i=0;i<fr->cpi_partial_count;i++)
+ for(i=0;i<cpi->fr_partial_count;i++)
oggpackB_write( cpi->oggbuffer, cpi->fr_partial[i], cpi->fr_partial_bits[i]);
- for(i=0;i<fr->cpi_full_count;i++)
+ for(i=0;i<cpi->fr_full_count;i++)
oggpackB_write( cpi->oggbuffer, cpi->fr_full[i], cpi->fr_full_bits[i]);
- for(i=0;i<fr->cpi_block_count;i++)
+ for(i=0;i<cpi->fr_block_count;i++)
oggpackB_write( cpi->oggbuffer, cpi->fr_block[i], cpi->fr_block_bits[i]);
}
+
+int fr_cost1(fr_state_t *fr){
+ fr_state_t temp = *fr;
+ int cost;
+
+ fr_skipblock(NULL,&temp);
+ fr_finishsb(NULL,&temp);
+ fr_flush(NULL,&temp);
+ cost=temp.cost;
+ temp=*fr;
+ fr_codeblock(NULL,&temp);
+ fr_finishsb(NULL,&temp);
+ fr_flush(NULL,&temp);
+ return temp.cost - cost;
+}
+
+int fr_cost4(fr_state_t *pre, fr_state_t *post){
+ fr_state_t temp = *pre;
+ int cost;
+
+ fr_skipblock(NULL,&temp);
+ fr_skipblock(NULL,&temp);
+ fr_skipblock(NULL,&temp);
+ fr_skipblock(NULL,&temp);
+ fr_finishsb(NULL,&temp);
+ fr_flush(NULL,&temp);
+ cost=temp.cost;
+ temp=*post;
+ fr_finishsb(NULL,&temp);
+ fr_flush(NULL,&temp);
+ return temp.cost - cost;
+}
Modified: branches/theora-thusnelda/lib/enc/mode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mode.c 2008-10-01 01:07:29 UTC (rev 15358)
+++ branches/theora-thusnelda/lib/enc/mode.c 2008-10-01 08:53:16 UTC (rev 15359)
@@ -768,19 +768,21 @@
static int TQMB_Y ( CP_INSTANCE *cpi, macroblock_t *mb, int mb_phase, plane_state_t *ps, long *rc,
int mode_overhead, fr_state_t *fr){
+
+ int full_checkpoint = cpi->fr_full_count;
+ int partial_checkpoint = cpi->fr_partial_count;
+ int block_checkpoint = cpi->fr_block_count;
+ fr_state_t fr_checkpoint = *fr;
unsigned char *cp=cpi->frag_coded;
int mode = mb->mode;
int coded = 0;
int i;
- fr_state_t fr_nocode;
token_checkpoint_t stack[64*5]; /* worst case token usage for 4 fragments*/
token_checkpoint_t *stackptr = stack;
rd_metric_t mo;
memset(&mo,0,sizeof(mo));
- memcpy(&fr_nocode,fr,sizeof(fr_nocode));
-
for(i=0;i<4;i++){
/* Blocks must be handled in Hilbert order which is defined by MB
position within the SB. And, of course, the MVs have to be in
@@ -788,8 +790,7 @@
int bi = macroblock_phase_Y[mb_phase][i];
int fi = mb->Ryuv[0][bi];
- fr_skipblock(cpi,&fr_nocode);
- if(TQB(cpi,ps,mode,fi,mb->mv[bi],fr_block_coding_cost(cpi,fr),&mo,rc,&stackptr)){
+ if(TQB(cpi,ps,mode,fi,mb->mv[bi],fr_cost1(fr),&mo,rc,&stackptr)){
fr_codeblock(cpi,fr);
coded++;
}else{
@@ -804,17 +805,21 @@
if(coded){
/* block by block, still coding the MB. Now consider the
macroblock coding cost as a whole (mode and MV) */
- int fr_overhead = fr->cost - fr_nocode.cost;
- if(mo.uncoded_ssd <= mo.ssd+((cpi->skip_lambda*(mo.cost+fr_overhead+mode_overhead))>>(OC_BIT_SCALE))){
+ int codecost = mo.cost+fr_cost4(&fr_checkpoint,fr)+mode_overhead;
+ if(mo.uncoded_ssd <= mo.ssd+((cpi->skip_lambda*codecost)>>(OC_BIT_SCALE))){
/* taking macroblock overhead into account, it is not worth coding this MB */
tokenlog_rollback(cpi, stack, stackptr-stack);
+ memcpy(fr,&fr_checkpoint,sizeof(fr_checkpoint));
+ cpi->fr_full_count = full_checkpoint;
+ cpi->fr_partial_count = partial_checkpoint;
+ cpi->fr_block_count = block_checkpoint;
- memcpy(fr,&fr_nocode,sizeof(fr_nocode));
for(i=0;i<4;i++){
int fi = mb->Ryuv[0][i];
if(cp[fi])
uncode_frag(cpi,fi,0);
+ fr_skipblock(cpi,fr);
}
coded=0;
@@ -906,7 +911,7 @@
}else
mv = mb->mv[0];
- if(TQB(cpi,ps,mb->mode,fi,mv,fr_block_coding_cost(cpi,fr),&mo,rc,&stackptr)){
+ if(TQB(cpi,ps,mb->mode,fi,mv,fr_cost1(fr),&mo,rc,&stackptr)){
fr_codeblock(cpi,fr);
tokenlog_commit(cpi, stack, stackptr-stack);
coded++;
@@ -937,6 +942,9 @@
ps_setup_frame(cpi,&ps);
ps_setup_plane(cpi,&ps,0);
fr_clear(cpi,&fr);
+ cpi->fr_full_count=0;
+ cpi->fr_partial_count=0;
+ cpi->fr_block_count=0;
memset(rho_count,0,sizeof(rho_count));
cpi->MVBits_0 = 0;
More information about the commits
mailing list