diff options
author | Ivan Kalvachev <ikalvachev@gmail.com> | 2004-03-01 14:55:21 +0000 |
---|---|---|
committer | Ivan Kalvachev <ikalvachev@gmail.com> | 2004-03-01 14:55:21 +0000 |
commit | 5e5c247a7c2e00372ced497528c5fa000181e34c (patch) | |
tree | dfad2986b74414e4918099c4d19901a32bd38717 /libavcodec/xvmcvideo.c | |
parent | 3f1d4e96008e5a83af736772cbe42f09da8b1638 (diff) | |
download | ffmpeg-5e5c247a7c2e00372ced497528c5fa000181e34c.tar.gz |
initial chroma_format changes,xvmc tweaks and codec_cap
Originally committed as revision 2833 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/xvmcvideo.c')
-rw-r--r-- | libavcodec/xvmcvideo.c | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/libavcodec/xvmcvideo.c b/libavcodec/xvmcvideo.c index eed9860338..cd64f4c3af 100644 --- a/libavcodec/xvmcvideo.c +++ b/libavcodec/xvmcvideo.c @@ -55,27 +55,66 @@ xvmc_render_state_t * render; void XVMC_pack_pblocks(MpegEncContext *s, int cbp){ int i,j; -#define numblocks 6 j=0; - for(i=0;i<numblocks;i++){ - if(cbp & (1<<(numblocks-1-i)) ){ + for(i=0;i<6;i++){ + if(cbp & (1<<(5-i)) ){ s->pblocks[i] = (short *)(&s->block[(j++)]); }else{ s->pblocks[i] = NULL; } // printf("s->pblocks[%d]=%p ,s->block=%p cbp=%d\n",i,s->pblocks[i],s->block,cbp); } + if (s->chroma_format >= 2){ + if (s->chroma_format == 2){//CHROMA_422 + for(i=6;i<8;i++){ + if(cbp & (1<<(6+7-i)) ){ + s->pblocks[i] = (short *)(&s->block[(j++)]); + }else{ + s->pblocks[i] = NULL; + } + } + }else{//CHROMA_444 + for(i=6; i<12; i++){ + if(cbp & (1<<(6+11-i)) ){ + s->pblocks[i] = (short *)(&s->block[(j++)]); + }else{ + s->pblocks[i] = NULL; + } + } + } + } } -static int calc_cbp(MpegEncContext *s, int blocknum){ +static int calc_cbp(MpegEncContext *s){ /* compute cbp */ -// for I420 bit_offset=5 int i,cbp = 0; - for(i=0; i<blocknum; i++) { + for(i=0; i<4; i++) { if(s->block_last_index[i] >= 0) cbp |= 1 << (5 - i); } + if(s->flags & CODEC_FLAG_GRAY) + return cbp; //4 block for grayscale one done + + + for(i=4; i<6; i++) { + if(s->block_last_index[i] >= 0) + cbp |= 1 << (5 - i); + } + if(s->chroma_format < 2) return cbp; + + + if(s->chroma_format == 2){/*CHROMA_422*/ + for(i=6; i<8; i++) { + if(s->block_last_index[i] >= 0) + cbp |= 1 << (6+7 - i); + } + }else{/*CHROMA_444*/ + for(i=6; i<12; i++) { + if(s->block_last_index[i] >= 0) + cbp |= 1 << (6+11 - i); + } + } return cbp; } @@ -121,7 +160,7 @@ xvmc_render_state_t * render,* last, * next; assert(last->state & MP_XVMC_STATE_PREDICTION); render->p_past_surface = last->p_surface; return 0; - } + } return -1; } @@ -256,17 +295,12 @@ const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; }//!intra //time to handle data blocks; mv_block->index = render->next_free_data_block_num; + blocks_per_mb = 6; -/* - switch( s->chroma_format){ - case CHROMA_422: - blocks_per_mb = 8; - break; - case CHROMA_444: - blocks_per_mb = 12; - break; + if( s->chroma_format >= 2){ + block_per_mb = 4 + (1 << (s->chroma_format)); } -*/ + if(s->flags & CODEC_FLAG_GRAY){ if(s->mb_intra){//intra frames are alwasy full chroma block for(i=4; i<blocks_per_mb; i++){ @@ -277,7 +311,7 @@ const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; }else blocks_per_mb = 4;//Luminance blocks only } - cbp = calc_cbp(s,blocks_per_mb); + cbp = calc_cbp(s); mv_block->coded_block_pattern = cbp; if(cbp == 0) mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN; |