]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Change the type of pblocks from pointers to short array into
authoriive <iive@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 22 Feb 2009 09:02:06 +0000 (09:02 +0000)
committeriive <iive@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 22 Feb 2009 09:02:06 +0000 (09:02 +0000)
pointers to array of 64 DCTELEM, similarly to other block fields.
This also get rid of some casts and fixes a warning.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17517 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/mpeg12.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/mpegvideo_xvmc.c

index 6cf03356dea77d105a4c13bf3ec1d448255164f3..343858289f1c228a36b38d759a50a7daa7d4eded 100644 (file)
@@ -308,17 +308,17 @@ static int mpeg_decode_mb(MpegEncContext *s,
         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 @@ static int mpeg_decode_mb(MpegEncContext *s,
                 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 @@ static int mpeg_decode_mb(MpegEncContext *s,
 
                     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 @@ static int mpeg_decode_mb(MpegEncContext *s,
                 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 @@ static int mpeg_decode_mb(MpegEncContext *s,
                 }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 mpeg_decode_extension(AVCodecContext *avctx,
 }
 
 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;
 }
index 2eec211abc3c801e9016086878412ed36d9c5d79..06d842b2d93abc0eb7a10ef08b622f36aba74e4d 100644 (file)
@@ -301,7 +301,7 @@ static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){
     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 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){
     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
 }
index 8f25ff3dc7b1f42c5a64e0a7f951e756745f05cf..8709deeb0235e8566a4523f6965bf6e468104414 100644 (file)
@@ -635,7 +635,7 @@ typedef struct MpegEncContext {
 
     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
index bff9543a0c8c3d2562221e02d4b08b9948acafe8..b73a399b9e4f146d6da25ac632525db54212ba7c 100644 (file)
@@ -44,7 +44,7 @@ void ff_xvmc_init_block(MpegEncContext *s)
     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 @@ void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
     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 @@ void ff_xvmc_decode_mb(MpegEncContext *s)
     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 @@ void ff_xvmc_decode_mb(MpegEncContext *s)
         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 @@ void ff_xvmc_decode_mb(MpegEncContext *s)
             // 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++;
         }