18 #define _ENDIAN_SWAP32(_data_) (((_data_<<24)&0xff000000)|((_data_<<8)&0x00ff0000)|((_data_>>8)&0x0000ff00)|((_data_>>24)&0x000000ff))
159 AJA_PixelFormat pixFmt, uint32_t lines, uint32_t pixels, uint32_t linepitch,
160 uint16_t y, uint16_t cb, uint16_t cr )
182 rowBytes = width * 2;
187 rowBytes = (( width % 48 == 0 ) ? width : (((width / 48 ) + 1) * 48)) * 8 / 3;
192 rowBytes = width * 3;
202 rowBytes = width * 4;
211 rowBytes = width * 6;
216 rowBytes = width * 36 / 8;
222 rowBytes = width * 10 / 8;
228 rowBytes = width * 20 / 16;
235 rowBytes = width * 3 / 2;
240 rowBytes = width * 2;
244 rowBytes = width * 3;
248 rowBytes = width * 4;
264 for ( uint32_t sampleCount = 0, dataCount = 0;
265 sampleCount < (numPixels*2) ;
266 sampleCount+=3,dataCount++ )
268 ycbcrBuffer[sampleCount] = packedBuffer[dataCount]&0x3FF;
269 ycbcrBuffer[sampleCount+1] = (packedBuffer[dataCount]>>10)&0x3FF;
270 ycbcrBuffer[sampleCount+2] = (packedBuffer[dataCount]>>20)&0x3FF;
278 for ( uint32_t inputCount=0, outputCount=0;
279 inputCount < (numPixels*2);
280 outputCount += 4,inputCount += 12 )
282 packedBuffer[outputCount] = ycbcrBuffer[inputCount+0] + (ycbcrBuffer[inputCount+1]<<10) + (ycbcrBuffer[inputCount+2]<<20);
283 packedBuffer[outputCount+1] = ycbcrBuffer[inputCount+3] + (ycbcrBuffer[inputCount+4]<<10) + (ycbcrBuffer[inputCount+5]<<20);
284 packedBuffer[outputCount+2] = ycbcrBuffer[inputCount+6] + (ycbcrBuffer[inputCount+7]<<10) + (ycbcrBuffer[inputCount+8]<<20);
285 packedBuffer[outputCount+3] = ycbcrBuffer[inputCount+9] + (ycbcrBuffer[inputCount+10]<<10) + (ycbcrBuffer[inputCount+11]<<20);
293 for ( uint32_t inputCount=0, outputCount=0;
294 inputCount < (numPixels*2);
295 outputCount += 4,inputCount += 12 )
299 packedBuffer[outputCount] =
AJA_ENDIAN_SWAP32(((ycbcrBuffer[inputCount+0]<<20) + (ycbcrBuffer[inputCount+1]<<10) + (ycbcrBuffer[inputCount+2]))<<2);
300 packedBuffer[outputCount+1] =
AJA_ENDIAN_SWAP32(((ycbcrBuffer[inputCount+3]<<20) + (ycbcrBuffer[inputCount+4]<<10) + (ycbcrBuffer[inputCount+5]))<<2);
301 packedBuffer[outputCount+2] =
AJA_ENDIAN_SWAP32(((ycbcrBuffer[inputCount+6]<<20) + (ycbcrBuffer[inputCount+7]<<10) + (ycbcrBuffer[inputCount+8]))<<2);
302 packedBuffer[outputCount+3] =
AJA_ENDIAN_SWAP32(((ycbcrBuffer[inputCount+9]<<20) + (ycbcrBuffer[inputCount+10]<<10) + (ycbcrBuffer[inputCount+11]))<<2);
306 packedBuffer[outputCount] = (((ycbcrBuffer[inputCount+0]<<20) + (ycbcrBuffer[inputCount+1]<<10) + (ycbcrBuffer[inputCount+2]))<<2);
307 packedBuffer[outputCount+1] = (((ycbcrBuffer[inputCount+3]<<20) + (ycbcrBuffer[inputCount+4]<<10) + (ycbcrBuffer[inputCount+5]))<<2);
308 packedBuffer[outputCount+2] = (((ycbcrBuffer[inputCount+6]<<20) + (ycbcrBuffer[inputCount+7]<<10) + (ycbcrBuffer[inputCount+8]))<<2);
309 packedBuffer[outputCount+3] = (((ycbcrBuffer[inputCount+9]<<20) + (ycbcrBuffer[inputCount+10]<<10) + (ycbcrBuffer[inputCount+11]))<<2);
317 uint32_t* outputBuffer = (uint32_t*)rgba10BitBuffer;
318 for ( uint32_t pixel=0;pixel<numPixels;pixel++)
320 uint16_t Red = rgba10BitBuffer[pixel].
Red;
321 uint16_t Green = rgba10BitBuffer[pixel].
Green;
322 uint16_t Blue = rgba10BitBuffer[pixel].
Blue;
323 outputBuffer[pixel] = (Blue<<20) + (Green<<10) + Red;
330 uint32_t* outputBuffer = (uint32_t*)rgba10BitBuffer;
331 for ( uint32_t pixel=0;pixel<numPixels;pixel++)
333 uint16_t Red = rgba10BitBuffer[pixel].
Red;
334 uint16_t Green = rgba10BitBuffer[pixel].
Green;
335 uint16_t Blue = rgba10BitBuffer[pixel].
Blue;
336 uint32_t value = (((Red>>2)&0xFF)<<16) + (((Green>>2)&0xFF)<<8) + ((Blue>>2)&0xFF);
337 value |= ((Red&0x3)<<28) + ((Green&0x3)<<26) + ((Blue&0x3)<<24);
339 outputBuffer[pixel] = value;
346 uint32_t* outputBuffer = (uint32_t*)rgba10BitBuffer;
347 for ( uint32_t pixel=0;pixel<numPixels;pixel++)
349 uint16_t Red = rgba10BitBuffer[pixel].
Red;
350 uint16_t Green = rgba10BitBuffer[pixel].
Green;
351 uint16_t Blue = rgba10BitBuffer[pixel].
Blue;
352 uint32_t value = (Red<<22) + (Green<<12) + (Blue<<2);
354 outputBuffer[pixel] = ((value&0xFF)<<24) + (((value>>8)&0xFF)<<16) + (((value>>16)&0xFF)<<8) + ((value>>24)&0xFF);
356 outputBuffer[pixel] =value;
363 for ( uint32_t pixel=0;pixel<numPixels;pixel++)
365 uint32_t value = DPXLinebuffer[pixel];
372 rgba10BitBuffer[pixel].
Red = (value>>22)&0x3FF;
373 rgba10BitBuffer[pixel].
Green = (value>>12)&0x3FF;
374 rgba10BitBuffer[pixel].
Blue = (value>>2)&0x3FF;
383 for ( uint32_t pixel=0;pixel<numPixels;pixel++)
385 uint32_t value = DPXLinebuffer[pixel];
389 B = ((value & 0xF0000000)>>28) + ((value&0x000F0000)>>12);
390 G = ((value & 0x3F00)>>6) + ((value & 0xC00000)>>22);
395 B = (value>>22)&0x3FF;
396 G = (value>>12)&0x3FF;
397 R = (value>>2)&0x3FF;
402 *rgbaBuffer++ = 0xFF;
409 for ( uint32_t count = 0; count < numPixels*2; count+=4 )
413 buffer[count+2] = Cr;
421 for ( uint32_t count = 0; count < numPixels*2; count+=4 )
425 buffer[count+2] = Cr;
434 for ( uint32_t pixel=0;pixel<numPixels*2;pixel++)
436 ycbcr8BitBuffer[pixel] = ycbcr10BitBuffer[pixel]>>2;
450 uint16_t *pYCbCr = &YCbCrLine[(startPixel&~1)*2];
460 for ( int32_t pixel = 0; pixel < numPixels; pixel++ )
462 convertRGBAlphatoYCbCr(&RGBLine[pixel],&YCbCr);
471 *pYCbCr++ = YCbCr.
cb;
473 *pYCbCr++ = YCbCr.
cr;
487 bool fUseRGBFullRange)
490 uint16_t *pYCbCr = &YCbCrLine[(startPixel&~1)*2];
498 for ( int32_t pixel = 0; pixel < numPixels; pixel++ )
509 *pYCbCr++ = YCbCr.
cb;
511 *pYCbCr++ = YCbCr.
cr;
523 uint16_t Cb1,Y1,Cr1,Cb2,Y2,Cr2;
527 Cb1 = *ycbcrBuffer++;
529 Cr1 = *ycbcrBuffer++;
530 for ( uint32_t count = 0; count < numPixels; count+=2 )
532 ycbcrPixel.
cb = (uint16_t)Cb1;
533 ycbcrPixel.
y = (uint16_t)Y1;
534 ycbcrPixel.
cr = (uint16_t)Cr1;
543 ycbcrPixel.
y = *ycbcrBuffer++;
547 if ( (count + 2 ) >= numPixels )
555 Cb2 = *ycbcrBuffer++;
557 Cr2 = *ycbcrBuffer++;
560 ycbcrPixel.
cb = (uint16_t)((Cb1+Cb2)/2);
561 ycbcrPixel.
cr = (uint16_t)((Cr1+Cr2)/2);
584 uint16_t Cb1,Y1,Cr1,Cb2,Y2,Cr2;
588 Cb1 = (*ycbcrBuffer++)<<2;
589 Y1 = (*ycbcrBuffer++)<<2;
590 Cr1 = (*ycbcrBuffer++)<<2;
591 for ( uint32_t count = 0; count < numPixels; count+=2 )
593 ycbcrPixel.
cb = (uint16_t)Cb1;
594 ycbcrPixel.
y = (uint16_t)Y1;
595 ycbcrPixel.
cr = (uint16_t)Cr1;
604 ycbcrPixel.
y = (*ycbcrBuffer++)<<2;
608 if ( (count + 2 ) >= numPixels )
610 Cb2 = (uint16_t)(Cb1);
612 Cr2 = (uint16_t)(Cr1);
616 Cb2 = (*ycbcrBuffer++)<<2;
617 Y2 = (*ycbcrBuffer++)<<2;
618 Cr2 = (*ycbcrBuffer++)<<2;
621 ycbcrPixel.
cb = (uint16_t)((Cb1+Cb2)/2);
622 ycbcrPixel.
cr = (uint16_t)((Cr1+Cr2)/2);
645 uint16_t Cb1,Y1,Cr1,Cb2,Y2,Cr2;
649 Cb1 = *ycbcrBuffer++;
651 Cr1 = *ycbcrBuffer++;
652 for ( uint32_t count = 0; count < numPixels; count+=2 )
654 ycbcrPixel.
cb = (uint16_t)Cb1;
655 ycbcrPixel.
y = (uint16_t)Y1;
656 ycbcrPixel.
cr = (uint16_t)Cr1;
665 ycbcrPixel.
y = *ycbcrBuffer++;
669 if ( (count + 2 ) >= numPixels )
677 Cb2 = *ycbcrBuffer++;
679 Cr2 = *ycbcrBuffer++;
682 ycbcrPixel.
cb = (uint16_t)((Cb1+Cb2)/2);
683 ycbcrPixel.
cr = (uint16_t)((Cr1+Cr2)/2);
703 uint16_t Cb1,Y1,Cr1,Cb2,Y2,Cr2;
707 Cb1 = *ycbcrBuffer++;
709 Cr1 = *ycbcrBuffer++;
710 for ( uint32_t count = 0; count < numPixels; count+=2 )
712 ycbcrPixel.
cb = (uint16_t)Cb1;
713 ycbcrPixel.
y = (uint16_t)Y1;
714 ycbcrPixel.
cr = (uint16_t)Cr1;
719 rgbaBuffer[count].
Red = (rgbaBuffer[count].
Red) << 6;
720 rgbaBuffer[count].
Green = (rgbaBuffer[count].
Green) << 6;
721 rgbaBuffer[count].
Blue = (rgbaBuffer[count].
Blue) << 6;
724 rgbaBuffer[count].
Red = (rgbaBuffer[count].
Red) << 6;
725 rgbaBuffer[count].
Green = (rgbaBuffer[count].
Green) << 6;
726 rgbaBuffer[count].
Blue = (rgbaBuffer[count].
Blue) << 6;
730 ycbcrPixel.
y = *ycbcrBuffer++;
734 if ( (count + 2 ) >= numPixels )
742 Cb2 = *ycbcrBuffer++;
744 Cr2 = *ycbcrBuffer++;
747 ycbcrPixel.
cb = (uint16_t)((Cb1+Cb2)/2);
748 ycbcrPixel.
cr = (uint16_t)((Cr1+Cr2)/2);
751 rgbaBuffer[count+1].
Red = (rgbaBuffer[count+1].
Red) << 6;
752 rgbaBuffer[count+1].
Green = (rgbaBuffer[count+1].
Green) << 6;
753 rgbaBuffer[count+1].
Blue = (rgbaBuffer[count+1].
Blue) << 6;
756 rgbaBuffer[count+1].
Red = (rgbaBuffer[count+1].
Red) << 6;
757 rgbaBuffer[count+1].
Green = (rgbaBuffer[count+1].
Green) << 6;
758 rgbaBuffer[count+1].
Blue = (rgbaBuffer[count+1].
Blue) << 6;
777 for ( uint32_t count = 0; count < numPixels; count++ )
783 if ((line & 0x1) == 0)
785 pixel0 = rgbaBuffer[count].
Red;
786 pixel1 = rgbaBuffer[count].
Green;
790 pixel0 = rgbaBuffer[count].
Green;
791 pixel1 = rgbaBuffer[count].
Blue;
795 if ((line & 0x1) == 0)
797 pixel0 = rgbaBuffer[count].
Green;
798 pixel1 = rgbaBuffer[count].
Red;
802 pixel0 = rgbaBuffer[count].
Blue;
803 pixel1 = rgbaBuffer[count].
Green;
807 if ((line & 0x1) == 0)
809 pixel0 = rgbaBuffer[count].
Blue;
810 pixel1 = rgbaBuffer[count].
Green;
814 pixel0 = rgbaBuffer[count].
Green;
815 pixel1 = rgbaBuffer[count].
Red;
819 if ((line & 0x1) == 0)
821 pixel0 = rgbaBuffer[count].
Green;
822 pixel1 = rgbaBuffer[count].
Blue;
826 pixel0 = rgbaBuffer[count].
Red;
827 pixel1 = rgbaBuffer[count].
Green;
832 uint32_t ind = count/3;
833 uint32_t rem = count%6;
838 bayerBuffer[ind] = ((pixel0 >> 6) & 0x3ff) << 2;
841 bayerBuffer[ind] |= ((pixel1 >> 6) & 0x3ff) << 12;
844 bayerBuffer[ind] |= ((pixel0 >> 6) & 0x3ff) << 22;
847 bayerBuffer[ind] = ((pixel1 >> 6) & 0x3ff) << 2;
850 bayerBuffer[ind] |= ((pixel0 >> 6) & 0x3ff) << 12;
853 bayerBuffer[ind] |= ((pixel1 >> 6) & 0x3ff) << 22;
868 uint16_t* buffer = (uint16_t*)bayerBuffer;
870 for ( uint32_t count = 0; count < numPixels; count++ )
876 if ((line & 0x1) == 0)
878 pixel0 = rgbaBuffer[count].
Red;
879 pixel1 = rgbaBuffer[count].
Green;
883 pixel0 = rgbaBuffer[count].
Green;
884 pixel1 = rgbaBuffer[count].
Blue;
888 if ((line & 0x1) == 0)
890 pixel0 = rgbaBuffer[count].
Green;
891 pixel1 = rgbaBuffer[count].
Red;
895 pixel0 = rgbaBuffer[count].
Blue;
896 pixel1 = rgbaBuffer[count].
Green;
900 if ((line & 0x1) == 0)
902 pixel0 = rgbaBuffer[count].
Blue;
903 pixel1 = rgbaBuffer[count].
Green;
907 pixel0 = rgbaBuffer[count].
Green;
908 pixel1 = rgbaBuffer[count].
Red;
912 if ((line & 0x1) == 0)
914 pixel0 = rgbaBuffer[count].
Green;
915 pixel1 = rgbaBuffer[count].
Blue;
919 pixel0 = rgbaBuffer[count].
Red;
920 pixel1 = rgbaBuffer[count].
Green;
925 if ((count & 0x1) == 0)
927 buffer[count] = pixel0;
931 buffer[count] = pixel1;
945 for ( uint32_t count = 0; count < numPixels; count++ )
951 if ((line & 0x1) == 0)
953 pixel0 = rgbaBuffer[count].
Red;
954 pixel1 = rgbaBuffer[count].
Green;
958 pixel0 = rgbaBuffer[count].
Green;
959 pixel1 = rgbaBuffer[count].
Blue;
963 if ((line & 0x1) == 0)
965 pixel0 = rgbaBuffer[count].
Green;
966 pixel1 = rgbaBuffer[count].
Red;
970 pixel0 = rgbaBuffer[count].
Blue;
971 pixel1 = rgbaBuffer[count].
Green;
975 if ((line & 0x1) == 0)
977 pixel0 = rgbaBuffer[count].
Blue;
978 pixel1 = rgbaBuffer[count].
Green;
982 pixel0 = rgbaBuffer[count].
Green;
983 pixel1 = rgbaBuffer[count].
Red;
987 if ((line & 0x1) == 0)
989 pixel0 = rgbaBuffer[count].
Green;
990 pixel1 = rgbaBuffer[count].
Blue;
994 pixel0 = rgbaBuffer[count].
Red;
995 pixel1 = rgbaBuffer[count].
Green;
1003 if ((count & 0x1) == 0)
1005 *bayerBuffer++ = (uint8_t)((pixel0 >> 6) & 0xff);
1006 *bayerBuffer = (uint8_t)((pixel0 >> 14) & 0x3);
1010 *bayerBuffer++ = (uint8_t)((pixel1 >> 6) & 0xff);
1011 *bayerBuffer = (uint8_t)((pixel1 >> 14) & 0x3);
1016 if ((count & 0x1) == 0)
1018 *bayerBuffer++ |= (uint8_t)(((pixel0 >> 6) & 0x3f) << 2);
1019 *bayerBuffer = (uint8_t)((pixel0 >> 12) & 0xf);
1023 *bayerBuffer++ |= (uint8_t)(((pixel1 >> 6) & 0x3f) << 2);
1024 *bayerBuffer = (uint8_t)((pixel1 >> 12) & 0xf);
1029 if ((count & 0x1) == 0)
1031 *bayerBuffer++ |= (uint8_t)(((pixel0 >> 6) & 0xf) << 4);
1032 *bayerBuffer = (uint8_t)((pixel0 >> 10) & 0x3f);
1036 *bayerBuffer++ |= (uint8_t)(((pixel1 >> 6) & 0xf) << 4);
1037 *bayerBuffer = (uint8_t)((pixel1 >> 10) & 0x3f);
1042 if ((count & 0x1) == 0)
1044 *bayerBuffer++ |= (uint8_t)(((pixel0 >> 6) & 0x3) << 6);
1045 *bayerBuffer++ = (uint8_t)((pixel0 >> 8) & 0xff);
1049 *bayerBuffer++ |= (uint8_t)(((pixel1 >> 6) & 0x3) << 6);
1050 *bayerBuffer++ = (uint8_t)((pixel1 >> 8) & 0xff);
1065 uint32_t pixel0 = 0;
1066 uint32_t pixel1 = 0;
1068 for ( uint32_t count = 0; count < numPixels; count++ )
1074 if ((line & 0x1) == 0)
1076 pixel0 = rgbaBuffer[count].
Red;
1077 pixel1 = rgbaBuffer[count].
Green;
1081 pixel0 = rgbaBuffer[count].
Green;
1082 pixel1 = rgbaBuffer[count].
Blue;
1086 if ((line & 0x1) == 0)
1088 pixel0 = rgbaBuffer[count].
Green;
1089 pixel1 = rgbaBuffer[count].
Red;
1093 pixel0 = rgbaBuffer[count].
Blue;
1094 pixel1 = rgbaBuffer[count].
Green;
1098 if ((line & 0x1) == 0)
1100 pixel0 = rgbaBuffer[count].
Blue;
1101 pixel1 = rgbaBuffer[count].
Green;
1105 pixel0 = rgbaBuffer[count].
Green;
1106 pixel1 = rgbaBuffer[count].
Red;
1110 if ((line & 0x1) == 0)
1112 pixel0 = rgbaBuffer[count].
Green;
1113 pixel1 = rgbaBuffer[count].
Blue;
1117 pixel0 = rgbaBuffer[count].
Red;
1118 pixel1 = rgbaBuffer[count].
Green;
1123 if ((count & 0x1) == 0)
1125 *bayerBuffer++ = (uint8_t)(((pixel0 >> 4) & 0xff));
1126 *bayerBuffer = (uint8_t)(((pixel0 >> 12) & 0xf));
1130 *bayerBuffer++ |= (uint8_t)(((pixel1 >> 4) & 0xf) << 4);
1131 *bayerBuffer++ = (uint8_t)(((pixel1 >> 8) & 0xff));
1153 for ( uint32_t pixel=0;pixel<numPixels*4;pixel+=4)
1155 uint8_t B = rgbaBuffer[pixel];
1156 uint8_t G = rgbaBuffer[pixel+1];
1157 uint8_t R = rgbaBuffer[pixel+2];
1158 uint8_t A = rgbaBuffer[pixel+3];
1159 rgbaBuffer[pixel] = A;
1160 rgbaBuffer[pixel+1] = R;
1161 rgbaBuffer[pixel+2] = G;
1162 rgbaBuffer[pixel+3] = B;
1169 for ( uint32_t pixel=0;pixel<numPixels*4;pixel+=4)
1171 uint8_t B = rgbaBuffer[pixel];
1172 uint8_t G = rgbaBuffer[pixel+1];
1173 uint8_t R = rgbaBuffer[pixel+2];
1174 uint8_t A = rgbaBuffer[pixel+3];
1175 rgbaBuffer[pixel] = R;
1176 rgbaBuffer[pixel+1] = G;
1177 rgbaBuffer[pixel+2] = B;
1178 rgbaBuffer[pixel+3] = A;
1185 for ( uint32_t pixel=0;pixel<numPixels*4;pixel+=4)
1187 uint8_t B = rgbaBuffer[pixel];
1188 uint8_t G = rgbaBuffer[pixel+1];
1189 uint8_t R = rgbaBuffer[pixel+2];
1199 for ( uint32_t pixel=0;pixel<numPixels*4;pixel+=4)
1201 uint8_t B = rgbaBuffer[pixel];
1202 uint8_t G = rgbaBuffer[pixel+1];
1203 uint8_t R = rgbaBuffer[pixel+2];
1212 for ( uint32_t pixel=0;pixel<numPixels;pixel++)
1215 uint16_t B = pixelBuffer->
Blue;
1216 uint16_t G = pixelBuffer->
Green;
1217 uint16_t R = pixelBuffer->
Red;
1218 *rgbLineBuffer++ = R;
1219 *rgbLineBuffer++ = G;
1220 *rgbLineBuffer++ = B;
1228 for ( uint32_t byteNumber = 0; byteNumber < numRowBytes; byteNumber += 9 )
1231 uint16_t Blue1 = pixelValue.
Blue>>4;
1232 uint16_t Green1 = pixelValue.
Green>>4;
1233 uint16_t Red1 = pixelValue.
Red>>4;
1235 pixelValue = *rgbaLineBuffer++;
1236 uint16_t Blue2 = pixelValue.
Blue>>4;
1237 uint16_t Green2 = pixelValue.
Green>>4;
1238 uint16_t Red2 = pixelValue.
Red>>4;
1239 *rgbLineBuffer++ = (uint8_t)(Red1&0xFF);
1240 *rgbLineBuffer++ = (uint8_t)(((Red1>>8)&0xF) + ((Green1&0xF)<<4));
1241 *rgbLineBuffer++ = (uint8_t)((Green1>>4));
1242 *rgbLineBuffer++ = (uint8_t)(Blue1&0xFF);
1243 *rgbLineBuffer++ = (uint8_t)(((Blue1>>8)&0xF) + ((Red2&0xF)<<4));
1244 *rgbLineBuffer++ = (uint8_t)((Red2>>4));
1245 *rgbLineBuffer++ = (uint8_t)(Green2&0xFF);
1246 *rgbLineBuffer++ = (uint8_t)(((Green2>>8)&0xF) + ((Blue2&0xF)<<4));
1247 *rgbLineBuffer++ = (uint8_t)((Blue2>>4));
1255 for ( uint32_t pixel=0;pixel<numPixels*2;pixel+=4)
1257 uint8_t Cb = ycbcrBuffer[pixel];
1258 uint8_t Y1 = ycbcrBuffer[pixel+1];
1259 uint8_t Cr = ycbcrBuffer[pixel+2];
1260 uint8_t Y2 = ycbcrBuffer[pixel+3];
1261 ycbcrBuffer[pixel] = Y1;
1262 ycbcrBuffer[pixel+1] = Cb;
1263 ycbcrBuffer[pixel+2] = Y2;
1264 ycbcrBuffer[pixel+3] = Cr;
1272 for ( uint16_t count = 0; count < numULWords; count++)
1274 uint32_t value = (packedycbcrLine[count])<<2;
1275 value = (value<<24) + ((value>>24)&0x000000FF) + ((value<<8)&0x00FF0000) + ((value>>8)&0x0000FF00);
1277 packedycbcrLine[count] = value;
1291 if(numPixels < 1280)
1397 uint16_t* unPackedBuffer =
new uint16_t[numPixels*2];
1400 delete [] unPackedBuffer;
1466 uint32_t pixelCount;
1469 switch ( signalMask )
1472 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1481 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1489 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1498 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1506 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1516 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1524 for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
1540 uint8_t* pOutputBuffer,uint32_t* pPackedLineBuffer )
1542 switch (pixelFormat)
1546 uint32_t bayerLinePitch = ((numPixels + 2)/3) * 4;
1547 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1553 uint32_t bayerLinePitch = (linePitch/3);
1554 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1561 uint32_t bayerLinePitch = ((numPixels + 2)/3) * 4;
1562 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1569 uint32_t bayerLinePitch = linePitch/3;
1570 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1577 uint8_t *pBuffer = pOutputBuffer + (currentLine * linePitch);
1578 memcpy(pBuffer, pPackedLineBuffer, linePitch);
1587 uint32_t numPixels, uint32_t linePitch, uint8_t* pOutputBuffer, uint32_t* pPackedLineBuffer )
1589 switch (pixelFormat)
1593 uint32_t bayerLinePitch = ((numPixels + 2)/3) * 4;
1594 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1600 uint32_t bayerLinePitch = (linePitch/3);
1601 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1608 uint32_t bayerLinePitch = ((numPixels + 2)/3) * 4;
1609 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1616 uint32_t bayerLinePitch = linePitch/4;
1617 uint8_t *pBuffer = pOutputBuffer + (currentLine * bayerLinePitch);
1624 uint8_t *pBuffer = pOutputBuffer + (currentLine * linePitch);
1625 memcpy(pBuffer, pPackedLineBuffer, linePitch);
1637 uint16_t startPixel,
1639 int32_t numInputPixels,
1640 int32_t numOutputPixels)
1643 int32_t count,inputIndex,reSampleStartPixel,reSampleEndPixel;
1645 int32_t increment,coefIndex;
1647 Input[-1] = Input[0];
1648 Input[numInputPixels] = Input[numInputPixels+1] = Input[numInputPixels-1];
1650 increment = (numInputPixels<<16)/numOutputPixels;
1651 reSampleStartPixel = (startPixel*numOutputPixels)/numInputPixels;
1652 reSampleEndPixel = (endPixel*numOutputPixels)/numInputPixels;
1653 for ( count = reSampleStartPixel; count < reSampleEndPixel; count++ )
1655 accum = (increment*count);
1657 coefIndex = (accum>>11) & 0x1F;
1669 uint16_t startPixel,
1671 int32_t numInputPixels,
1672 int32_t numOutputPixels)
1675 int32_t count,inputIndex,reSampleStartPixel,reSampleEndPixel;
1677 int32_t increment,coefIndex;
1679 Input[-1] = Input[0];
1680 Input[numInputPixels] = Input[numInputPixels+1] = Input[numInputPixels-1];
1682 increment = (numInputPixels<<16)/numOutputPixels;
1683 reSampleStartPixel = (startPixel*numOutputPixels)/numInputPixels;
1684 reSampleEndPixel = (endPixel*numOutputPixels)/numInputPixels;
1685 for ( count = reSampleStartPixel; count < reSampleEndPixel; count++ )
1687 accum = (increment*count);
1689 coefIndex = (accum>>11) & 0x1F;
1698 int32_t numInputPixels,
1699 int32_t numOutputPixels)
1702 int32_t count,inputIndex,reSampleStartPixel,reSampleEndPixel;
1704 int32_t increment,coefIndex;
1706 int16_t* yBuffer =
new int16_t[numInputPixels+4];
1707 int16_t* cbBuffer =
new int16_t[numInputPixels/2+4];
1708 int16_t* crBuffer =
new int16_t[numInputPixels/2+4];
1711 for ( count = 0; count < numInputPixels; count++ )
1715 crBuffer[count/2+1] = Input[count*2];
1719 cbBuffer[count/2+1] = Input[count*2];
1722 yBuffer[count+1] = Input[count*2+1];
1725 yBuffer[0] = yBuffer[1];
1726 yBuffer[numInputPixels+1] = yBuffer[numInputPixels+2] = yBuffer[numInputPixels];
1728 increment = (numInputPixels<<16)/numOutputPixels;
1729 reSampleStartPixel = 0;
1730 reSampleEndPixel = numOutputPixels;
1731 for ( count = reSampleStartPixel; count < reSampleEndPixel; count++ )
1733 accum = (increment*count);
1735 coefIndex = (accum>>11) & 0x1F;
1736 Output[count*2+1] = (int16_t)
CubicInterPolateWord((int16_t *)&yBuffer[inputIndex+1],coefIndex);
1739 reSampleStartPixel = 0;
1740 reSampleEndPixel = numOutputPixels/2;
1741 cbBuffer[0] = cbBuffer[1];
1742 cbBuffer[numInputPixels/2+1] = cbBuffer[numInputPixels/2+2] = cbBuffer[numInputPixels/2];
1743 crBuffer[0] = crBuffer[1];
1744 crBuffer[numInputPixels/2+1] = crBuffer[numInputPixels/2+2] = crBuffer[numInputPixels/2];
1746 for ( count = reSampleStartPixel; count < reSampleEndPixel; count++ )
1748 accum = (increment*count);
1750 coefIndex = (accum>>11) & 0x1F;
1752 Output[count*4+2] = (int16_t)
CubicInterPolateWord((int16_t *)&crBuffer[inputIndex+1],coefIndex);
1762 uint16_t startPixel,
1764 int32_t numInputPixels,
1765 int32_t numOutputPixels,
1766 int16_t channelInterleaveMulitplier)
1768 int32_t count,inputIndex,reSampleStartPixel,reSampleEndPixel;
1770 int32_t increment,coefIndex;
1772 increment = (numInputPixels<<16)/numOutputPixels;
1773 reSampleStartPixel = (startPixel*numOutputPixels)/numInputPixels;
1774 reSampleEndPixel = (endPixel*numOutputPixels)/numInputPixels;
1775 for ( count = reSampleStartPixel; count < reSampleEndPixel; count++ )
1777 accum = (increment*count);
1779 coefIndex = (accum>>11) & 0x1F;
1780 Output[count*channelInterleaveMulitplier] = (int16_t)
CubicInterPolateAudioWord((int16_t *)&Input[inputIndex],coefIndex);
1796 InterPolatedValue.
Red = (uint8_t)((temp < 0 ) ? 0 : (temp > 255 ) ? 255 : temp);
1802 InterPolatedValue.
Green = (uint8_t)((temp < 0 ) ? 0 : (temp > 255 ) ? 255 : temp);
1810 InterPolatedValue.
Blue = (uint8_t)((temp < 0 ) ? 0 : (temp > 255 ) ? 255 : temp);
1817 InterPolatedValue.
Alpha = (uint8_t)((temp < 0 ) ? 0 : (temp > 255 ) ? 255 : temp);
1819 return InterPolatedValue;
1825 int16_t InterPolatedValue;
1838 int32_t InterPolatedValue;
1845 if ( InterPolatedValue > 32767 )
1846 InterPolatedValue = 32767;
1847 if ( InterPolatedValue < -32767 )
1848 InterPolatedValue = -32767;
1850 return (int16_t)(InterPolatedValue&0xFFFF);