# HG changeset patch # User michael # Date 1106526918 0 # Node ID 7a875ef7597b3c90576468d984e98a6b44987e87 # Parent 915094e3da5d177f9110fd9bf30f072d009a0219 fixing many bugs in bitplane_decoding() spliting row/colskip cases into their own functions as these will be needed for NORM/DIFF-6 diff -r 915094e3da5d -r 7a875ef7597b vc9.c --- a/vc9.c Sun Jan 23 22:54:51 2005 +0000 +++ b/vc9.c Mon Jan 24 00:35:18 2005 +0000 @@ -699,11 +699,40 @@ #define IMODE_ROWSKIP 5 #define IMODE_COLSKIP 6 +static void decode_rowskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){ + int x, y; + + for (y=0; ygb, 1)) //rowskip + memset(plane, 0, width); + else + for (x=0; xgb, 1); + plane += stride; + } +} + +static void decode_colskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){ + int x, y; + + for (x=0; xgb, 1)) //colskip + for (y=0; ygb, 1); + plane ++; + } +} + //FIXME optimize +//FIXME is this supposed to set elements to 0/FF or 0/1? static int bitplane_decoding(uint8_t* plane, int width, int height, VC9Context *v) { - int imode, x, y, code; + int imode, x, y, i, code, use_vertical_tile; uint8_t invert, *planep = plane; + int stride= width; invert = get_bits(&v->gb, 1); imode = get_vlc2(&v->gb, vc9_imode_vlc.table, VC9_IMODE_VLC_BITS, 2); @@ -717,76 +746,61 @@ { for (x=0; xgb, 1)); //-1=0xFF - planep += width; + planep += stride; } + invert=0; //spec says ignore invert if raw break; case IMODE_DIFF2: case IMODE_NORM2: if ((height*width) & 1) *(++planep) = get_bits(&v->gb, 1); - code = get_vlc2(&v->gb, vc9_norm2_vlc.table, VC9_NORM2_VLC_BITS, 2); - *(++planep) = code&1; //lsb => left - *(++planep) = code&2; //msb => right - this is a bitplane, so only !0 matters + for(i=0; i<(height*width)>>1; i++){ + code = get_vlc2(&v->gb, vc9_norm2_vlc.table, VC9_NORM2_VLC_BITS, 2); + *(++planep) = code&1; //lsb => left + *(++planep) = code&2; //msb => right - this is a bitplane, so only !0 matters + //FIXME width->stride + } break; case IMODE_DIFF6: case IMODE_NORM6: + use_vertical_tile= height%3==0 && width%3!=0; + if(use_vertical_tile){ + }else{ + } + av_log(v->avctx, AV_LOG_ERROR, "Imode using Norm-6 isn't supported\n"); return -1; break; case IMODE_ROWSKIP: - for (y=0; ygb, 1)) //rowskip - memset(planep, 0, width); - else for (x=0; xgb, 1); - planep += width; - } + decode_rowskip(plane, width, height, stride, v); break; case IMODE_COLSKIP: //Teh ugly - for (x=0; xgb, 1)) //colskip - { - for (y=0; ygb, 1); - planep += width; - } - } - } + decode_rowskip(plane, width, height, stride, v); break; default: break; } /* Applying diff operator */ - if (imode == IMODE_DIFF2 || imode == IMODE_DIFF2) + if (imode == IMODE_DIFF2 || imode == IMODE_DIFF6) { - /* And what about j=0 !? */ - planep = plane + width; - memset(plane, invert, width); - for (y=0; y