diff options
Diffstat (limited to 'code/client/cl_cin.c')
-rw-r--r-- | code/client/cl_cin.c | 77 |
1 files changed, 43 insertions, 34 deletions
diff --git a/code/client/cl_cin.c b/code/client/cl_cin.c index 2e5a9b7..1fc5520 100644 --- a/code/client/cl_cin.c +++ b/code/client/cl_cin.c @@ -620,7 +620,10 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) unsigned short *aptr, *bptr, *cptr, *dptr; long y0,y1,y2,y3,cr,cb; byte *bbptr, *baptr, *bcptr, *bdptr; - unsigned int *iaptr, *ibptr, *icptr, *idptr; + union { + unsigned int *i; + unsigned short *s; + } iaptr, ibptr, icptr, idptr; if (!roq_flags) { two = four = 256; @@ -663,7 +666,7 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) VQ2TO4(aptr,bptr,cptr,dptr); } } else if (cinTable[currentHandle].samplesPerPixel==4) { - ibptr = (unsigned int *)bptr; + ibptr.s = bptr; for(i=0;i<two;i++) { y0 = (long)*input++; y1 = (long)*input++; @@ -671,20 +674,22 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) y3 = (long)*input++; cr = (long)*input++; cb = (long)*input++; - *ibptr++ = yuv_to_rgb24( y0, cr, cb ); - *ibptr++ = yuv_to_rgb24( y1, cr, cb ); - *ibptr++ = yuv_to_rgb24( y2, cr, cb ); - *ibptr++ = yuv_to_rgb24( y3, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y0, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y1, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y2, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y3, cr, cb ); } - icptr = (unsigned int *)vq4; - idptr = (unsigned int *)vq8; + icptr.s = vq4; + idptr.s = vq8; for(i=0;i<four;i++) { - iaptr = (unsigned int *)vq2 + (*input++)*4; - ibptr = (unsigned int *)vq2 + (*input++)*4; + iaptr.s = vq2; + iaptr.i += (*input++)*4; + ibptr.s = vq2; + ibptr.i += (*input++)*4; for(j=0;j<2;j++) - VQ2TO4(iaptr, ibptr, icptr, idptr); + VQ2TO4(iaptr.i, ibptr.i, icptr.i, idptr.i); } } else if (cinTable[currentHandle].samplesPerPixel==1) { bbptr = (byte *)bptr; @@ -739,7 +744,7 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) } } } else if (cinTable[currentHandle].samplesPerPixel==4) { - ibptr = (unsigned int *)bptr; + ibptr.s = bptr; for(i=0;i<two;i++) { y0 = (long)*input++; y1 = (long)*input++; @@ -747,25 +752,27 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) y3 = (long)*input++; cr = (long)*input++; cb = (long)*input++; - *ibptr++ = yuv_to_rgb24( y0, cr, cb ); - *ibptr++ = yuv_to_rgb24( y1, cr, cb ); - *ibptr++ = yuv_to_rgb24( ((y0*3)+y2)/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( ((y1*3)+y3)/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( (y0+(y2*3))/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( (y1+(y3*3))/4, cr, cb ); - *ibptr++ = yuv_to_rgb24( y2, cr, cb ); - *ibptr++ = yuv_to_rgb24( y3, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y0, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y1, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( ((y0*3)+y2)/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( ((y1*3)+y3)/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( (y0+(y2*3))/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( (y1+(y3*3))/4, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y2, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y3, cr, cb ); } - icptr = (unsigned int *)vq4; - idptr = (unsigned int *)vq8; + icptr.s = vq4; + idptr.s = vq8; for(i=0;i<four;i++) { - iaptr = (unsigned int *)vq2 + (*input++)*8; - ibptr = (unsigned int *)vq2 + (*input++)*8; + iaptr.s = vq2; + iaptr.i += (*input++)*8; + ibptr.s = vq2; + ibptr.i += (*input++)*8; for(j=0;j<2;j++) { - VQ2TO4(iaptr, ibptr, icptr, idptr); - VQ2TO4(iaptr, ibptr, icptr, idptr); + VQ2TO4(iaptr.i, ibptr.i, icptr.i, idptr.i); + VQ2TO4(iaptr.i, ibptr.i, icptr.i, idptr.i); } } } else if (cinTable[currentHandle].samplesPerPixel==1) { @@ -841,24 +848,26 @@ static void decodeCodeBook( byte *input, unsigned short roq_flags ) } } } else if (cinTable[currentHandle].samplesPerPixel == 4) { - ibptr = (unsigned int *) bptr; + ibptr.s = bptr; for(i=0;i<two;i++) { y0 = (long)*input; input+=2; y2 = (long)*input; input+=2; cr = (long)*input++; cb = (long)*input++; - *ibptr++ = yuv_to_rgb24( y0, cr, cb ); - *ibptr++ = yuv_to_rgb24( y2, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y0, cr, cb ); + *ibptr.i++ = yuv_to_rgb24( y2, cr, cb ); } - icptr = (unsigned int *)vq4; - idptr = (unsigned int *)vq8; + icptr.s = vq4; + idptr.s = vq8; for(i=0;i<four;i++) { - iaptr = (unsigned int *)vq2 + (*input++)*2; - ibptr = (unsigned int *)vq2 + (*input++)*2; + iaptr.s = vq2; + iaptr.i += (*input++)*2; + ibptr.s = vq2 + (*input++)*2; + ibptr.i += (*input++)*2; for(j=0;j<2;j++) { - VQ2TO2(iaptr,ibptr,icptr,idptr); + VQ2TO2(iaptr.i,ibptr.i,icptr.i,idptr.i); } } } |