[xiph-commits] r17337 - in experimental/derf/theora-ptalarbvorm/lib: . c64x
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Mon Jul 19 09:08:54 PDT 2010
Author: tterribe
Date: 2010-07-19 09:08:54 -0700 (Mon, 19 Jul 2010)
New Revision: 17337
Modified:
experimental/derf/theora-ptalarbvorm/lib/analyze.c
experimental/derf/theora-ptalarbvorm/lib/c64x/c64xdec.c
experimental/derf/theora-ptalarbvorm/lib/c64x/c64xidct.c
experimental/derf/theora-ptalarbvorm/lib/decode.c
experimental/derf/theora-ptalarbvorm/lib/internal.h
experimental/derf/theora-ptalarbvorm/lib/tokenize.c
Log:
Minor code clean-ups from the past few commits.
This commit should not change any actual results.
Modified: experimental/derf/theora-ptalarbvorm/lib/analyze.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/analyze.c 2010-07-19 03:43:42 UTC (rev 17336)
+++ experimental/derf/theora-ptalarbvorm/lib/analyze.c 2010-07-19 16:08:54 UTC (rev 17337)
@@ -1756,8 +1756,9 @@
_enc->sp_level<OC_SP_LEVEL_NOMC&&_enc->keyframe_frequency_force>1){
oc_mcenc_search(_enc,mbi);
}
- if(_enc->sp_level<OC_SP_LEVEL_FAST_ANALYSIS)
+ if(_enc->sp_level<OC_SP_LEVEL_FAST_ANALYSIS){
oc_analyze_intra_mb_luma(_enc,pipe.qs+0,mbi,rd_scale);
+ }
mb_modes[mbi]=OC_MODE_INTRA;
oc_enc_mb_transform_quantize_intra_luma(_enc,&pipe,
mbi,rd_scale,rd_iscale);
@@ -1994,7 +1995,7 @@
_modec->rate=rate;
}
-static unsigned oc_skip_cost(oc_enc_ctx *_enc,oc_enc_pipeline_state *_pipe,
+static void oc_skip_cost(oc_enc_ctx *_enc,oc_enc_pipeline_state *_pipe,
unsigned _mbi,const unsigned _rd_scale[4],unsigned _ssd[12]){
const unsigned char *src;
const unsigned char *ref;
@@ -2007,7 +2008,6 @@
oc_mv *mvs;
int map_nidxs;
unsigned uncoded_ssd;
- unsigned total_ssd;
int mapii;
int mapi;
int pli;
@@ -2022,7 +2022,6 @@
frag_buf_offs=_enc->state.frag_buf_offs;
sb_map=_enc->state.sb_maps[_mbi>>2][_mbi&3];
mvs=_enc->mb_info[_mbi].block_mv;
- total_ssd=0;
for(bi=0;bi<4;bi++){
fragi=sb_map[bi];
borderi=frags[fragi].borderi;
@@ -2042,7 +2041,6 @@
hard limit.*/
if(mvs[bi][0]!=0||mvs[bi][1]!=0)uncoded_ssd*=2;
_pipe->skip_ssd[0][fragi-_pipe->froffset[0]]=_ssd[bi]=uncoded_ssd;
- total_ssd+=uncoded_ssd>>4;
}
mb_map=(const oc_mb_map_plane *)_enc->state.mb_maps[_mbi];
map_nidxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
@@ -2073,11 +2071,9 @@
a hard limit*/
if(mvs[OC_FRAME_PREV][0]!=0||mvs[OC_FRAME_PREV][1]!=0)uncoded_ssd*=2;
_pipe->skip_ssd[pli][fragi-_pipe->froffset[pli]]=_ssd[mapii]=uncoded_ssd;
- total_ssd+=uncoded_ssd>>4;
}
map_nidxs=(map_nidxs-4<<1)+4;
}
- return total_ssd;
}
@@ -2402,7 +2398,6 @@
unsigned skip_ssd[12];
unsigned intra_satd[12];
unsigned luma;
- unsigned uncoded_ssd;
int mb_mv_bits_0;
int mb_gmv_bits_0;
int inter_mv_pref;
@@ -2454,7 +2449,7 @@
}
}
/*Estimate the cost in a delta frame for various modes.*/
- uncoded_ssd=oc_skip_cost(_enc,&pipe,mbi,rd_scale,skip_ssd);
+ oc_skip_cost(_enc,&pipe,mbi,rd_scale,skip_ssd);
if(sp_level<OC_SP_LEVEL_NOMC){
oc_cost_inter_nomv(_enc,modes+OC_MODE_INTER_NOMV,mbi,
OC_MODE_INTER_NOMV,pipe.fr+0,pipe.qs+0,skip_ssd,rd_scale);
@@ -2487,7 +2482,7 @@
modes[OC_MODE_INTER_MV_FOUR].cost=UINT_MAX;
}
if(modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_INTER_MV].cost&&
- modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_GOLDEN_MV].cost){
+ modes[OC_MODE_INTER_MV_FOUR].cost<modes[OC_MODE_GOLDEN_MV].cost){
if(!(embs[mbi].refined&0x80)){
oc_mcenc_refine4mv(_enc,mbi);
embs[mbi].refined|=0x80;
@@ -2540,7 +2535,7 @@
mb_mode=OC_MODE_INTER_MV;
}
}
- else {
+ else{
oc_cost_inter_nomv(_enc,modes+OC_MODE_INTER_NOMV,mbi,
OC_MODE_INTER_NOMV,pipe.fr+0,pipe.qs+0,skip_ssd,rd_scale);
oc_cost_intra(_enc,modes+OC_MODE_INTRA,mbi,
Modified: experimental/derf/theora-ptalarbvorm/lib/c64x/c64xdec.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/c64x/c64xdec.c 2010-07-19 03:43:42 UTC (rev 17336)
+++ experimental/derf/theora-ptalarbvorm/lib/c64x/c64xdec.c 2010-07-19 16:08:54 UTC (rev 17337)
@@ -90,9 +90,6 @@
OC_FRAME_FOR_MODE(u_frags[fragi+1].mb_mode):-1;
}
ref=OC_FRAME_FOR_MODE(frags[fragi].mb_mode);
- /*HACK: This p0 reference could potentially be out of bounds, but
- because we know what allocator we're using, we know it can't
- segfault.*/
if(frags[fragi].coded){
static const int OC_PRED_SCALE[16][2]={
{0x00000000,0x00000000},
@@ -119,6 +116,9 @@
int pred;
int pflags;
/*29 cycles.*/
+ /*HACK: This p0 reference could potentially be out of bounds, but
+ because we know what allocator Leonora is using, we know it can't
+ segfault.*/
p0=u_frags[fragi-1].dc;
p1=u_frags[fragi].dc;
p2=u_frags[fragi+1].dc;
Modified: experimental/derf/theora-ptalarbvorm/lib/c64x/c64xidct.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/c64x/c64xidct.c 2010-07-19 03:43:42 UTC (rev 17336)
+++ experimental/derf/theora-ptalarbvorm/lib/c64x/c64xidct.c 2010-07-19 16:08:54 UTC (rev 17337)
@@ -18,13 +18,13 @@
#include "c64xint.h"
#include "dct.h"
-#define DOC_C1S7 ((OC_C1S7<<16)|(OC_C1S7&0xffff))
-#define DOC_C2S6 ((OC_C2S6<<16)|(OC_C2S6&0xffff))
-#define DOC_C3S5 ((OC_C3S5<<16)|(OC_C3S5&0xffff))
-#define DOC_C4S4 ((OC_C4S4<<16)|(OC_C4S4&0xffff))
-#define DOC_C5S3 ((OC_C5S3<<16)|(OC_C5S3&0xffff))
-#define DOC_C6S2 ((OC_C6S2<<16)|(OC_C6S2&0xffff))
-#define DOC_C7S1 ((OC_C7S1<<16)|(OC_C7S1&0xffff))
+#define OC_C1S7D ((OC_C1S7<<16)|(OC_C1S7&0xFFFF))
+#define OC_C2S6D ((OC_C2S6<<16)|(OC_C2S6&0xFFFF))
+#define OC_C3S5D ((OC_C3S5<<16)|(OC_C3S5&0xFFFF))
+#define OC_C4S4D ((OC_C4S4<<16)|(OC_C4S4&0xFFFF))
+#define OC_C5S3D ((OC_C5S3<<16)|(OC_C5S3&0xFFFF))
+#define OC_C6S2D ((OC_C6S2<<16)|(OC_C6S2&0xFFFF))
+#define OC_C7S1D ((OC_C7S1<<16)|(OC_C7S1&0xFFFF))
/*Various building blocks for the iDCT implementations.
These are done in macros instead of functions so that we can use all local
@@ -92,48 +92,48 @@
ll=_addsub2(x0,x4); \
a=_hill(ll); \
b=_loll(ll); \
- t0=_packh2(_mpyhus(DOC_C4S4,a),_mpyus(DOC_C4S4,a)); \
- t1=_packh2(_mpyhus(DOC_C4S4,b),_mpyus(DOC_C4S4,b)); \
- ll=_mpy2ll(DOC_C6S2,x2); \
+ t0=_packh2(_mpyhus(OC_C4S4D,a),_mpyus(OC_C4S4D,a)); \
+ t1=_packh2(_mpyhus(OC_C4S4D,b),_mpyus(OC_C4S4D,b)); \
+ ll=_mpy2ll(OC_C6S2D,x2); \
a=_packh2(_hill(ll),_loll(ll)); \
- ll=_mpy2ll(DOC_C2S6,x6); \
+ ll=_mpy2ll(OC_C2S6D,x6); \
b=_add2(_packh2(_hill(ll),_loll(ll)),x6); \
t2=_sub2(a,b); \
- ll=_mpy2ll(DOC_C2S6,x2); \
+ ll=_mpy2ll(OC_C2S6D,x2); \
a=_add2(_packh2(_hill(ll),_loll(ll)),x2); \
- ll=_mpy2ll(DOC_C6S2,x6); \
+ ll=_mpy2ll(OC_C6S2D,x6); \
b=_packh2(_hill(ll),_loll(ll)); \
t3=_add2(a,b); \
- ll=_mpy2ll(DOC_C7S1,x1); \
+ ll=_mpy2ll(OC_C7S1D,x1); \
a=_packh2(_hill(ll),_loll(ll)); \
- ll=_mpy2ll(DOC_C1S7,x7); \
+ ll=_mpy2ll(OC_C1S7D,x7); \
b=_add2(_packh2(_hill(ll),_loll(ll)),x7); \
t4=_sub2(a,b); \
- ll=_mpy2ll(DOC_C3S5,x5); \
+ ll=_mpy2ll(OC_C3S5D,x5); \
a=_add2(_packh2(_hill(ll),_loll(ll)),x5); \
- ll=_mpy2ll(DOC_C5S3,x3); \
+ ll=_mpy2ll(OC_C5S3D,x3); \
b=_add2(_packh2(_hill(ll),_loll(ll)),x3); \
t5=_sub2(a,b); \
- ll=_mpy2ll(DOC_C5S3,x5); \
+ ll=_mpy2ll(OC_C5S3D,x5); \
a=_add2(_packh2(_hill(ll),_loll(ll)),x5); \
- ll=_mpy2ll(DOC_C3S5,x3); \
+ ll=_mpy2ll(OC_C3S5D,x3); \
b=_add2(_packh2(_hill(ll),_loll(ll)),x3); \
t6=_add2(a,b); \
- ll=_mpy2ll(DOC_C1S7,x1); \
+ ll=_mpy2ll(OC_C1S7D,x1); \
a=_add2(_packh2(_hill(ll),_loll(ll)),x1); \
- ll=_mpy2ll(DOC_C7S1,x7); \
+ ll=_mpy2ll(OC_C7S1D,x7); \
b=_packh2(_hill(ll),_loll(ll)); \
t7=_add2(a,b); \
/*Stage 2:*/ \
ll=_addsub2(t4,t5); \
t4=_hill(ll); \
b=_loll(ll); \
- ll=_mpy2ll(DOC_C4S4,b); \
+ ll=_mpy2ll(OC_C4S4D,b); \
t5=_add2(_packh2(_hill(ll),_loll(ll)),b); \
ll=_addsub2(t7,t6); \
t7=_hill(ll); \
b=_loll(ll); \
- ll=_mpy2ll(DOC_C4S4,b); \
+ ll=_mpy2ll(OC_C4S4D,b); \
t6=_add2(_packh2(_hill(ll),_loll(ll)),b); \
/*Stage 3:*/ \
ll=_addsub2(t0,t3); \
@@ -154,31 +154,31 @@
long long ll; \
int a; \
/*Stage 1:*/ \
- ll=_mpy2ll(DOC_C4S4,x0); \
+ ll=_mpy2ll(OC_C4S4D,x0); \
t0=_add2(_packh2(_hill(ll),_loll(ll)),x0); \
t1=t0; \
- ll=_mpy2ll(DOC_C6S2,x2); \
+ ll=_mpy2ll(OC_C6S2D,x2); \
t2=_packh2(_hill(ll),_loll(ll)); \
- ll=_mpy2ll(DOC_C2S6,x2); \
+ ll=_mpy2ll(OC_C2S6D,x2); \
t3=_add2(_packh2(_hill(ll),_loll(ll)),x2); \
- ll=_mpy2ll(DOC_C7S1,x1); \
+ ll=_mpy2ll(OC_C7S1D,x1); \
t4=_packh2(_hill(ll),_loll(ll)); \
- ll=_mpy2ll(DOC_C5S3,x3); \
+ ll=_mpy2ll(OC_C5S3D,x3); \
t5=_add2(_packh2(_hill(ll),_loll(ll)),x3); \
- ll=_mpy2ll(DOC_C3S5,x3); \
+ ll=_mpy2ll(OC_C3S5D,x3); \
t6=_add2(_packh2(_hill(ll),_loll(ll)),x3); \
- ll=_mpy2ll(DOC_C1S7,x1); \
+ ll=_mpy2ll(OC_C1S7D,x1); \
t7=_add2(_packh2(_hill(ll),_loll(ll)),x1); \
/*Stage 2:*/ \
ll=_addsub2(t4,t5); \
t4=_loll(ll); \
a=_hill(ll); \
- ll=_mpy2ll(DOC_C4S4,a); \
+ ll=_mpy2ll(OC_C4S4D,a); \
t5=_add2(_packh2(_hill(ll),_loll(ll)),a); \
ll=_addsub2(t7,t6); \
t7=_hill(ll); \
a=_loll(ll); \
- ll=_mpy2ll(DOC_C4S4,a); \
+ ll=_mpy2ll(OC_C4S4D,a); \
t6=_add2(_packh2(_hill(ll),_loll(ll)),a); \
/*Stage 3:*/ \
ll=_addsub2(t0,t3); \
@@ -198,17 +198,17 @@
do{ \
long long ll; \
/*Stage 1:*/ \
- ll=_mpy2ll(DOC_C4S4,x0); \
+ ll=_mpy2ll(OC_C4S4D,x0); \
t0=_add2(_packh2(_hill(ll),_loll(ll)),x0); \
t1=t0; \
- ll=_mpy2ll(DOC_C7S1,x1); \
+ ll=_mpy2ll(OC_C7S1D,x1); \
t4=_packh2(_hill(ll),_loll(ll)); \
- ll=_mpy2ll(DOC_C1S7,x1); \
+ ll=_mpy2ll(OC_C1S7D,x1); \
t7=_add2(_packh2(_hill(ll),_loll(ll)),x1); \
/*Stage 2:*/ \
- ll=_mpy2ll(DOC_C4S4,t4); \
+ ll=_mpy2ll(OC_C4S4D,t4); \
t5=_add2(_packh2(_hill(ll),_loll(ll)),t4); \
- ll=_mpy2ll(DOC_C4S4,t7); \
+ ll=_mpy2ll(OC_C4S4D,t7); \
t6=_add2(_packh2(_hill(ll),_loll(ll)),t7); \
/*Stage 3:*/ \
t3=t0; \
Modified: experimental/derf/theora-ptalarbvorm/lib/decode.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/decode.c 2010-07-19 03:43:42 UTC (rev 17336)
+++ experimental/derf/theora-ptalarbvorm/lib/decode.c 2010-07-19 16:08:54 UTC (rev 17337)
@@ -2212,8 +2212,9 @@
if(_dec->pipe.loop_filter){
sdelay+=notstart;
edelay+=notdone;
- oc_state_loop_filter_frag_rows(&_dec->state,_dec->pipe.bounding_values,
- refi,pli,_dec->pipe.fragy0[pli]-sdelay,_dec->pipe.fragy_end[pli]-edelay);
+ oc_state_loop_filter_frag_rows(&_dec->state,
+ _dec->pipe.bounding_values,refi,pli,
+ _dec->pipe.fragy0[pli]-sdelay,_dec->pipe.fragy_end[pli]-edelay);
}
/*To fill the borders, we have an additional two pixel delay, since a
fragment in the next row could filter its top edge, using two pixels
@@ -2250,7 +2251,8 @@
doubled, but luma might have more post-processing filters enabled
than chroma, so we don't know up front which one is the limiting
factor.*/
- avail_fragy0=OC_MINI(avail_fragy0,_dec->pipe.fragy0[pli]-sdelay<<frag_shift);
+ avail_fragy0=OC_MINI(avail_fragy0,
+ _dec->pipe.fragy0[pli]-sdelay<<frag_shift);
avail_fragy_end=OC_MINI(avail_fragy_end,
_dec->pipe.fragy_end[pli]-edelay<<frag_shift);
}
Modified: experimental/derf/theora-ptalarbvorm/lib/internal.h
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/internal.h 2010-07-19 03:43:42 UTC (rev 17336)
+++ experimental/derf/theora-ptalarbvorm/lib/internal.h 2010-07-19 16:08:54 UTC (rev 17337)
@@ -88,7 +88,7 @@
/*A predicted frame.*/
# define OC_INTER_FRAME (1)
/*A frame of unknown type (frame type decision has not yet been made).*/
-# define OC_UNKWN_FRAME ((unsigned)-1)
+# define OC_UNKWN_FRAME (-1)
/*The amount of padding to add to the reconstructed frame buffers on all
sides.
@@ -370,7 +370,7 @@
/*The granpos of the current frame.*/
ogg_int64_t granpos;
/*The type of the current frame.*/
- unsigned char frame_type;
+ signed char frame_type;
/*The bias to add to the frame count when computing granule positions.*/
unsigned char granpos_bias;
/*The number of quality indices used in the current frame.*/
Modified: experimental/derf/theora-ptalarbvorm/lib/tokenize.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/tokenize.c 2010-07-19 03:43:42 UTC (rev 17336)
+++ experimental/derf/theora-ptalarbvorm/lib/tokenize.c 2010-07-19 16:08:54 UTC (rev 17337)
@@ -768,8 +768,8 @@
total_bits=0;
/*The apparent bit-cost of coding a zero from observing the trellis
quantizer is pre-combined with lambda.
- Four predictive cases are considered: The last optimized value is zero (+2) or
- non-zero and the non-optimized value is zero (+1) or non-zero.*/
+ Four predictive cases are considered: the last optimized value is zero (+2)
+ or non-zero and the non-optimized value is zero (+1) or non-zero.*/
zr[0]=3*_lambda>>1;
zr[1]=_lambda;
zr[2]=4*_lambda;
@@ -809,7 +809,7 @@
dd1=dq1-v;
dd1*=dd1;
/*The cost of ending an eob run is included when the alternative is to
- extend this eob run.
+ extend this eob run.
A per qi/zzi weight would probably be useful.
Including it in the overall tokenization cost was not helpful.
The same is true at the far end of the zero run plus token case.*/
@@ -880,15 +880,11 @@
best_token=best_token1=OC_DCT_SHORT_ZRL_TOKEN+(nzeros+55>>6);
best_eb=best_eb1=nzeros-1;
eob2=eob_run[zzj];
- if(eob2>0){
- eob_bits2=oc_token_bits(_enc,huffi,zzj,OC_DCT_EOB1_TOKEN);
- }
- else eob_bits2=0;
+ eob_bits2=eob2>0?oc_token_bits(_enc,huffi,zzj,OC_DCT_EOB1_TOKEN):0;
zr_bits=oc_token_bits(_enc,huffi,zzi,best_token)+eob_bits2;
best_bits=zr_bits
+oc_token_bits(_enc,huffi,zzj,*(OC_DCT_VALUE_TOKEN_PTR+d0));
d=d0;
-
best_bits1=0;
if(d1!=0){
best_bits1=zr_bits
@@ -946,7 +942,8 @@
eob_run[zzi]=0;
}
oc_enc_token_log(_enc,_pli,zzi,best_token,best_eb);
- /*If a zero run won vs. the combo token we still need to code this value.*/
+ /*If a zero run won vs. the combo token we still need to code this
+ value.*/
if(best_token<=OC_DCT_ZRL_TOKEN){
oc_enc_tokenlog_checkpoint(_enc,stack++,_pli,zzj);
if(eob2){
@@ -956,7 +953,8 @@
best_bits-=eob_bits2;
eob_run[zzj]=0;
}
- oc_enc_token_log(_enc,_pli,zzj,*(OC_DCT_VALUE_TOKEN_PTR+d),*(OC_DCT_VALUE_EB_PTR+d));
+ oc_enc_token_log(_enc,_pli,zzj,
+ *(OC_DCT_VALUE_TOKEN_PTR+d),*(OC_DCT_VALUE_EB_PTR+d));
}
total_bits+=best_bits;
}
More information about the commits
mailing list