Mercurial > libavcodec.hg
changeset 9003:b595a8a59967 libavcodec
Change the type of pblocks from pointers to short array into
pointers to array of 64 DCTELEM, similarly to other block fields.
This also get rid of some casts and fixes a warning.
author | iive |
---|---|
date | Sun, 22 Feb 2009 09:02:06 +0000 |
parents | eb98d61af310 |
children | aae80543bc6e |
files | mpeg12.c mpegvideo.c mpegvideo.h mpegvideo_xvmc.c |
diffstat | 4 files changed, 20 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mpeg12.c Sun Feb 22 00:56:55 2009 +0000 +++ b/mpeg12.c Sun Feb 22 09:02:06 2009 +0000 @@ -308,17 +308,17 @@ if (s->codec_id == CODEC_ID_MPEG2VIDEO) { if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { - mpeg2_fast_decode_block_intra(s, s->pblocks[i], i); + mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i); } }else{ for(i=0;i<mb_block_count;i++) { - if (mpeg2_decode_block_intra(s, s->pblocks[i], i) < 0) + if (mpeg2_decode_block_intra(s, *s->pblocks[i], i) < 0) return -1; } } } else { for(i=0;i<6;i++) { - if (ff_mpeg1_decode_block_intra(s, s->pblocks[i], i) < 0) + if (ff_mpeg1_decode_block_intra(s, *s->pblocks[i], i) < 0) return -1; } } @@ -520,7 +520,7 @@ if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { if(cbp & 32) { - mpeg2_fast_decode_block_non_intra(s, s->pblocks[i], i); + mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i); } else { s->block_last_index[i] = -1; } @@ -531,7 +531,7 @@ for(i=0;i<mb_block_count;i++) { if ( cbp & (1<<11) ) { - if (mpeg2_decode_block_non_intra(s, s->pblocks[i], i) < 0) + if (mpeg2_decode_block_non_intra(s, *s->pblocks[i], i) < 0) return -1; } else { s->block_last_index[i] = -1; @@ -543,7 +543,7 @@ if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { if (cbp & 32) { - mpeg1_fast_decode_block_inter(s, s->pblocks[i], i); + mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i); } else { s->block_last_index[i] = -1; } @@ -552,7 +552,7 @@ }else{ for(i=0;i<6;i++) { if (cbp & 32) { - if (mpeg1_decode_block_inter(s, s->pblocks[i], i) < 0) + if (mpeg1_decode_block_inter(s, *s->pblocks[i], i) < 0) return -1; } else { s->block_last_index[i] = -1; @@ -1595,7 +1595,9 @@ } static void exchange_uv(MpegEncContext *s){ - short * tmp = s->pblocks[4]; + DCTELEM (*tmp)[64]; + + tmp = s->pblocks[4]; s->pblocks[4] = s->pblocks[5]; s->pblocks[5] = tmp; }
--- a/mpegvideo.c Sun Feb 22 00:56:55 2009 +0000 +++ b/mpegvideo.c Sun Feb 22 09:02:06 2009 +0000 @@ -301,7 +301,7 @@ s->block= s->blocks[0]; for(i=0;i<12;i++){ - s->pblocks[i] = (short *)(&s->block[i]); + s->pblocks[i] = &s->block[i]; } return 0; fail: @@ -357,7 +357,7 @@ memcpy(dst, src, sizeof(MpegEncContext)); backup_duplicate_context(dst, &bak); for(i=0;i<12;i++){ - dst->pblocks[i] = (short *)(&dst->block[i]); + dst->pblocks[i] = &dst->block[i]; } //STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads }
--- a/mpegvideo.h Sun Feb 22 00:56:55 2009 +0000 +++ b/mpegvideo.h Sun Feb 22 09:02:06 2009 +0000 @@ -635,7 +635,7 @@ uint8_t *ptr_lastgob; int swap_uv;//vcr2 codec is mpeg2 varint with UV swaped - short * pblocks[12]; + DCTELEM (*pblocks[12])[64]; DCTELEM (*block)[64]; ///< points to one of the following blocks DCTELEM (*blocks)[8][64]; // for HQ mode we need to keep the best block
--- a/mpegvideo_xvmc.c Sun Feb 22 00:56:55 2009 +0000 +++ b/mpegvideo_xvmc.c Sun Feb 22 09:02:06 2009 +0000 @@ -44,7 +44,7 @@ struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; assert(render && render->xvmc_id == AV_XVMC_ID); - s->block = (DCTELEM *)(render->data_blocks + render->next_free_data_block_num * 64); + s->block = (DCTELEM (*)[64])(render->data_blocks + render->next_free_data_block_num * 64); } /** @@ -59,7 +59,7 @@ cbp <<= 12-mb_block_count; for (i = 0; i < mb_block_count; i++) { if (cbp & (1 << 11)) - s->pblocks[i] = (short *)(&s->block[j++]); + s->pblocks[i] = &s->block[j++]; else s->pblocks[i] = NULL; cbp += cbp; @@ -285,9 +285,9 @@ if (s->flags & CODEC_FLAG_GRAY) { if (s->mb_intra) { // intra frames are always full chroma blocks for (i = 4; i < blocks_per_mb; i++) { - memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])*64); // so we need to clear them + memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); // so we need to clear them if (!render->unsigned_intra) - s->pblocks[i][0] = 1 << 10; + *s->pblocks[i][0] = 1 << 10; } } else { cbp &= 0xf << (blocks_per_mb - 4); @@ -302,9 +302,9 @@ if (s->block_last_index[i] >= 0) { // I do not have unsigned_intra MOCO to test, hope it is OK. if (s->mb_intra && (render->idct || (!render->idct && !render->unsigned_intra))) - s->pblocks[i][0] -= 1 << 10; + *s->pblocks[i][0] -= 1 << 10; if (!render->idct) { - s->dsp.idct(s->pblocks[i]); + s->dsp.idct(*s->pblocks[i]); /* It is unclear if MC hardware requires pixel diff values to be * in the range [-255;255]. TODO: Clipping if such hardware is * ever found. As of now it would only be an unnecessary @@ -313,7 +313,7 @@ // copy blocks only if the codec doesn't support pblocks reordering if (s->avctx->xvmc_acceleration == 1) { memcpy(&render->data_blocks[render->next_free_data_block_num*64], - s->pblocks[i], sizeof(*s->pblocks[i])*64); + s->pblocks[i], sizeof(*s->pblocks[i])); } render->next_free_data_block_num++; }