[xiph-commits] r14375 - in trunk: theora theora/lib theora/lib/dec
theora/lib/dec/x86 theora-exp/lib theora-exp/lib/x86
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Sat Jan 5 21:37:38 PST 2008
Author: tterribe
Date: 2008-01-05 21:37:33 -0800 (Sat, 05 Jan 2008)
New Revision: 14375
Modified:
trunk/theora-exp/lib/internal.c
trunk/theora-exp/lib/state.c
trunk/theora-exp/lib/x86/mmxstate.c
trunk/theora/CHANGES
trunk/theora/lib/dec/bitwise.h
trunk/theora/lib/dec/decode.c
trunk/theora/lib/dec/internal.c
trunk/theora/lib/dec/quant.c
trunk/theora/lib/dec/state.c
trunk/theora/lib/dec/x86/mmxstate.c
trunk/theora/lib/dec/x86/x86int.h
trunk/theora/lib/internal.h
Log:
Minor clean-ups.
Modified: trunk/theora/CHANGES
===================================================================
--- trunk/theora/CHANGES 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/CHANGES 2008-01-06 05:37:33 UTC (rev 14375)
@@ -6,6 +6,7 @@
This is a change of behaviour from 1.0beta1.
- Document that granule_time() returns the end of the
presentation interval.
+ - Additional MMX improvements by Nils Pipenbrinck.
- Use a custom copy of the libogg bitpacker in the decoder
to avoid function call overhead.
- Fix a problem with decoder quantizer initialization.
Modified: trunk/theora/lib/dec/bitwise.h
===================================================================
--- trunk/theora/lib/dec/bitwise.h 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/bitwise.h 2008-01-06 05:37:33 UTC (rev 14375)
@@ -48,13 +48,7 @@
return -1;
}
/*If we have some bits left, but not enough, return the ones we have.*/
- if(b->endbyte*8+bits>b->storage*8){
- int rem_bits;
- rem_bits=b->storage*8-(b->endbyte*8+b->endbit);
- theorapackB_look(b,rem_bits,_ret);
- *_ret<<=bits-b->endbit-rem_bits;
- return 0;
- }
+ if((b->storage-b->endbyte)*8<bits)bits=(b->storage-b->endbyte)*8;
}
ret=b->ptr[0]<<(24+b->endbit);
if(bits>8){
@@ -63,7 +57,7 @@
ret|=b->ptr[2]<<(8+b->endbit);
if(bits>24){
ret|=b->ptr[3]<<(b->endbit);
- if(bits>32 && b->endbit)
+ if(bits>32&&b->endbit)
ret|=b->ptr[4]>>(8-b->endbit);
}
}
Modified: trunk/theora/lib/dec/decode.c
===================================================================
--- trunk/theora/lib/dec/decode.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/decode.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -516,7 +516,7 @@
}
/*Unpacks the list of macro block modes for INTER frames.*/
-void oc_dec_mb_modes_unpack(oc_dec_ctx *_dec){
+static void oc_dec_mb_modes_unpack(oc_dec_ctx *_dec){
oc_mode_unpack_func mode_unpack;
oc_mb *mb;
oc_mb *mb_end;
@@ -951,7 +951,7 @@
_token: The token value to skip.
_extra_bits: The extra bits attached to this token.
Return: The decoded coefficient value.*/
-int oc_dct_token_dec1val(int _token,int _extra_bits){
+static int oc_dct_token_dec1val(int _token,int _extra_bits){
return (*OC_TOKEN_DEC1VAL_TABLE[_token-OC_NDCT_EOB_TOKEN_MAX])(_token,
_extra_bits);
}
@@ -1183,7 +1183,7 @@
ogg_int16_t _dct_coeffs[128],int *_zzi);
/*Expands a zero run token.*/
-void oc_token_expand_zrl(int _token,int _extra_bits,
+static void oc_token_expand_zrl(int _token,int _extra_bits,
ogg_int16_t _dct_coeffs[128],int *_zzi){
int zzi;
zzi=*_zzi;
@@ -1193,27 +1193,27 @@
}
/*Expands a constant, single-value token.*/
-void oc_token_expand_const(int _token,int _extra_bits,
+static void oc_token_expand_const(int _token,int _extra_bits,
ogg_int16_t _dct_coeffs[128],int *_zzi){
_dct_coeffs[(*_zzi)++]=(ogg_int16_t)oc_token_dec1val_const(_token);
}
/*Expands category 2 single-valued tokens.*/
-void oc_token_expand_cat2(int _token,int _extra_bits,
+static void oc_token_expand_cat2(int _token,int _extra_bits,
ogg_int16_t _dct_coeffs[128],int *_zzi){
_dct_coeffs[(*_zzi)++]=
(ogg_int16_t)oc_token_dec1val_cat2(_token,_extra_bits);
}
/*Expands category 3 through 8 single-valued tokens.*/
-void oc_token_expand_cati(int _token,int _extra_bits,
+static void oc_token_expand_cati(int _token,int _extra_bits,
ogg_int16_t _dct_coeffs[128],int *_zzi){
_dct_coeffs[(*_zzi)++]=
(ogg_int16_t)oc_token_dec1val_cati(_token,_extra_bits);
}
/*Expands a category 1a zero run/value combo token.*/
-void oc_token_expand_run_cat1a(int _token,int _extra_bits,
+static void oc_token_expand_run_cat1a(int _token,int _extra_bits,
ogg_int16_t _dct_coeffs[128],int *_zzi){
int zzi;
int rl;
@@ -1225,7 +1225,7 @@
}
/*Expands all other zero run/value combo tokens.*/
-void oc_token_expand_run(int _token,int _extra_bits,
+static void oc_token_expand_run(int _token,int _extra_bits,
ogg_int16_t _dct_coeffs[128],int *_zzi){
static const int NZEROS_ADJUST[OC_NDCT_RUN_MAX-OC_DCT_RUN_CAT1B]={
6,10,1,2
Modified: trunk/theora/lib/dec/internal.c
===================================================================
--- trunk/theora/lib/dec/internal.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/internal.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -381,4 +381,3 @@
int th_packet_iskeyframe(ogg_packet *_op){
return _op->bytes<=0?0:_op->packet[0]&0x80?-1:!(_op->packet[0]&0x40);
}
-
Modified: trunk/theora/lib/dec/quant.c
===================================================================
--- trunk/theora/lib/dec/quant.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/quant.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -38,8 +38,7 @@
matrices being used for the current frame, and to recalculate these as the
qi values change between frames (this is what VP3 did).*/
void oc_dequant_tables_init(oc_quant_table *_dequant[2][3],
- int _pp_dc_scale[64],
- const th_quant_info *_qinfo){
+ int _pp_dc_scale[64],const th_quant_info *_qinfo){
int qti; /* coding mode: intra or inter */
int pli; /* Y U V */
for(qti=0;qti<2;qti++){
Modified: trunk/theora/lib/dec/state.c
===================================================================
--- trunk/theora/lib/dec/state.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/state.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -752,8 +752,8 @@
appropriate amount, always truncating _away_ from zero.*/
/*These two variables decide whether we are in half- or quarter-pixel
precision in each component.*/
- xprec=1+(!(_state->info.pixel_fmt&1)&!!_pli);
- yprec=1+(!(_state->info.pixel_fmt&2)&!!_pli);
+ xprec=1+(!(_state->info.pixel_fmt&1)&&_pli);
+ yprec=1+(!(_state->info.pixel_fmt&2)&&_pli);
/*These two variables are either 0 if all the fractional bits are 0 or 1 if
any of them are non-zero.*/
xfrac=!!(_dx&(1<<xprec)-1);
@@ -782,14 +782,14 @@
else return 1;
}
-void oc_state_frag_recon(oc_theora_state *_state, oc_fragment *_frag,
+void oc_state_frag_recon(oc_theora_state *_state,oc_fragment *_frag,
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]){
_state->opt_vtable.state_frag_recon(_state,_frag,_pli,_dct_coeffs,
_last_zzi,_ncoefs,_dc_iquant,_ac_iquant);
}
-void oc_state_frag_recon_c(oc_theora_state *_state, oc_fragment *_frag,
+void oc_state_frag_recon_c(oc_theora_state *_state,oc_fragment *_frag,
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant, const ogg_uint16_t _ac_iquant[64]){
ogg_int16_t dct_buf[64];
Modified: trunk/theora/lib/dec/x86/mmxstate.c
===================================================================
--- trunk/theora/lib/dec/x86/mmxstate.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/x86/mmxstate.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -35,7 +35,7 @@
-void oc_state_frag_recon_mmx(oc_theora_state *_state,const oc_fragment *_frag,
+void oc_state_frag_recon_mmx(oc_theora_state *_state,oc_fragment *_frag,
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]){
ogg_int16_t __attribute__((aligned(8))) res_buf[64];
@@ -148,7 +148,7 @@
dst_ystride=_state->ref_frame_bufs[dst_framei][_pli].ystride;
/*For now ystride values in all ref frames assumed to be equal.*/
if(_frag->mbmode==OC_MODE_INTRA){
- oc_frag_recon_intra(_state,_frag->buffer[dst_framei],dst_ystride,res_buf);
+ oc_frag_recon_intra_mmx(_frag->buffer[dst_framei],dst_ystride,res_buf);
}
else{
int ref_framei;
@@ -158,12 +158,12 @@
ref_ystride=_state->ref_frame_bufs[ref_framei][_pli].ystride;
if(oc_state_get_mv_offsets(_state,mvoffsets,_frag->mv[0],_frag->mv[1],
ref_ystride,_pli)>1){
- oc_frag_recon_inter2(_state,_frag->buffer[dst_framei],dst_ystride,
+ oc_frag_recon_inter2_mmx(_frag->buffer[dst_framei],dst_ystride,
_frag->buffer[ref_framei]+mvoffsets[0],ref_ystride,
_frag->buffer[ref_framei]+mvoffsets[1],ref_ystride,res_buf);
}
else{
- oc_frag_recon_inter(_state,_frag->buffer[dst_framei],dst_ystride,
+ oc_frag_recon_inter_mmx(_frag->buffer[dst_framei],dst_ystride,
_frag->buffer[ref_framei]+mvoffsets[0],ref_ystride,res_buf);
}
}
Modified: trunk/theora/lib/dec/x86/x86int.h
===================================================================
--- trunk/theora/lib/dec/x86/x86int.h 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/dec/x86/x86int.h 2008-01-06 05:37:33 UTC (rev 14375)
@@ -30,13 +30,13 @@
int _src2_ystride,const ogg_int16_t *_residue);
void oc_state_frag_copy_mmx(const oc_theora_state *_state,const int *_fragis,
int _nfragis,int _dst_frame,int _src_frame,int _pli);
-void oc_state_frag_recon_mmx(oc_theora_state *_state,const oc_fragment *_frag,
- int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
+void oc_state_frag_recon_mmx(oc_theora_state *_state,oc_fragment *_frag,
+ int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
void oc_restore_fpu_mmx(void);
void oc_idct8x8_mmx(ogg_int16_t _y[64]);
void oc_idct8x8_10_mmx(ogg_int16_t _y[64]);
void oc_fill_idct_constants_mmx(void);
-void oc_state_loop_filter_frag_rows_mmx(oc_theora_state *_state,int *_bv,
- int _refi,int _pli,int _fragy0,int _fragy_end);
+void oc_state_loop_filter_frag_rows_mmx(oc_theora_state *_state,int *_bv,
+ int _refi,int _pli,int _fragy0,int _fragy_end);
#endif
Modified: trunk/theora/lib/internal.h
===================================================================
--- trunk/theora/lib/internal.h 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora/lib/internal.h 2008-01-06 05:37:33 UTC (rev 14375)
@@ -282,7 +282,7 @@
int _src2_ystride,const ogg_int16_t *_residue);
void (*state_frag_copy)(const oc_theora_state *_state,
const int *_fragis,int _nfragis,int _dst_frame,int _src_frame,int _pli);
- void (*state_frag_recon)(oc_theora_state *_state, oc_fragment *_frag,
+ void (*state_frag_recon)(oc_theora_state *_state,oc_fragment *_frag,
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
void (*restore_fpu)(void);
@@ -453,7 +453,7 @@
int _src2_ystride,const ogg_int16_t *_residue);
void oc_state_frag_copy(const oc_theora_state *_state,const int *_fragis,
int _nfragis,int _dst_frame,int _src_frame,int _pli);
-void oc_state_frag_recon(oc_theora_state *_state, oc_fragment *_frag,
+void oc_state_frag_recon(oc_theora_state *_state,oc_fragment *_frag,
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
void oc_state_loop_filter_frag_rows(oc_theora_state *_state,int *_bv,
@@ -470,7 +470,7 @@
int _src2_ystride,const ogg_int16_t *_residue);
void oc_state_frag_copy_c(const oc_theora_state *_state,const int *_fragis,
int _nfragis,int _dst_frame,int _src_frame,int _pli);
-void oc_state_frag_recon_c(oc_theora_state *_state, oc_fragment *_frag,
+void oc_state_frag_recon_c(oc_theora_state *_state,oc_fragment *_frag,
int _pli,ogg_int16_t _dct_coeffs[128],int _last_zzi,int _ncoefs,
ogg_uint16_t _dc_iquant,const ogg_uint16_t _ac_iquant[64]);
void oc_state_loop_filter_frag_rows_c(oc_theora_state *_state,int *_bv,
Modified: trunk/theora-exp/lib/internal.c
===================================================================
--- trunk/theora-exp/lib/internal.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora-exp/lib/internal.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -363,4 +363,3 @@
int th_packet_iskeyframe(ogg_packet *_op){
return _op->bytes<=0?0:_op->packet[0]&0x80?-1:!(_op->packet[0]&0x40);
}
-
Modified: trunk/theora-exp/lib/state.c
===================================================================
--- trunk/theora-exp/lib/state.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora-exp/lib/state.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -724,8 +724,8 @@
appropriate amount, always truncating _away_ from zero.*/
/*These two variables decide whether we are in half- or quarter-pixel
precision in each component.*/
- xprec=1+(!(_state->info.pixel_fmt&1)&!!_pli);
- yprec=1+(!(_state->info.pixel_fmt&2)&!!_pli);
+ xprec=1+(!(_state->info.pixel_fmt&1)&&_pli);
+ yprec=1+(!(_state->info.pixel_fmt&2)&&_pli);
/*These two variables are either 0 if all the fractional bits are 0 or 1 if
any of them are non-zero.*/
xfrac=!!(_dx&(1<<xprec)-1);
Modified: trunk/theora-exp/lib/x86/mmxstate.c
===================================================================
--- trunk/theora-exp/lib/x86/mmxstate.c 2008-01-06 01:31:53 UTC (rev 14374)
+++ trunk/theora-exp/lib/x86/mmxstate.c 2008-01-06 05:37:33 UTC (rev 14375)
@@ -143,7 +143,7 @@
dst_ystride=_state->ref_frame_bufs[dst_framei][_pli].ystride;
/*For now ystride values in all ref frames assumed to be equal.*/
if(_frag->mbmode==OC_MODE_INTRA){
- oc_frag_recon_intra(_state,_frag->buffer[dst_framei],dst_ystride,res_buf);
+ oc_frag_recon_intra_mmx(_frag->buffer[dst_framei],dst_ystride,res_buf);
}
else{
int ref_framei;
@@ -153,12 +153,12 @@
ref_ystride=_state->ref_frame_bufs[ref_framei][_pli].ystride;
if(oc_state_get_mv_offsets(_state,mvoffsets,_frag->mv[0],_frag->mv[1],
ref_ystride,_pli)>1){
- oc_frag_recon_inter2(_state,_frag->buffer[dst_framei],dst_ystride,
+ oc_frag_recon_inter2_mmx(_frag->buffer[dst_framei],dst_ystride,
_frag->buffer[ref_framei]+mvoffsets[0],ref_ystride,
_frag->buffer[ref_framei]+mvoffsets[1],ref_ystride,res_buf);
}
else{
- oc_frag_recon_inter(_state,_frag->buffer[dst_framei],dst_ystride,
+ oc_frag_recon_inter_mmx(_frag->buffer[dst_framei],dst_ystride,
_frag->buffer[ref_framei]+mvoffsets[0],ref_ystride,res_buf);
}
}
More information about the commits
mailing list