16 if (!pSrc2vuyLine || !pDstv210Line || !inNumPixels)
19 for (
UWord inputCount = 0, outputCount = 0; inputCount < (inNumPixels * 2); outputCount += 4, inputCount += 12)
34 if (!pInSrcLine_2vuy || !pOutDstLine_yuy2 || !inNumPixels)
37 const UWord* pSrc =
reinterpret_cast<const UWord*
>(pInSrcLine_2vuy);
38 UWord* pDst = pOutDstLine_yuy2;
40 for (
UWord pixIndex(0); pixIndex < inNumPixels; pixIndex++)
51 if (!pSrcv210Line || !pDst2vuyLine || !inNumPixels)
54 for (
ULWord sampleCount = 0, dataCount = 0; sampleCount < (inNumPixels * 2); sampleCount += 3, dataCount++)
56 const UByte * pByte (
reinterpret_cast<const UByte*
>(&pSrcv210Line[dataCount]));
59 pDst2vuyLine[sampleCount ] = ((pByte[1] & 0x03) << 6) + (pByte[0] >> 2);
60 pDst2vuyLine[sampleCount + 1] = ((pByte[2] & 0x0F) << 4) + (pByte[1] >> 4);
61 pDst2vuyLine[sampleCount + 2] = ((pByte[3] & 0x3F) << 2) + (pByte[2] >> 6);
71 const ULWord * pInSrcLine (
reinterpret_cast<const ULWord*
>(pInSrcLine_v210));
72 outDstLine2vuy.clear();
73 if (!pInSrcLine || !inNumPixels)
76 outDstLine2vuy.reserve(inNumPixels * 2);
77 for (
ULWord sampleCount = 0, dataCount = 0; sampleCount < (inNumPixels * 2); sampleCount += 3, dataCount++)
79 const UByte * pByte (
reinterpret_cast<const UByte*
>(&pInSrcLine[dataCount]));
82 outDstLine2vuy.push_back(
UByte((pByte[1] & 0x03) << 6) | (pByte[0] >> 2));
83 outDstLine2vuy.push_back(
UByte((pByte[2] & 0x0F) << 4) | (pByte[1] >> 4));
84 outDstLine2vuy.push_back(
UByte((pByte[3] & 0x3F) << 2) | (pByte[2] >> 6));
92 if (!pInSrcLine_8bitABGR || !pOutDstLine_10BitABGR || !inNumPixels)
95 const ULWord* pSrc =
reinterpret_cast<const ULWord*
>(pInSrcLine_8bitABGR);
96 ULWord* pDst =
reinterpret_cast< ULWord*
>(pOutDstLine_10BitABGR);
98 for (
ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
100 *pDst = ((*pSrc & 0x000000FF) << 2) |
101 ((*pSrc & 0x0000FF00) << 4) |
102 ((*pSrc & 0x00FF0000) << 6) |
103 ((*pSrc & 0xC0000000) );
112 if (!pInSrcLine_8bitABGR || !pOutDstLine_10BitDPX || !inNumPixels)
115 const ULWord* pSrc =
reinterpret_cast<const ULWord*
>(pInSrcLine_8bitABGR);
116 ULWord* pDst =
reinterpret_cast< ULWord*
>(pOutDstLine_10BitDPX);
118 for (
ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
120 *pDst = ((*pSrc & 0x000000FF) ) +
121 ((*pSrc & 0x0000FC00) >> 2) + ((*pSrc & 0x00000300) << 14) +
122 ((*pSrc & 0x00F00000) >> 4) + ((*pSrc & 0x000F0000) << 12);
131 if (!pInSrcLine_8bitABGR || !pOutDstLine_10BitDPXLE || !inNumPixels)
134 const ULWord* pSrc =
reinterpret_cast<const ULWord*
>(pInSrcLine_8bitABGR);
135 ULWord* pDst =
reinterpret_cast< ULWord*
>(pOutDstLine_10BitDPXLE);
137 for (
ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
139 *pDst = ((*pSrc & 0x000000FF) << 24) |
140 ((*pSrc & 0x0000FF00) << 6) |
141 ((*pSrc & 0x00FF0000) >> 12);
150 if (!pInSrcLine_8bitABGR || !pOutDstLine_24BitRGB || !inNumPixels)
153 const UByte* pSrc =
reinterpret_cast<const UByte*
>(pInSrcLine_8bitABGR);
154 UByte* pDst =
reinterpret_cast<UByte*
>(pOutDstLine_24BitRGB);
156 for (
ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
169 if (!pInSrcLine_8bitABGR || !pOutDstLine_24BitBGR || !inNumPixels)
172 const UByte* pSrc =
reinterpret_cast<const UByte*
>(pInSrcLine_8bitABGR);
173 UByte* pDst =
reinterpret_cast<UByte*
>(pOutDstLine_24BitBGR);
175 for (
ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
177 UByte r(*pSrc++), g(*pSrc++), b(*pSrc++);
189 if (!pInSrcLine_8bitABGR || !pOutDstLine_48BitRGB || !inNumPixels)
192 const UByte* pSrc =
reinterpret_cast<const UByte*
>(pInSrcLine_8bitABGR);
193 UByte* pDst =
reinterpret_cast<UByte*
>(pOutDstLine_48BitRGB);
195 for (
ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
197 UByte r(*pSrc++), g(*pSrc++), b(*pSrc++);
216 UByte *pYCbCr = &YCbCrLine[(startPixel&~1)*2];
218 for (
LWord pixel = 0; pixel < numPixels; pixel++ )
232 *pYCbCr++ = YCbCr.
cb;
234 *pYCbCr++ = YCbCr.
cr;
250 UWord *pYCbCr = &YCbCrLine[(startPixel&~1)*2];
252 for (
LWord pixel = 0; pixel < numPixels; pixel++ )
266 *pYCbCr++ = YCbCr.
cb;
268 *pYCbCr++ = YCbCr.
cr;
287 ycbcrPixel.
Alpha = 0;
288 UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
292 Cb1 = *ycbcrBuffer++;
294 Cr1 = *ycbcrBuffer++;
295 for (
ULWord count = 0; count < numPixels; count+=2 )
302 if (fUseSMPTERange) {
308 if (fUseSMPTERange) {
315 ycbcrPixel.
y = *ycbcrBuffer++;
318 Cb2 = *ycbcrBuffer++;
320 Cr2 = *ycbcrBuffer++;
323 ycbcrPixel.
cb = (
UByte)((Cb1+Cb2)/2);
324 ycbcrPixel.
cr = (
UByte)((Cr1+Cr2)/2);
326 if (fUseSMPTERange) {
332 if (fUseSMPTERange) {
356 UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
360 Cb1 = *ycbcrBuffer++;
362 Cr1 = *ycbcrBuffer++;
363 for (
ULWord count = 0; count < numPixels; count+=2 )
369 ycbcrPixel.
Alpha = ycbcrPixel.
y/4;
372 if (fUseSMPTERange) {
378 if (fUseSMPTERange) {
385 ycbcrPixel.
y = *ycbcrBuffer++;
387 ycbcrPixel.
Alpha = ycbcrPixel.
y/4;
391 if ( (count + 2 ) >= numPixels )
399 Cb2 = *ycbcrBuffer++;
401 Cr2 = *ycbcrBuffer++;
404 ycbcrPixel.
cb = (
UWord)((Cb1+Cb2)/2);
405 ycbcrPixel.
cr = (
UWord)((Cr1+Cr2)/2);
407 if (fUseSMPTERange) {
413 if (fUseSMPTERange) {
436 for (
ULWord pixel=0; pixel<numPixels; pixel++ )
442 rgbLineBuffer->
Red = R;
443 rgbLineBuffer->
Green = G;
444 rgbLineBuffer->
Blue = B;
460 for (
ULWord pixel=0; pixel<numPixels; pixel++ )
466 bgrLineBuffer->
Blue = B;
467 bgrLineBuffer->
Green = G;
468 bgrLineBuffer->
Red = R;
485 UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
489 Cb1 = *ycbcrBuffer++;
491 Cr1 = *ycbcrBuffer++;
492 for (
ULWord count = 0; count < numPixels; count+=2 )
498 ycbcrPixel.
Alpha = ycbcrPixel.
y;
501 if (fUseSMPTERange) {
507 if (fUseSMPTERange) {
514 ycbcrPixel.
y = *ycbcrBuffer++;
516 ycbcrPixel.
Alpha = ycbcrPixel.
y;
520 if ( (count + 2 ) >= numPixels )
528 Cb2 = *ycbcrBuffer++;
530 Cr2 = *ycbcrBuffer++;
533 ycbcrPixel.
cb = (
UWord)((Cb1+Cb2)/2);
534 ycbcrPixel.
cr = (
UWord)((Cr1+Cr2)/2);
536 if (fUseSMPTERange) {
542 if (fUseSMPTERange) {
559 ULWord * pOutYCbCrABuffer,
562 for (
ULWord count(0); count < inNumPixels; count++)
565 value |= (
ULWord(*pInYCbCrBuffer++)<<10);
566 value |= *pInYCbCrBuffer++;
567 pOutYCbCrABuffer[count] = value;
578 for (
ULWord count(0); count < inNumPixels; count++)
580 *pOutRGB10Buffer = (
ULWord(pInRGBA8Buffer->
Blue)<<22) +
594 for (
ULWord i(0); i < inNumPixels; i++)
596 pOutRGBA10Buffer[i].
Blue = (pInRGBA8Buffer[i].
Blue<<2);
597 pOutRGBA10Buffer[i].
Green = (pInRGBA8Buffer[i].
Green<<2);
598 pOutRGBA10Buffer[i].
Red = (pInRGBA8Buffer[i].
Red<<2);
599 pOutRGBA10Buffer[i].
Alpha = (pInRGBA8Buffer[i].
Alpha<<2);
609 UByte * ycbcr8BitBuffer,
612 for (
ULWord pixel=0;pixel<numPixels*2;pixel++)
614 ycbcr8BitBuffer[pixel] = ycbcr10BitBuffer[pixel]>>2;
623 for (
ULWord pixel=0;pixel<numPixels*2;pixel+=4)
625 UByte Cb = ycbcrBuffer[pixel];
626 UByte Y1 = ycbcrBuffer[pixel+1];
627 UByte Cr = ycbcrBuffer[pixel+2];
628 UByte Y2 = ycbcrBuffer[pixel+3];
629 ycbcrBuffer[pixel] = Y1;
630 ycbcrBuffer[pixel+1] = Cb;
631 ycbcrBuffer[pixel+2] = Y2;
632 ycbcrBuffer[pixel+3] = Cr;
639 for (
ULWord pixel=0;pixel<numPixels*4;pixel+=4)
641 UByte B = rgbaBuffer[pixel];
642 UByte G = rgbaBuffer[pixel+1];
643 UByte R = rgbaBuffer[pixel+2];
644 UByte A = rgbaBuffer[pixel+3];
645 rgbaBuffer[pixel] = A;
646 rgbaBuffer[pixel+1] = R;
647 rgbaBuffer[pixel+2] = G;
648 rgbaBuffer[pixel+3] = B;
655 for (
ULWord pixel=0;pixel<numPixels*4;pixel+=4)
657 UByte B = rgbaBuffer[pixel];
658 UByte G = rgbaBuffer[pixel+1];
659 UByte R = rgbaBuffer[pixel+2];
660 UByte A = rgbaBuffer[pixel+3];
661 rgbaBuffer[pixel] = R;
662 rgbaBuffer[pixel+1] = G;
663 rgbaBuffer[pixel+2] = B;
664 rgbaBuffer[pixel+3] = A;
671 for (
ULWord pixel=0;pixel<numPixels*4;pixel+=4)
673 UByte B = rgbaLineBuffer[pixel];
674 UByte G = rgbaLineBuffer[pixel+1];
675 UByte R = rgbaLineBuffer[pixel+2];
676 *rgbLineBuffer++ = R;
677 *rgbLineBuffer++ = G;
678 *rgbLineBuffer++ = B;
686 for (
ULWord pixel=0;pixel<numPixels*4;pixel+=4)
693 *rgbLineBuffer++ = R;
694 *rgbLineBuffer++ = G;
695 *rgbLineBuffer++ = B;
701 for (
ULWord pixel=0;pixel<numPixels;pixel++)
705 UWord R = rgbaLineBuffer[pixel].
Red;
706 *rgbLineBuffer++ = R;
707 *rgbLineBuffer++ = G;
708 *rgbLineBuffer++ = B;
714 for (
ULWord pixel=0;pixel<numPixels;pixel+=8)
716 for(
ULWord i = 0;i<8;i+=2)
718 UWord R = rgbaLineBuffer[pixel+i].
Red;
721 *rgbLineBuffer++ = (R & 0xFF00)>>8;
722 *rgbLineBuffer++ = (((R & 0x00F0)) | ((G & 0xF000)>>12));
723 *rgbLineBuffer++ = (G & 0x0FF0)>>4;
724 *rgbLineBuffer++ = (B & 0xFF00)>>8;
725 R = rgbaLineBuffer[pixel+i+1].
Red;
726 *rgbLineBuffer++ = (((B & 0x00F0)) | ((R & 0xF000)>>12));
727 *rgbLineBuffer++ = (R & 0x0FF0)>>4;
728 G = rgbaLineBuffer[pixel+i+1].
Green;
729 B = rgbaLineBuffer[pixel+i+1].
Blue;
730 *rgbLineBuffer++ = (G & 0xFF00)>>8;
731 *rgbLineBuffer++ = (((G & 0x00F0)) | ((B & 0xF000)>>12));
732 *rgbLineBuffer++ = (B & 0x0FF0)>>4;
740 for (
ULWord pixel = 0; pixel < inNumPixels * 4; pixel += 4)
742 UByte B = pInRGBALineBuffer[pixel];
743 UByte G = pInRGBALineBuffer[pixel+1];
744 UByte R = pInRGBALineBuffer[pixel+2];
745 *pOutRGBLineBuffer++ = B;
746 *pOutRGBLineBuffer++ = G;
747 *pOutRGBLineBuffer++ = R;
755 ULWord* outputBuffer(
reinterpret_cast<ULWord*
>(pBuffer));
756 for (
ULWord pixel(0); pixel < inNumPixels; pixel++)
758 const ULWord Red (pBuffer[pixel].Red);
759 const ULWord Green (pBuffer[pixel].Green);
760 const ULWord Blue (pBuffer[pixel].Blue);
761 outputBuffer[pixel] = (Blue<<20) + (Green<<10) + Red;
770 ULWord * pOutputBuffer (
reinterpret_cast<ULWord*
>(pBuffer));
771 for (
ULWord pixel(0); pixel < inNumPixels; pixel++)
773 const ULWord Red (pBuffer[pixel].Red);
774 const ULWord Green (pBuffer[pixel].Green);
775 const ULWord Blue (pBuffer[pixel].Blue);
776 const ULWord value ((Red << 22) + (Green << 12) + (Blue << 2));
778 pOutputBuffer[pixel] = ((value&0xFF)<<24) + (((value>>8)&0xFF)<<16) + (((value>>16)&0xFF)<<8) + ((value>>24)&0xFF);
780 pOutputBuffer[pixel] = value;
789 ULWord * pOutputBuffer (
reinterpret_cast<ULWord*
>(pBuffer));
790 for (
ULWord pixel(0); pixel < inNumPixels; pixel++)
792 const ULWord Red (pBuffer[pixel].Red);
793 const ULWord Green (pBuffer[pixel].Green);
794 const ULWord Blue (pBuffer[pixel].Blue);
795 ULWord value = (((Red>>2)&0xFF)<<16) + (((Green>>2)&0xFF)<<8) + ((Blue>>2)&0xFF);
796 value |= ((Red&0x3)<<28) + ((Green&0x3)<<26) + ((Blue&0x3)<<24);
798 pOutputBuffer[pixel] = value;
805 UByte * pOutputBuffer (
reinterpret_cast<UByte*
>(pBuffer));
807 for (
ULWord pixel(0); pixel < inNumPixels; pixel++)
809 const ULWord Red (pBuffer[pixel].Red);
810 const ULWord Green (pBuffer[pixel].Green);
811 const ULWord Blue (pBuffer[pixel].Blue);
812 const ULWord Alpha (pBuffer[pixel].Alpha);
813 pOutputBuffer[iByte++] = (Blue & 0xFF);
814 pOutputBuffer[iByte++] = ((Blue >> 8) & 0x03) | ((Green & 0x3F) << 2);
815 pOutputBuffer[iByte++] = ((Green >> 6) & 0x0F) | ((Red & 0x0F) << 4);
816 pOutputBuffer[iByte++] = ((Red >> 4) & 0x3F) | ((Alpha & 0x03) << 6);
817 pOutputBuffer[iByte++] = ((Alpha >> 2) & 0xFF);
883 UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
887 Cb1 = *ycbcrBuffer++;
889 Cr1 = *ycbcrBuffer++;
890 for (
ULWord count = 0; count < numPixels; count+=2 )
897 if (fUseSMPTERange) {
902 rgbaBuffer[count].
Red = (rgbaBuffer[count].
Red) << 6;
903 rgbaBuffer[count].
Green = (rgbaBuffer[count].
Green) << 6;
904 rgbaBuffer[count].
Blue = (rgbaBuffer[count].
Blue) << 6;
906 if (fUseSMPTERange) {
911 rgbaBuffer[count].
Red = (rgbaBuffer[count].
Red) << 6;
912 rgbaBuffer[count].
Green = (rgbaBuffer[count].
Green) << 6;
913 rgbaBuffer[count].
Blue = (rgbaBuffer[count].
Blue) << 6;
917 ycbcrPixel.
y = *ycbcrBuffer++;
921 if ( (count + 2 ) >= numPixels )
929 Cb2 = *ycbcrBuffer++;
931 Cr2 = *ycbcrBuffer++;
934 ycbcrPixel.
cb = (
UWord)((Cb1+Cb2)/2);
935 ycbcrPixel.
cr = (
UWord)((Cr1+Cr2)/2);
937 if (fUseSMPTERange) {
942 rgbaBuffer[count+1].
Red = (rgbaBuffer[count+1].
Red) << 6;
943 rgbaBuffer[count+1].
Green = (rgbaBuffer[count+1].
Green) << 6;
944 rgbaBuffer[count+1].
Blue = (rgbaBuffer[count+1].
Blue) << 6;
946 if (fUseSMPTERange) {
951 rgbaBuffer[count+1].
Red = (rgbaBuffer[count+1].
Red) << 6;
952 rgbaBuffer[count+1].
Green = (rgbaBuffer[count+1].
Green) << 6;
953 rgbaBuffer[count+1].
Blue = (rgbaBuffer[count+1].
Blue) << 6;