[xiph-commits] r17106 - experimental/derf/theora-ptalarbvorm/lib
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Thu Apr 1 07:27:44 PDT 2010
Author: tterribe
Date: 2010-04-01 07:27:44 -0700 (Thu, 01 Apr 2010)
New Revision: 17106
Modified:
experimental/derf/theora-ptalarbvorm/lib/analyze.c
experimental/derf/theora-ptalarbvorm/lib/encode.c
experimental/derf/theora-ptalarbvorm/lib/internal.h
experimental/derf/theora-ptalarbvorm/lib/mcenc.c
experimental/derf/theora-ptalarbvorm/lib/state.c
Log:
Minor formatting fixes for r17105, as well as some general whitespace clean-up.
Also restructures original frame buffer allocation to avoid an uninitialized
reference.
Modified: experimental/derf/theora-ptalarbvorm/lib/analyze.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/analyze.c 2010-04-01 13:57:23 UTC (rev 17105)
+++ experimental/derf/theora-ptalarbvorm/lib/analyze.c 2010-04-01 14:27:44 UTC (rev 17106)
@@ -42,7 +42,7 @@
This is the inverse of the equivalent table OC_MODE_ALPHABETS in the
decoder.*/
static const unsigned char OC_MODE_RANKS[7][OC_NMODES]={
- /*Last MV dominates.*/
+ /*Last MV dominates.*/
/*L P M N I G GM 4*/
{3,4,2,0,1,5,6,7},
/*L P N M I G GM 4*/
@@ -769,7 +769,8 @@
frags=_enc->state.frags;
frag_offs=_enc->state.frag_buf_offs[_fragi];
ystride=_enc->state.ref_ystride[_pli];
- src=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_IO]]+frag_offs;
+ src=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_IO]]
+ +frag_offs;
borderi=frags[_fragi].borderi;
qii=frags[_fragi].qii;
if(qii&~3){
Modified: experimental/derf/theora-ptalarbvorm/lib/encode.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/encode.c 2010-04-01 13:57:23 UTC (rev 17105)
+++ experimental/derf/theora-ptalarbvorm/lib/encode.c 2010-04-01 14:27:44 UTC (rev 17106)
@@ -1599,16 +1599,16 @@
_enc->state.ref_frame_idx[OC_FRAME_SELF];
}
}
- if(_enc->prevframe_dropped==0 &&
- _enc->state.ref_frame_idx[OC_FRAME_IO]>=0){
+ if(_enc->state.ref_frame_idx[OC_FRAME_IO]>=0&&_enc->prevframe_dropped==0){
_enc->state.ref_frame_idx[OC_FRAME_PREV_ORIG]=
_enc->state.ref_frame_idx[OC_FRAME_IO];
if(_enc->state.frame_type==OC_INTRA_FRAME){
- /*The input new frame becomes both the previous and gold original-reference frames.*/
+ /*The new input frame becomes both the previous and gold
+ original-reference frames.*/
_enc->state.ref_frame_idx[OC_FRAME_GOLD_ORIG]=
_enc->state.ref_frame_idx[OC_FRAME_IO];
}
- }
+ }
/*Select a free buffer to use for the incoming frame*/
for(refi=3;refi==_enc->state.ref_frame_idx[OC_FRAME_GOLD_ORIG]||
refi==_enc->state.ref_frame_idx[OC_FRAME_PREV_ORIG];refi++);
@@ -1617,15 +1617,15 @@
This lets us add padding, so we don't have to worry about dereferencing
possibly invalid addresses, and allows us to use the same strides and
fragment offsets for both the input frame and the reference frames.*/
- oc_img_plane_copy_pad(_enc->state.ref_frame_bufs[_enc->state.ref_frame_idx[OC_FRAME_IO]]+0,img+0,
+ oc_img_plane_copy_pad(_enc->state.ref_frame_bufs[refi]+0,img+0,
pic_x,pic_y,pic_width,pic_height);
- oc_state_borders_fill_rows(&_enc->state,_enc->state.ref_frame_idx[OC_FRAME_IO],0,0,frame_height);
- oc_state_borders_fill_caps(&_enc->state,_enc->state.ref_frame_idx[OC_FRAME_IO],0);
+ oc_state_borders_fill_rows(&_enc->state,refi,0,0,frame_height);
+ oc_state_borders_fill_caps(&_enc->state,refi,0);
for(pli=1;pli<3;pli++){
- oc_img_plane_copy_pad(_enc->state.ref_frame_bufs[_enc->state.ref_frame_idx[OC_FRAME_IO]]+pli,img+pli,
+ oc_img_plane_copy_pad(_enc->state.ref_frame_bufs[refi]+pli,img+pli,
cpic_x,cpic_y,cpic_width,cpic_height);
- oc_state_borders_fill_rows(&_enc->state,_enc->state.ref_frame_idx[OC_FRAME_IO],pli,0,cframe_height);
- oc_state_borders_fill_caps(&_enc->state,_enc->state.ref_frame_idx[OC_FRAME_IO],pli);
+ oc_state_borders_fill_rows(&_enc->state,refi,pli,0,cframe_height);
+ oc_state_borders_fill_caps(&_enc->state,refi,pli);
}
/*Select a free buffer to use for the reconstructed version of this frame.*/
for(refi=0;refi==_enc->state.ref_frame_idx[OC_FRAME_GOLD]||
Modified: experimental/derf/theora-ptalarbvorm/lib/internal.h
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/internal.h 2010-04-01 13:57:23 UTC (rev 17105)
+++ experimental/derf/theora-ptalarbvorm/lib/internal.h 2010-04-01 14:27:44 UTC (rev 17106)
@@ -98,14 +98,14 @@
/*Frame classification indices.*/
/*The previous golden frame.*/
-#define OC_FRAME_GOLD (0)
+#define OC_FRAME_GOLD (0)
/*The previous frame.*/
-#define OC_FRAME_PREV (1)
+#define OC_FRAME_PREV (1)
/*The current frame.*/
-#define OC_FRAME_SELF (2)
+#define OC_FRAME_SELF (2)
/*The input or output buffer.*/
-#define OC_FRAME_IO (3)
+#define OC_FRAME_IO (3)
/*Uncompressed prev golden frame.*/
#define OC_FRAME_GOLD_ORIG (4)
/*Uncompressed previous frame. */
@@ -118,23 +118,23 @@
#define OC_MODE_INTER_NOMV (0)
/*Encoded with no motion compensated prediction.*/
#define OC_MODE_INTRA (1)
-/*Encoded difference from the previous frame offset by the given motion
- vector.*/
+/*Encoded difference from the previous frame offset by the given motion
+ vector.*/
#define OC_MODE_INTER_MV (2)
-/*Encoded difference from the previous frame offset by the last coded motion
- vector.*/
+/*Encoded difference from the previous frame offset by the last coded motion
+ vector.*/
#define OC_MODE_INTER_MV_LAST (3)
-/*Encoded difference from the previous frame offset by the second to last
- coded motion vector.*/
+/*Encoded difference from the previous frame offset by the second to last
+ coded motion vector.*/
#define OC_MODE_INTER_MV_LAST2 (4)
-/*Encoded difference from the same macro block in the previous golden
- frame.*/
+/*Encoded difference from the same macro block in the previous golden
+ frame.*/
#define OC_MODE_GOLDEN_NOMV (5)
-/*Encoded difference from the previous golden frame offset by the given motion
- vector.*/
+/*Encoded difference from the previous golden frame offset by the given motion
+ vector.*/
#define OC_MODE_GOLDEN_MV (6)
-/*Encoded difference from the previous frame offset by the individual motion
- vectors given for each block.*/
+/*Encoded difference from the previous frame offset by the individual motion
+ vectors given for each block.*/
#define OC_MODE_INTER_MV_FOUR (7)
/*The number of (coded) modes.*/
#define OC_NMODES (8)
@@ -289,7 +289,7 @@
const ptrdiff_t *_fragis,ptrdiff_t _nfragis,
int _dst_frame,int _src_frame,int _pli);
void (*state_loop_filter_frag_rows)(const oc_theora_state *_state,
- int _bv[256],int _refi,int _pli,int _fragy0,int _fragy_end);
+ int _bv[256],int _refi,int _pli,int _fragy0,int _fragy_end);
void (*restore_fpu)(void);
};
Modified: experimental/derf/theora-ptalarbvorm/lib/mcenc.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/mcenc.c 2010-04-01 13:57:23 UTC (rev 17105)
+++ experimental/derf/theora-ptalarbvorm/lib/mcenc.c 2010-04-01 14:27:44 UTC (rev 17106)
@@ -246,15 +246,14 @@
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.
_accum: Drop frame/golden MV accumulators.
_mbi: The macro block index.
_frame: The frame to use for SATD calculations and refinement,
- either OC_FRAME_PREV or OC_FRAME_GOLD.
+ either OC_FRAME_PREV or OC_FRAME_GOLD.
_frame_full: The frame to perform the 1px search on, one of OC_FRAME_PREV,
- OC_FRAME_GOLD, OC_FRAME_PREV_ORIG, or OC_FRAME_GOLD_ORIG.
- */
-void oc_mcenc_search_frame(oc_enc_ctx *_enc,int _accum[2],int _mbi,int _frame, int _frame_full){
+ OC_FRAME_GOLD, OC_FRAME_PREV_ORIG, or OC_FRAME_GOLD_ORIG.*/
+void oc_mcenc_search_frame(oc_enc_ctx *_enc,int _accum[2],int _mbi,int _frame,
+ int _frame_full){
/*Note: Traditionally this search is done using a rate-distortion objective
function of the form D+lambda*R.
However, xiphmont tested this and found it produced a small degredation,
@@ -275,7 +274,7 @@
const ptrdiff_t *fragis;
const unsigned char *src;
const unsigned char *ref;
- const unsigned char *ref_satd;
+ const unsigned char *satd_ref;
int ystride;
oc_mb_enc_info *embs;
ogg_int32_t hit_cache[31];
@@ -301,7 +300,7 @@
fragis=_enc->state.mb_maps[_mbi][0];
src=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[OC_FRAME_IO]];
ref=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[_frame_full]];
- ref_satd=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[_frame]];
+ satd_ref=_enc->state.ref_frame_data[_enc->state.ref_frame_idx[_frame]];
ystride=_enc->state.ref_ystride[0];
/*TODO: customize error function for speed/(quality+size) tradeoff.*/
best_err=oc_mcenc_ysad_check_mbcandidate_fullpel(_enc,
@@ -488,7 +487,7 @@
candx=best_vec[0];
candy=best_vec[1];
embs[_mbi].satd[_frame]=oc_mcenc_ysatd_check_mbcandidate_fullpel(_enc,
- frag_buf_offs,fragis,candx,candy,src,ref_satd,ystride);
+ frag_buf_offs,fragis,candx,candy,src,satd_ref,ystride);
embs[_mbi].analysis_mv[0][_frame][0]=(signed char)(candx<<1);
embs[_mbi].analysis_mv[0][_frame][1]=(signed char)(candy<<1);
if(_frame==OC_FRAME_PREV){
@@ -496,7 +495,7 @@
candx=best_block_vec[bi][0];
candy=best_block_vec[bi][1];
embs[_mbi].block_satd[bi]=oc_mcenc_ysatd_check_bcandidate_fullpel(_enc,
- frag_buf_offs[fragis[bi]],candx,candy,src,ref_satd,ystride);
+ frag_buf_offs[fragis[bi]],candx,candy,src,satd_ref,ystride);
embs[_mbi].block_mv[bi][0]=(signed char)(candx<<1);
embs[_mbi].block_mv[bi][1]=(signed char)(candy<<1);
}
Modified: experimental/derf/theora-ptalarbvorm/lib/state.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/state.c 2010-04-01 13:57:23 UTC (rev 17105)
+++ experimental/derf/theora-ptalarbvorm/lib/state.c 2010-04-01 14:27:44 UTC (rev 17106)
@@ -469,7 +469,7 @@
unrestricted motion vectors without special casing the boundary.
If chroma is decimated in either direction, the padding is reduced by a
factor of 2 on the appropriate sides.
- _nrefs: The number of reference buffers to init; must be 3, 4, or 6.*/
+ _nrefs: The number of reference buffers to init; must be in the range 3...6.*/
static int oc_state_ref_bufs_init(oc_theora_state *_state,int _nrefs){
th_info *info;
unsigned char *ref_frame_data;
@@ -581,8 +581,8 @@
_state->ref_frame_idx[OC_FRAME_PREV]=
_state->ref_frame_idx[OC_FRAME_GOLD_ORIG]=
_state->ref_frame_idx[OC_FRAME_PREV_ORIG]=
- _state->ref_frame_idx[OC_FRAME_SELF]=-1;
- _state->ref_frame_idx[OC_FRAME_IO]=_nrefs>3?3:-1;
+ _state->ref_frame_idx[OC_FRAME_SELF]=
+ _state->ref_frame_idx[OC_FRAME_IO]=-1;
return 0;
}
More information about the commits
mailing list