pointers to array of 64 DCTELEM, similarly to other block fields.
This also get rid of some casts and fixes a warning.
Originally committed as revision 17517 to svn://svn.ffmpeg.org/ffmpeg/trunk
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;
}
}
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;
}
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;
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;
}
}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;
}
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;
}
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:
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
}
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
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);
}
/**
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;
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);
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
// 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++;
}