1 /* ///////////////////////////////////////////////////////////////////////
2 //
3 //               INTEL CORPORATION PROPRIETARY INFORMATION
4 //  This software is supplied under the terms of a license agreement or
5 //  nondisclosure agreement with Intel Corporation and may not be copied
6 //  or disclosed except in accordance with the terms of that agreement.
7 //        Copyright (c) 2008 Intel Corporation. All Rights Reserved.
8 //
9 //  Description: Parses VC-1 bitstreams.
10 //
11 */
12 
13 #include "vc1parse.h"
14 
15 #ifdef VBP
16 #include "viddec_pm.h"
17 #endif
18 
19 /*----------------------------------------------------------------------------*/
20 
21 
22 /* put one bit into a buffer
23  * used for bitplane decoding, each bit correspond to a MB
24  * HW requires row to start at DW (32 bits) boundary
25  * input: value - bit value
26  *        mbx - image width in MB
27  *        mby - image height in MB
28  *        x   - x location (column) of MB in MB unit
29  *        y   - y location (row) of MB in MB unit
30  * output: outp - buffer to fill
31  */
32 //#define put_bit(value,x,y,mbx,mby,invert,outp)
put_bit(uint32_t value,int x,int y,int mbx,int mby,uint8_t invert,uint32_t * outp)33 static inline void put_bit( uint32_t value, int x, int y, int mbx, int mby, uint8_t invert, uint32_t* outp)
34 {
35     int bit;
36     uint32_t *out;
37 
38     bit = mby;
39 
40     value ^= invert;
41     if (!value) return; /* assume buffer is initialized with zeros */
42 
43     out = outp;
44     /* go to corresponding row location in DW unit */
45     out += (( mbx + 31 ) >> 5) * y;
46     out +=  x >> 5; /* go to corresponding column location in DW unit */
47     bit = x & 0x1f; /* compute remaining bits */
48     *out |= 1 << bit; /* put bit */
49 }
50 
51 /* if b is the bit at location (x,y)
52  * b = b^invert
53  * used for bitplane decoding, each bit correspond to a MB
54  * HW requires row to start at DW (32 bits) boundary
55  * input: value - bit value
56  *        x   - x location (column) of MB in MB unit
57  *        y   - y location (row) of MB in MB unit
58  *        mbx - image width in MB
59  * output: outp - buffer to fill
60  * returns bit value
61  */
xor_bit(int x,int y,int mbx,uint32_t invert,uint32_t * outp)62 static inline int xor_bit(  int x, int y, int mbx, uint32_t invert, uint32_t* outp)
63 {
64     int bit;
65     uint32_t *out;
66     uint8_t value;
67     //if (invert == 0) return; /* do nothing if XOR with 0 */
68 
69     out = outp;
70     out += (( mbx + 31 ) >> 5) * y; /* go to corresponding row location in DW unit */
71     out +=  x >> 5; /* go to corresponding row location in DW unit */
72     bit = x & 0x1f; /* compute remaining bits */
73 
74     if (invert == 1)
75         *out ^= (1 << bit); /* put XOR bit */
76     value = (*out & (1 << bit)) >> bit; /* return bit value */
77 
78     return(value);
79 
80 }
81 
82 /* get bit at location (x,y)
83  * used for bitplane decoding, each bit correspond to a MB
84  * HW requires row to start at DW (32 bits) boundary
85  * input: value - bit value
86  *        x   - x location (column) of MB in MB unit
87  *        y   - y location (row) of MB in MB unit
88  *        mbx - image width in MB
89  *        outp - bit buffer in dwords
90  * returns bit value
91  */
get_bit(int x,int y,int mbx,uint32_t * outp)92 static inline int get_bit(  int x, int y, int mbx, uint32_t* outp)
93 {
94     int bit;
95     uint32_t *out;
96     uint8_t value;
97 
98     out = outp;
99     out += (( mbx + 31 ) >> 5) * y; /* go to corresponding row location in DW unit */
100     out +=  x >> 5; /* go to corresponding row location in DW unit */
101     bit = x & 0x1f; /* compute remaining bits */
102     value = (*out & (1 << bit)) >> bit; /* return bit value */
103 
104     return(value);
105 
106 }
107 
vc1_InverseDiff(vc1_Bitplane * pBitplane,int32_t widthMB,int32_t heightMB)108 static void vc1_InverseDiff(vc1_Bitplane *pBitplane, int32_t widthMB, int32_t heightMB)
109 {
110     int32_t i, j, previousBit=0, temp;
111 
112     for (i = 0; i < heightMB; i++)
113     {
114         for (j = 0; j < widthMB; j++)
115         {
116             if ((i == 0 && j == 0))
117             {
118                 previousBit=xor_bit(j, i, widthMB, pBitplane->invert,
119                                     pBitplane->databits);
120             }
121             else if (j == 0) /* XOR with TOP */
122             {
123                 previousBit = get_bit(0, i-1, widthMB, pBitplane->databits);
124                 temp=xor_bit(j, i, widthMB, previousBit,
125                              pBitplane->databits);
126                 previousBit = temp;
127             }
128             //TODO isSameAsTop can be optimized
129             else if (((i > 0) && (previousBit !=
130                                   get_bit(j, i-1, widthMB, pBitplane->databits))))
131             {
132                 temp=xor_bit(j, i, widthMB, pBitplane->invert,
133                              pBitplane->databits);
134                 previousBit = temp;
135             }
136             else
137             {
138                 temp=xor_bit(j, i, widthMB, previousBit,
139                              pBitplane->databits);
140                 previousBit = temp;
141             }
142         }
143     }
144 }
145 
146 
147 /*----------------------------------------------------------------------------*/
148 /* implement normal 2 mode bitplane decoding, SMPTE 412M 8.7.3.2
149  * width, height are in MB unit.
150  */
vc1_Norm2ModeDecode(void * ctxt,vc1_Bitplane * pBitplane,int32_t width,int32_t height)151 static void vc1_Norm2ModeDecode(void* ctxt, vc1_Bitplane *pBitplane,
152                                 int32_t width, int32_t height)
153 {
154     int32_t i;
155     int32_t tmp_databits = 0;
156 
157     int32_t row[2], col[2];
158     int8_t tmp=0;
159 
160     /* disable pBitplane->invert in the Norm2 decode stage of
161        VC1_BITPLANE_DIFF2_MODE */
162     if (pBitplane->imode == VC1_BITPLANE_DIFF2_MODE)
163     {
164         tmp = pBitplane->invert;
165         pBitplane->invert=0;
166     }
167 
168     // By default, initialize the values for the even case
169     col[0] = 0;   /* i%width; */
170     row[0] = 0;   /* i/width; */
171     col[1] = 1;   /* (i+1)%width; */
172     row[1] = 0;   /* (i+1)/width; */
173 
174     // If width*height is odd, the first bit is the value of the bitplane
175     // for the first macroblock
176     if ((width*height) & 1) /* first bit if size is odd */
177     {
178         VC1_GET_BITS(1, tmp_databits);
179         put_bit(tmp_databits, 0, 0, width, height, pBitplane->invert,
180                 pBitplane->databits);
181 
182         // Modify initialization for odd sizes
183         col[0] = 1;   /* i%width; */
184         col[1] = 2;   /* (i+1)%width; */
185 
186         // Consider special case where width is 1
187         if(width == 1)
188         {
189             col[0] = 0;   /* i%width; */
190             row[0] = 1;   /* i/width; */
191             col[1] = 0;   /* (i+1)%width; */
192             row[1] = 2;   /* (i+1)/width; */
193         }
194     }
195 
196     /* decode every pair of bits in natural scan order */
197     for (i = (width*height) & 1; i < (width*height/2)*2; i += 2)
198     {
199         int32_t tmp = 0;
200 
201         //col[0]=i%width;
202         //row[0]=i/width;
203         //col[1]=(i+1)%width;
204         //row[1]=(i+1)/width;
205 
206         VC1_GET_BITS(1, tmp);
207         if (tmp == 0)
208         {
209             put_bit(0, col[0],row[0], width, height, pBitplane->invert,
210                     pBitplane->databits);
211             put_bit(0, col[1],row[1], width, height, pBitplane->invert,
212                     pBitplane->databits);
213         }
214         else
215         {
216             VC1_GET_BITS(1, tmp);
217             if (tmp == 1)
218             {
219                 put_bit(1, col[0],row[0], width, height, pBitplane->invert,
220                         pBitplane->databits);
221             	put_bit(1, col[1],row[1], width, height, pBitplane->invert,
222                         pBitplane->databits);
223             }
224             else
225             {
226                 VC1_GET_BITS(1, tmp);
227                 if (tmp == 0)
228                 {
229                     put_bit(1, col[0],row[0], width, height, pBitplane->invert,
230                             pBitplane->databits);
231             	    put_bit(0, col[1],row[1], width, height, pBitplane->invert,
232                             pBitplane->databits);
233                 }
234                 else
235                 {
236                     put_bit(0, col[0],row[0], width, height, pBitplane->invert,
237                             pBitplane->databits);
238             	    put_bit(1, col[1],row[1], width, height, pBitplane->invert,
239                             pBitplane->databits);
240                 }
241             }
242         }
243 
244         // Consider special case where width is 1
245         if(width == 1)
246         {
247             row[0] += 2;
248             row[1] += 2;
249         }
250         else
251         {
252             col[0] += 2;   /* i%width; */
253             if ( col[0] >= width )
254             {
255 		// For odd sizes, col[0] can alternatively start at 0 and 1
256                 col[0] -= width;
257                 row[0]++;
258             }
259 
260             col[1] += 2;   /* (i+1)%width; */
261             if ( col[1] >= width )
262             {
263 		// For odd sizes, col[1] can alternatively start at 0 and 1
264                 col[1] -= width;
265                 row[1]++;
266             }
267         }
268     }
269 
270     /* restore value */
271     pBitplane->invert=tmp;
272 }
273 
274 /*----------------------------------------------------------------------------*/
275 /* compute Normal-6 mode bitplane decoding
276  * algorithm is described in SMPTE 421M 8.7.3.4
277  * width, height are in MB unit.
278  */
vc1_Norm6ModeDecode(void * ctxt,vc1_Bitplane * pBitplane,int32_t width,int32_t height)279 static void vc1_Norm6ModeDecode(void* ctxt, vc1_Bitplane *pBitplane,
280                                 int32_t width, int32_t height)
281 {
282     vc1_Status status;
283     int32_t i, j, k;
284     int32_t ResidualX = 0;
285     int32_t ResidualY = 0;
286     uint8_t _2x3tiled = (((width%3)!=0)&&((height%3)==0));
287 
288     int32_t row, col;
289     int8_t tmp=0;
290 
291     /* disable pBitplane->invert in the Norm2 decode stage of
292        VC1_BITPLANE_DIFF2_MODE */
293     if (pBitplane->imode == VC1_BITPLANE_DIFF6_MODE)
294     {
295         tmp = pBitplane->invert;
296         pBitplane->invert=0;
297     }
298 
299     if (_2x3tiled)
300     {
301         int32_t sizeW = width/2;
302         int32_t sizeH = height/3;
303 
304         for (i = 0; i < sizeH; i++)
305         {
306             row = 3*i; /* compute row location for tile */
307 
308             for (j = 0; j < sizeW; j++)
309             {
310                 col = 2*j + (width & 1); /* compute column location for tile */
311 
312                 /* get k=sum(bi2^i) were i is the ith bit of the tile */
313                 status = vc1_DecodeHuffmanOne(ctxt, &k, VC1_BITPLANE_K_TBL);
314                 VC1_ASSERT(status == VC1_STATUS_OK);
315 
316                 /* put bits in tile */
317                 put_bit(k&1, col, row, width, height, pBitplane->invert,
318                         pBitplane->databits);
319                 put_bit(((k&2)>>1), col+1, row, width, height,
320                         pBitplane->invert,pBitplane->databits);
321 
322                 put_bit(((k&4)>>2), col, row+1, width, height,
323                         pBitplane->invert,pBitplane->databits);
324                 put_bit(((k&8)>>3), col+1, row+1, width, height,
325                         pBitplane->invert,pBitplane->databits);
326 
327                 put_bit(((k&16)>>4), col, row+2, width, height,
328                         pBitplane->invert,pBitplane->databits);
329                 put_bit(((k&32)>>5), col+1, row+2, width,
330                         height,pBitplane->invert, pBitplane->databits);
331             }
332         }
333         ResidualX = width & 1;
334         ResidualY = 0;
335     }
336     else /* 3x2 tile */
337     {
338         int32_t sizeW = width/3;
339         int32_t sizeH = height/2;
340 
341         for (i = 0; i < sizeH; i++)
342         {
343             row = 2*i + (height&1) ; /* compute row location for tile */
344 
345             for (j = 0; j < sizeW; j++)
346             {
347                 col = 3*j + (width%3); /* compute column location for tile */
348 
349                 /* get k=sum(bi2^i) were i is the ith bit of the tile */
350                 status = vc1_DecodeHuffmanOne(ctxt, &k, VC1_BITPLANE_K_TBL);
351                 VC1_ASSERT(status == VC1_STATUS_OK);
352 
353                 put_bit(k&1, col, row, width, height,pBitplane->invert,
354                         pBitplane->databits);
355                 put_bit((k&2)>>1, col+1, row, width, height, pBitplane->invert,
356                         pBitplane->databits);
357                 put_bit((k&4)>>2, col+2, row, width, height, pBitplane->invert,
358                         pBitplane->databits);
359 
360                 put_bit((k&8)>>3, col, row+1, width, height,pBitplane->invert,
361                         pBitplane->databits);
362                 put_bit((k&16)>>4, col+1, row+1, width,
363                         height,pBitplane->invert, pBitplane->databits);
364                 put_bit((k&32)>>5, col+2, row+1, width,
365                         height,pBitplane->invert, pBitplane->databits);
366             }
367         }
368         ResidualX = width % 3;
369         ResidualY = height & 1;
370     }
371 
372 #ifndef VBP
373     for (i = 0; i < ResidualX; i++)
374     {
375         int32_t ColSkip;
376         VC1_GET_BITS(1, ColSkip);
377 
378         if (1 == ColSkip)
379         {
380             for(j = 0; j < height; j++)
381             {
382                 int32_t Value = 0;
383                 VC1_GET_BITS(1, Value);
384                 put_bit(Value, i, j, width, height,pBitplane->invert,
385                         pBitplane->databits);
386             }
387         }
388     }
389 
390     for (j = 0; j < ResidualY; j++)
391     {
392         int32_t RowSkip;
393         VC1_GET_BITS(1, RowSkip);
394         if (1 == RowSkip)
395         {
396             for (i = ResidualX; i < width; i++)
397             {
398                 int32_t Value = 0;
399                 VC1_GET_BITS(1, Value);
400                 put_bit(Value, i, j, width, height,pBitplane->invert,
401                         pBitplane->databits);
402             }
403         }
404     }
405  #else
406 	int32_t Value = 0;
407     for (i = 0; i < ResidualX; i++)
408     {
409         int32_t ColSkip;
410         VC1_GET_BITS(1, ColSkip);
411         Value = 0;
412 		for(j = 0; j < height; j++)
413         {
414 			if (1 == ColSkip)
415         	{
416                 VC1_GET_BITS(1, Value);
417         	}
418 			put_bit(Value, i, j, width, height,pBitplane->invert,
419                         pBitplane->databits);
420         }
421     }
422 
423     for (j = 0; j < ResidualY; j++)
424     {
425         int32_t RowSkip;
426         VC1_GET_BITS(1, RowSkip);
427         Value = 0;
428 		for (i = ResidualX; i < width; i++)
429 		{
430         	if (1 == RowSkip)
431         	{
432                 VC1_GET_BITS(1, Value);
433         	}
434 			put_bit(Value, i, j, width, height,pBitplane->invert,
435                         pBitplane->databits);
436         }
437     }
438  #endif
439 
440     /* restore value */
441     pBitplane->invert=tmp;
442 
443 }
444 
445 /*----------------------------------------------------------------------------*/
446 /* initialize bitplane to array of zeros
447  * each row begins with a dword
448  * input:
449  *    width: widh in MB unit
450  *    height: height in MB unit
451  * returns even bitplane size in dwords
452  */
initBitplane(vc1_Bitplane * pBitplane,uint32_t width,uint32_t height)453 int initBitplane(vc1_Bitplane *pBitplane,uint32_t width, uint32_t height)
454 {
455     int i;
456     int numDword = 0;
457 
458     numDword = ((width + 31)>>5) *  height;
459     numDword += numDword & 1; /* add 1 in case numDword is odd */
460 
461     for (i=0;i<numDword;i++) pBitplane->databits[i] = 0;
462     return(numDword);
463 }
464 
465 /*----------------------------------------------------------------------------*/
466 /* modified IPP code for bitplane decoding
467  *    width: width in MB unit
468  *    height: height in MB unit
469  */
vc1_DecodeBitplane(void * ctxt,vc1_Info * pInfo,uint32_t width,uint32_t height,vc1_bpp_type_t bpnum)470 vc1_Status vc1_DecodeBitplane(void* ctxt, vc1_Info *pInfo,
471                               uint32_t width, uint32_t height, vc1_bpp_type_t bpnum)
472 {
473     uint32_t i, j;
474     uint32_t tempValue;
475     vc1_Status status = VC1_STATUS_OK;
476     uint32_t biplaneSz; /* bitplane sz in dwords */
477     vc1_Bitplane bp;
478     vc1_Bitplane *bpp = &bp;
479 
480     // By default, set imode to raw
481     pInfo->metadata.bp_raw[bpnum - VIDDEC_WORKLOAD_VC1_BITPLANE0] = true;
482 
483     // bitplane data would be temporarily stored in the vc1 context
484     bpp->databits = pInfo->bitplane;
485 
486     /* init bitplane to zero, function retunr bitplane buffer size in dword */
487     biplaneSz = initBitplane(bpp, width, height);
488 
489     VC1_GET_BITS(1, tempValue);
490     bpp->invert = (uint8_t) tempValue;
491 
492     if ((status = vc1_DecodeHuffmanOne(ctxt, &bpp->imode,
493                                        VC1_BITPLANE_IMODE_TBL)) != VC1_STATUS_OK)
494     {
495         return status;
496     }
497 
498     // If the imode is VC1_BITPLANE_RAW_MODE: bitplane information is in the MB layer
499     // there is no need to parse for bitplane information in the picture layer
500     // Only bits need to be appropriately set in the block control register
501     // In all other modes, bitplane information follows and needs to be parsed and sent to the decoder
502 
503     if (bpp->imode == VC1_BITPLANE_NORM2_MODE)
504     {
505         vc1_Norm2ModeDecode(ctxt, bpp, width, height);
506     }
507     else if (bpp->imode == VC1_BITPLANE_DIFF2_MODE)
508     {
509         vc1_Norm2ModeDecode(ctxt, bpp, width, height);
510         vc1_InverseDiff(bpp, width, height);
511     }
512     else if (bpp->imode == VC1_BITPLANE_NORM6_MODE)
513     {
514         vc1_Norm6ModeDecode(ctxt, bpp, width, height);
515 
516     }
517     else if (bpp->imode == VC1_BITPLANE_DIFF6_MODE)
518     {
519         vc1_Norm6ModeDecode(ctxt, bpp, width, height);
520         vc1_InverseDiff(bpp, width, height);
521     }
522     else if (bpp->imode == VC1_BITPLANE_ROWSKIP_MODE)
523     {
524 
525         for (i = 0; i < height; i++)
526         {
527             VC1_GET_BITS(1, tempValue);
528             /* if tempValue==0,  put row of zeros Dwords*/
529             if (tempValue == 1)
530             {
531                 for (j = 0; j < width; j++)
532                 {
533                     VC1_GET_BITS(1, tempValue);
534                     put_bit( tempValue, j, i, width, height, bpp->invert,
535                              bpp->databits);
536                 }
537             }
538             else if (bpp->invert) { //TO TEST
539                 for (j = 0; j < width; j++) {
540                     put_bit( 0, j, i, width, height, bpp->invert,
541                              bpp->databits);
542                 }
543             }
544         }
545 
546     }
547     else if (bpp->imode == VC1_BITPLANE_COLSKIP_MODE)
548     {
549         for (i = 0; i < width; i++)
550         {
551             VC1_GET_BITS(1, tempValue);
552             /* if tempValue==0, and invert == 0, fill column with zeros */
553             if (tempValue == 1)
554             {
555                 for (j = 0; j < height; j++)
556                 {
557                     VC1_GET_BITS(1, tempValue);
558                     put_bit( tempValue, i, j, width, height, bpp->invert,
559                              bpp->databits);
560                 }
561             }
562             else if (bpp->invert) { // fill column with ones
563                 for (j = 0; j < height; j++) {
564                     put_bit( 0, i, j, width, height, bpp->invert,
565                              bpp->databits);
566                 }
567             }//end for else
568         }
569     }
570 
571     if(bpp->imode != VC1_BITPLANE_RAW_MODE)
572     {
573         uint32_t* pl;
574         int sizeinbytes,nitems,i;
575         viddec_workload_item_t    wi;
576         uint32_t *bit_dw;
577 
578         pInfo->metadata.bp_raw[bpnum - VIDDEC_WORKLOAD_VC1_BITPLANE0] = false;
579 
580         sizeinbytes = ((( width + 31 ) / 32)) * (height) * 4;
581 
582         pl = bpp->databits;
583         bit_dw = bpp->databits;
584 
585         // How many payloads must be generated
586         nitems = (sizeinbytes + (sizeof(wi.data.data_payload) - 1)) /
587             sizeof(wi.data.data_payload);
588 
589         // Dump DMEM to an array of workitems
590         for( i = 0; i < nitems; i++ )
591         {
592             wi.vwi_type           =  bpnum;
593             wi.data.data_offset   = (char *)pl - (char *)bit_dw; // offset within struct
594             wi.data.data_payload[0] = pl[0];
595             wi.data.data_payload[1] = pl[1];
596             pl += 2;
597 
598             viddec_pm_append_workitem( ctxt, &wi );
599         }
600     }
601 
602 #ifdef VBP
603     {
604       viddec_pm_cxt_t     *cxt    = (viddec_pm_cxt_t *)ctxt;
605       vc1_viddec_parser_t *parser = (vc1_viddec_parser_t *)(cxt->codec_data);
606 
607       if (biplaneSz > 4096)
608       {
609         /* bigger than we got, so let's bail with a non meaningful error. */
610         return VC1_STATUS_ERROR;
611       }
612 
613       /* At this point bp contains the information we need for the bit-plane */
614       /* bpnum is the enumeration that tells us which bitplane this is for.  */
615       /* pInfo->picLayerHeader.ACPRED is one of the bitplanes I need to fill.*/
616       switch (bpnum)
617       {
618         case VIDDEC_WORKLOAD_VC1_BITPLANE0:
619           if (pInfo->picLayerHeader.PTYPE == VC1_B_FRAME)
620           {
621             if(bp.imode != VC1_BITPLANE_RAW_MODE)
622             {
623               pInfo->picLayerHeader.FORWARDMB.invert = bp.invert;
624               pInfo->picLayerHeader.FORWARDMB.imode = bp.imode;
625               for (i = 0; i < biplaneSz; i++)
626               {
627                 parser->bp_forwardmb[i] = bp.databits[i];
628               }
629               pInfo->picLayerHeader.FORWARDMB.databits = parser->bp_forwardmb;
630             }
631             else
632             {
633               pInfo->picLayerHeader.raw_FORWARDMB = 1;
634             }
635           }
636           if ( (pInfo->picLayerHeader.PTYPE == VC1_I_FRAME)
637                 || (pInfo->picLayerHeader.PTYPE == VC1_BI_FRAME) )
638           {
639             if(bp.imode != VC1_BITPLANE_RAW_MODE)
640             {
641               pInfo->picLayerHeader.ACPRED.invert = bp.invert;
642               pInfo->picLayerHeader.ACPRED.imode = bp.imode;
643               for (i = 0; i < biplaneSz; i++)
644               {
645                 parser->bp_acpred[i] = bp.databits[i];
646               }
647               pInfo->picLayerHeader.ACPRED.databits = parser->bp_acpred;
648             }
649             else
650             {
651               pInfo->picLayerHeader.raw_ACPRED = 1;
652             }
653           }
654           if (pInfo->picLayerHeader.PTYPE == VC1_P_FRAME)
655           {
656             if(bp.imode != VC1_BITPLANE_RAW_MODE)
657             {
658               pInfo->picLayerHeader.MVTYPEMB.invert = bp.invert;
659               pInfo->picLayerHeader.MVTYPEMB.imode = bp.imode;
660               for (i = 0; i < biplaneSz; i++)
661               {
662                 parser->bp_mvtypemb[i] = bp.databits[i];
663               }
664               pInfo->picLayerHeader.MVTYPEMB.databits = parser->bp_mvtypemb;
665             }
666             else
667             {
668               pInfo->picLayerHeader.raw_MVTYPEMB = 1;
669             }
670           }
671           break;
672         case VIDDEC_WORKLOAD_VC1_BITPLANE1:
673           if ( (pInfo->picLayerHeader.PTYPE == VC1_I_FRAME)
674                 || (pInfo->picLayerHeader.PTYPE == VC1_BI_FRAME) )
675           {
676             if(bp.imode != VC1_BITPLANE_RAW_MODE)
677             {
678               pInfo->picLayerHeader.OVERFLAGS.invert = bp.invert;
679               pInfo->picLayerHeader.OVERFLAGS.imode = bp.imode;
680               for (i = 0; i < biplaneSz; i++)
681               {
682                 parser->bp_overflags[i] = bp.databits[i];
683               }
684               pInfo->picLayerHeader.OVERFLAGS.databits = parser->bp_overflags;
685             }
686             else
687             {
688               pInfo->picLayerHeader.raw_OVERFLAGS = 1;
689             }
690           }
691           if ( (pInfo->picLayerHeader.PTYPE == VC1_P_FRAME)
692                 || (pInfo->picLayerHeader.PTYPE == VC1_B_FRAME) )
693           {
694             if(bp.imode != VC1_BITPLANE_RAW_MODE)
695             {
696               pInfo->picLayerHeader.SKIPMB.invert = bp.invert;
697               pInfo->picLayerHeader.SKIPMB.imode = bp.imode;
698               for (i = 0; i < biplaneSz; i++)
699               {
700                 parser->bp_skipmb[i] = bp.databits[i];
701               }
702               pInfo->picLayerHeader.SKIPMB.databits = parser->bp_skipmb;
703             }
704             else
705             {
706               pInfo->picLayerHeader.raw_SKIPMB = 1;
707             }
708           }
709           break;
710         case VIDDEC_WORKLOAD_VC1_BITPLANE2:
711           if ( (pInfo->picLayerHeader.PTYPE == VC1_P_FRAME)
712                 || (pInfo->picLayerHeader.PTYPE == VC1_B_FRAME) )
713           {
714             if(bp.imode != VC1_BITPLANE_RAW_MODE)
715             {
716               pInfo->picLayerHeader.DIRECTMB.invert = bp.invert;
717               pInfo->picLayerHeader.DIRECTMB.imode = bp.imode;
718               for (i = 0; i < biplaneSz; i++)
719               {
720                 parser->bp_directmb[i] = bp.databits[i];
721               }
722               pInfo->picLayerHeader.DIRECTMB.databits = parser->bp_directmb;
723             }
724             else
725             {
726               pInfo->picLayerHeader.raw_DIRECTMB = 1;
727             }
728           }
729           if ( (pInfo->picLayerHeader.PTYPE == VC1_I_FRAME)
730                 || (pInfo->picLayerHeader.PTYPE == VC1_BI_FRAME) )
731           {
732             if(bp.imode != VC1_BITPLANE_RAW_MODE)
733             {
734               pInfo->picLayerHeader.FIELDTX.invert = bp.invert;
735               pInfo->picLayerHeader.FIELDTX.imode = bp.imode;
736               for (i = 0; i < biplaneSz; i++)
737               {
738                 parser->bp_fieldtx[i] = bp.databits[i];
739               }
740               pInfo->picLayerHeader.FIELDTX.databits = parser->bp_fieldtx;
741             }
742             else
743             {
744               pInfo->picLayerHeader.raw_FIELDTX = 1;
745             }
746           }
747           break;
748       }
749     }
750 #endif
751 
752     return status;
753 }
754