AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
ntv2transcode.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2transcode.h"
9 #include "ntv2endian.h"
10 
11 using namespace std;
12 
13 
14 bool ConvertLine_2vuy_to_v210 (const UByte * pSrc2vuyLine, ULWord * pDstv210Line, const ULWord inNumPixels)
15 {
16  if (!pSrc2vuyLine || !pDstv210Line || !inNumPixels)
17  return false;
18 
19  for (UWord inputCount = 0, outputCount = 0; inputCount < (inNumPixels * 2); outputCount += 4, inputCount += 12)
20  {
21  pDstv210Line[outputCount+0] = NTV2EndianSwap32HtoL((ULWord(pSrc2vuyLine[inputCount+0]) << 2) + (ULWord(pSrc2vuyLine[inputCount+ 1]) << 12) + (ULWord(pSrc2vuyLine[inputCount+ 2]) << 22));
22  pDstv210Line[outputCount+1] = NTV2EndianSwap32HtoL((ULWord(pSrc2vuyLine[inputCount+3]) << 2) + (ULWord(pSrc2vuyLine[inputCount+ 4]) << 12) + (ULWord(pSrc2vuyLine[inputCount+ 5]) << 22));
23  pDstv210Line[outputCount+2] = NTV2EndianSwap32HtoL((ULWord(pSrc2vuyLine[inputCount+6]) << 2) + (ULWord(pSrc2vuyLine[inputCount+ 7]) << 12) + (ULWord(pSrc2vuyLine[inputCount+ 8]) << 22));
24  pDstv210Line[outputCount+3] = NTV2EndianSwap32HtoL((ULWord(pSrc2vuyLine[inputCount+9]) << 2) + (ULWord(pSrc2vuyLine[inputCount+10]) << 12) + (ULWord(pSrc2vuyLine[inputCount+11]) << 22));
25  }
26 
27  return true;
28 
29 } // ConvertLine_2vuy_to_v210
30 
31 
32 bool ConvertLine_2vuy_to_yuy2 (const UByte * pInSrcLine_2vuy, UWord * pOutDstLine_yuy2, const ULWord inNumPixels)
33 {
34  if (!pInSrcLine_2vuy || !pOutDstLine_yuy2 || !inNumPixels)
35  return false;
36 
37  const UWord* pSrc = reinterpret_cast<const UWord*>(pInSrcLine_2vuy);
38  UWord* pDst = pOutDstLine_yuy2;
39 
40  for (UWord pixIndex(0); pixIndex < inNumPixels; pixIndex++)
41  {
42  *pDst = NTV2EndianSwap16(*pSrc);
43  pDst++; pSrc++;
44  }
45  return true;
46 }
47 
48 
49 bool ConvertLine_v210_to_2vuy (const ULWord * pSrcv210Line, UByte * pDst2vuyLine, const ULWord inNumPixels)
50 {
51  if (!pSrcv210Line || !pDst2vuyLine || !inNumPixels)
52  return false;
53 
54  for (ULWord sampleCount = 0, dataCount = 0; sampleCount < (inNumPixels * 2); sampleCount += 3, dataCount++)
55  {
56  const UByte * pByte (reinterpret_cast<const UByte*>(&pSrcv210Line[dataCount]));
57 
58  // Endian-agnostic bit shifting...
59  pDst2vuyLine[sampleCount ] = ((pByte[1] & 0x03) << 6) + (pByte[0] >> 2); // High-order 8 bits
60  pDst2vuyLine[sampleCount + 1] = ((pByte[2] & 0x0F) << 4) + (pByte[1] >> 4);
61  pDst2vuyLine[sampleCount + 2] = ((pByte[3] & 0x3F) << 2) + (pByte[2] >> 6);
62  }
63 
64  return true;
65 
66 } // ConvertLine_v210_to_2vuy
67 
68 
69 bool ConvertLine_v210_to_2vuy (const void * pInSrcLine_v210, std::vector<uint8_t> & outDstLine2vuy, const ULWord inNumPixels)
70 {
71  const ULWord * pInSrcLine (reinterpret_cast<const ULWord*>(pInSrcLine_v210));
72  outDstLine2vuy.clear();
73  if (!pInSrcLine || !inNumPixels)
74  return false;
75 
76  outDstLine2vuy.reserve(inNumPixels * 2);
77  for (ULWord sampleCount = 0, dataCount = 0; sampleCount < (inNumPixels * 2); sampleCount += 3, dataCount++)
78  {
79  const UByte * pByte (reinterpret_cast<const UByte*>(&pInSrcLine[dataCount]));
80 
81  // Endian-agnostic bit shifting...
82  outDstLine2vuy.push_back(UByte((pByte[1] & 0x03) << 6) | (pByte[0] >> 2)); // High-order 8 bits
83  outDstLine2vuy.push_back(UByte((pByte[2] & 0x0F) << 4) | (pByte[1] >> 4));
84  outDstLine2vuy.push_back(UByte((pByte[3] & 0x3F) << 2) | (pByte[2] >> 6));
85  }
86  return true;
87 }
88 
89 
90 bool ConvertLine_8bitABGR_to_10bitABGR (const UByte * pInSrcLine_8bitABGR, ULWord * pOutDstLine_10BitABGR, const ULWord inNumPixels)
91 {
92  if (!pInSrcLine_8bitABGR || !pOutDstLine_10BitABGR || !inNumPixels)
93  return false;
94 
95  const ULWord* pSrc = reinterpret_cast<const ULWord*>(pInSrcLine_8bitABGR);
96  ULWord* pDst = reinterpret_cast< ULWord*>(pOutDstLine_10BitABGR);
97 
98  for (ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
99  {
100  *pDst = ((*pSrc & 0x000000FF) << 2) | // Red (move to MS 8 bits of Red component)
101  ((*pSrc & 0x0000FF00) << 4) | // Green (move to MS 8 bits of Green component)
102  ((*pSrc & 0x00FF0000) << 6) | // Blue (move to MS 8 bits of Blue component)
103  ((*pSrc & 0xC0000000) ); // Alpha (drop LS 6 bits)
104  pDst++; pSrc++;
105  }
106  return true;
107 }
108 
109 
110 bool ConvertLine_8bitABGR_to_10bitRGBDPX (const UByte * pInSrcLine_8bitABGR, ULWord * pOutDstLine_10BitDPX, const ULWord inNumPixels)
111 {
112  if (!pInSrcLine_8bitABGR || !pOutDstLine_10BitDPX || !inNumPixels)
113  return false;
114 
115  const ULWord* pSrc = reinterpret_cast<const ULWord*>(pInSrcLine_8bitABGR);
116  ULWord* pDst = reinterpret_cast< ULWord*>(pOutDstLine_10BitDPX);
117 
118  for (ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
119  {
120  *pDst = ((*pSrc & 0x000000FF) ) + // Red
121  ((*pSrc & 0x0000FC00) >> 2) + ((*pSrc & 0x00000300) << 14) + // Green
122  ((*pSrc & 0x00F00000) >> 4) + ((*pSrc & 0x000F0000) << 12); // Blue
123  pDst++; pSrc++; // Next line
124  }
125  return true;
126 }
127 
128 
129 bool ConvertLine_8bitABGR_to_10bitRGBDPXLE (const UByte * pInSrcLine_8bitABGR, ULWord * pOutDstLine_10BitDPXLE, const ULWord inNumPixels)
130 {
131  if (!pInSrcLine_8bitABGR || !pOutDstLine_10BitDPXLE || !inNumPixels)
132  return false;
133 
134  const ULWord* pSrc = reinterpret_cast<const ULWord*>(pInSrcLine_8bitABGR);
135  ULWord* pDst = reinterpret_cast< ULWord*>(pOutDstLine_10BitDPXLE);
136 
137  for (ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
138  {
139  *pDst = ((*pSrc & 0x000000FF) << 24) | // Red
140  ((*pSrc & 0x0000FF00) << 6) | // Green
141  ((*pSrc & 0x00FF0000) >> 12); // Blue
142  pDst++; pSrc++; // Next line
143  }
144  return true;
145 }
146 
147 
148 bool ConvertLine_8bitABGR_to_24bitRGB (const UByte * pInSrcLine_8bitABGR, UByte * pOutDstLine_24BitRGB, const ULWord inNumPixels)
149 {
150  if (!pInSrcLine_8bitABGR || !pOutDstLine_24BitRGB || !inNumPixels)
151  return false;
152 
153  const UByte* pSrc = reinterpret_cast<const UByte*>(pInSrcLine_8bitABGR);
154  UByte* pDst = reinterpret_cast<UByte*>(pOutDstLine_24BitRGB);
155 
156  for (ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
157  {
158  *pDst++ = *pSrc++; // Red
159  *pDst++ = *pSrc++; // Green
160  *pDst++ = *pSrc++; // Blue
161  pSrc++; // Skip over src Alpha
162  }
163  return true;
164 }
165 
166 
167 bool ConvertLine_8bitABGR_to_24bitBGR (const UByte * pInSrcLine_8bitABGR, UByte * pOutDstLine_24BitBGR, const ULWord inNumPixels)
168 {
169  if (!pInSrcLine_8bitABGR || !pOutDstLine_24BitBGR || !inNumPixels)
170  return false;
171 
172  const UByte* pSrc = reinterpret_cast<const UByte*>(pInSrcLine_8bitABGR);
173  UByte* pDst = reinterpret_cast<UByte*>(pOutDstLine_24BitBGR);
174 
175  for (ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
176  {
177  UByte r(*pSrc++), g(*pSrc++), b(*pSrc++);
178  *pDst++ = b; // Blue
179  *pDst++ = g; // Green
180  *pDst++ = r; // Red
181  pSrc++; // Skip over src Alpha
182  }
183  return true;
184 }
185 
186 
187 bool ConvertLine_8bitABGR_to_48bitRGB (const UByte * pInSrcLine_8bitABGR, ULWord * pOutDstLine_48BitRGB, const ULWord inNumPixels)
188 {
189  if (!pInSrcLine_8bitABGR || !pOutDstLine_48BitRGB || !inNumPixels)
190  return false;
191 
192  const UByte* pSrc = reinterpret_cast<const UByte*>(pInSrcLine_8bitABGR);
193  UByte* pDst = reinterpret_cast<UByte*>(pOutDstLine_48BitRGB);
194 
195  for (ULWord pixCount = 0; pixCount < inNumPixels; pixCount++)
196  {
197  UByte r(*pSrc++), g(*pSrc++), b(*pSrc++); // UByte a(*pSrc++);
198  ++pDst; *pDst++ = r;
199  ++pDst; *pDst++ = g;
200  ++pDst; *pDst++ = b;
201  pSrc++;
202  }
203  return true;
204 }
205 
206 
207 // ConvertLineToYCbCr422
208 // 8 Bit
210  UByte* YCbCrLine,
211  LWord numPixels ,
212  LWord startPixel,
213  bool fUseSDMatrix)
214 {
215  YCbCrPixel YCbCr;
216  UByte *pYCbCr = &YCbCrLine[(startPixel&~1)*2]; // startPixel needs to be even
217 
218  for ( LWord pixel = 0; pixel < numPixels; pixel++ )
219  {
220  if(fUseSDMatrix) {
221  SDConvertRGBAlphatoYCbCr(&RGBLine[pixel],&YCbCr);
222  } else {
223  HDConvertRGBAlphatoYCbCr(&RGBLine[pixel],&YCbCr);
224  }
225  if ( pixel & 0x1 )
226  {
227  // Just Y
228  *pYCbCr++ = YCbCr.y;
229  }
230  else
231  {
232  *pYCbCr++ = YCbCr.cb;
233  *pYCbCr++ = YCbCr.y;
234  *pYCbCr++ = YCbCr.cr;
235 
236  }
237 
238  }
239 
240 }
241 // ConvertLineToYCbCr422
242 // 10 Bit
244  UWord* YCbCrLine,
245  LWord numPixels ,
246  LWord startPixel,
247  bool fUseSDMatrix)
248 {
249  YCbCr10BitPixel YCbCr;
250  UWord *pYCbCr = &YCbCrLine[(startPixel&~1)*2]; // startPixel needs to be even
251 
252  for ( LWord pixel = 0; pixel < numPixels; pixel++ )
253  {
254  if(fUseSDMatrix) {
255  SDConvertRGBAlphatoYCbCr(&RGBLine[pixel],&YCbCr);
256  } else {
257  HDConvertRGBAlphatoYCbCr(&RGBLine[pixel],&YCbCr);
258  }
259  if ( pixel & 0x1 )
260  {
261  // Just Y
262  *pYCbCr++ = YCbCr.y;
263  }
264  else
265  {
266  *pYCbCr++ = YCbCr.cb;
267  *pYCbCr++ = YCbCr.y;
268  *pYCbCr++ = YCbCr.cr;
269 
270  }
271 
272  }
273 
274 }
275 
276 
277 
278 // ConvertLinetoRGB
279 // 8 Bit Version
280 void ConvertLinetoRGB(UByte * ycbcrBuffer,
281  RGBAlphaPixel * rgbaBuffer ,
282  ULWord numPixels,
283  bool fUseSDMatrix,
284  bool fUseSMPTERange)
285 {
286  YCbCrAlphaPixel ycbcrPixel;
287  ycbcrPixel.Alpha = 0;
288  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
289 
290  // take a line(CbYCrYCbYCrY....) to RGBAlphaPixels.
291  // 2 RGBAlphaPixels at a time.
292  Cb1 = *ycbcrBuffer++;
293  Y1 = *ycbcrBuffer++;
294  Cr1 = *ycbcrBuffer++;
295  for ( ULWord count = 0; count < numPixels; count+=2 )
296  {
297  ycbcrPixel.cb = (UByte)Cb1;
298  ycbcrPixel.y = (UByte)Y1;
299  ycbcrPixel.cr = (UByte)Cr1;
300 
301  if(fUseSDMatrix) {
302  if (fUseSMPTERange) {
303  SDConvertYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
304  } else {
305  SDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count]);
306  }
307  } else {
308  if (fUseSMPTERange) {
309  HDConvertYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
310  } else {
311  HDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count]);
312  }
313  }
314  // Read lone midde Y;
315  ycbcrPixel.y = *ycbcrBuffer++;
316 
317  // Read Next full bandwidth sample
318  Cb2 = *ycbcrBuffer++;
319  Y2 = *ycbcrBuffer++;
320  Cr2 = *ycbcrBuffer++;
321 
322  // Interpolate and write Inpterpolated RGBAlphaPixel
323  ycbcrPixel.cb = (UByte)((Cb1+Cb2)/2);
324  ycbcrPixel.cr = (UByte)((Cr1+Cr2)/2);
325  if(fUseSDMatrix) {
326  if (fUseSMPTERange) {
327  SDConvertYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
328  } else {
329  SDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
330  }
331  } else {
332  if (fUseSMPTERange) {
333  HDConvertYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
334  } else {
335  HDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
336  }
337  }
338  // Setup for next loop
339  Cb1 = Cb2;
340  Cr1 = Cr2;
341  Y1 = Y2;
342  }
343 }
344 
345 
346 // ConvertLinetoRGB
347 // 10 Bit YCbCr 8 Bit RGB version
348 void ConvertLinetoRGB(UWord * ycbcrBuffer,
349  RGBAlphaPixel * rgbaBuffer,
350  ULWord numPixels,
351  bool fUseSDMatrix,
352  bool fUseSMPTERange,
353  bool fAlphaFromLuma)
354 {
355  YCbCr10BitAlphaPixel ycbcrPixel = {0,0,0,0};
356  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
357 
358  // take a line(CbYCrYCbYCrY....) to RGBAlphaPixels.
359  // 2 RGBAlphaPixels at a time.
360  Cb1 = *ycbcrBuffer++;
361  Y1 = *ycbcrBuffer++;
362  Cr1 = *ycbcrBuffer++;
363  for ( ULWord count = 0; count < numPixels; count+=2 )
364  {
365  ycbcrPixel.cb = (UWord)Cb1;
366  ycbcrPixel.y = (UWord)Y1;
367  ycbcrPixel.cr = (UWord)Cr1;
368  if( fAlphaFromLuma )
369  ycbcrPixel.Alpha = (UWord)Y1/4;
370 
371  if(fUseSDMatrix) {
372  if (fUseSMPTERange) {
373  SDConvert10BitYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
374  } else {
375  SDConvert10BitYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count]);
376  }
377  } else {
378  if (fUseSMPTERange) {
379  HDConvert10BitYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
380  } else {
381  HDConvert10BitYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count]);
382  }
383  }
384  // Read lone midde Y;
385  ycbcrPixel.y = *ycbcrBuffer++;
386 
387  // Read Next full bandwidth sample
388  // unless we are at the end of a line
389  if ( (count + 2 ) >= numPixels )
390  {
391  Cb2 = (UWord)Cb1;
392  Y2 = (UWord)Y1;
393  Cr2 = (UWord)Cr1;
394  }
395  else
396  {
397  Cb2 = *ycbcrBuffer++;
398  Y2 = *ycbcrBuffer++;
399  Cr2 = *ycbcrBuffer++;
400  }
401  // Interpolate and write Inpterpolated RGBAlphaPixel
402  ycbcrPixel.cb = (UWord)((Cb1+Cb2)/2);
403  ycbcrPixel.cr = (UWord)((Cr1+Cr2)/2);
404  if(fUseSDMatrix) {
405  if (fUseSMPTERange) {
406  SDConvert10BitYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
407  } else {
408  SDConvert10BitYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
409  }
410  } else {
411  if (fUseSMPTERange) {
412  HDConvert10BitYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
413  } else {
414  HDConvert10BitYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
415  }
416  }
417 
418  // Setup for next loop
419  Cb1 = Cb2;
420  Cr1 = Cr2;
421  Y1 = Y2;
422 
423  }
424 }
425 
426 // ConvertRGBALineToRGB
427 // 8 bit RGBA to 8 bit RGB (RGB24)
428 AJAExport
430  ULWord numPixels)
431 {
432  RGBPixel* rgbLineBuffer = (RGBPixel*) rgbaBuffer;
433 
434  for ( ULWord pixel=0; pixel<numPixels; pixel++ )
435  {
436  UByte R = rgbaBuffer->Red;
437  UByte G = rgbaBuffer->Green;
438  UByte B = rgbaBuffer->Blue;
439 
440  rgbLineBuffer->Red = R;
441  rgbLineBuffer->Green = G;
442  rgbLineBuffer->Blue = B;
443 
444  rgbaBuffer++;
445  rgbLineBuffer++;
446  }
447 }
448 
449 // ConvertRGBALineToBGR
450 // 8 bit RGBA to 8 bit BGR (BGR24)
451 // Conversion is done into the same buffer
452 AJAExport
454  ULWord numPixels)
455 {
456  BGRPixel* bgrLineBuffer = (BGRPixel*) rgbaBuffer;
457 
458  for ( ULWord pixel=0; pixel<numPixels; pixel++ )
459  {
460  UByte B = rgbaBuffer->Blue;
461  UByte G = rgbaBuffer->Green;
462  UByte R = rgbaBuffer->Red;
463 
464  bgrLineBuffer->Blue = B;
465  bgrLineBuffer->Green = G;
466  bgrLineBuffer->Red = R;
467 
468  rgbaBuffer++;
469  bgrLineBuffer++;
470  }
471 }
472 
473 // ConvertLineto10BitRGB
474 // 10 Bit YCbCr and 10 Bit RGB Version
475 void ConvertLineto10BitRGB(UWord * ycbcrBuffer,
476  RGBAlpha10BitPixel * rgbaBuffer,
477  ULWord numPixels,
478  bool fUseSDMatrix,
479  bool fUseSMPTERange)
480 {
481  YCbCr10BitAlphaPixel ycbcrPixel = {0,0,0,0};
482  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
483 
484  // take a line(CbYCrYCbYCrY....) to RGBAlphaPixels.
485  // 2 RGBAlphaPixels at a time.
486  Cb1 = *ycbcrBuffer++;
487  Y1 = *ycbcrBuffer++;
488  Cr1 = *ycbcrBuffer++;
489  for ( ULWord count = 0; count < numPixels; count+=2 )
490  {
491  ycbcrPixel.cb = (UWord)Cb1;
492  ycbcrPixel.y = (UWord)Y1;
493  ycbcrPixel.cr = (UWord)Cr1;
494 
495  if(fUseSDMatrix) {
496  if (fUseSMPTERange) {
497  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
498  } else {
499  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count]);
500  }
501  } else {
502  if (fUseSMPTERange) {
503  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
504  } else {
505  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count]);
506  }
507  }
508  // Read lone midde Y;
509  ycbcrPixel.y = *ycbcrBuffer++;
510 
511  // Read Next full bandwidth sample
512  // unless we are at the end of a line
513  if ( (count + 2 ) >= numPixels )
514  {
515  Cb2 = (UWord)Cb1;
516  Y2 = (UWord)Y1;
517  Cr2 = (UWord)Cr1;
518  }
519  else
520  {
521  Cb2 = *ycbcrBuffer++;
522  Y2 = *ycbcrBuffer++;
523  Cr2 = *ycbcrBuffer++;
524  }
525  // Interpolate and write Inpterpolated RGBAlphaPixel
526  ycbcrPixel.cb = (UWord)((Cb1+Cb2)/2);
527  ycbcrPixel.cr = (UWord)((Cr1+Cr2)/2);
528  if(fUseSDMatrix) {
529  if (fUseSMPTERange) {
530  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
531  } else {
532  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
533  }
534  } else {
535  if (fUseSMPTERange) {
536  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
537  } else {
538  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
539  }
540  }
541 
542  // Setup for next loop
543  Cb1 = Cb2;
544  Cr1 = Cr2;
545  Y1 = Y2;
546  }
547 }
548 
549 // ConvertLineto10BitYCbCrA
550 // 10 Bit YCbCr to 10 Bit YCbCrA
551 void ConvertLineto10BitYCbCrA (const UWord * pInYCbCrBuffer,
552  ULWord * pOutYCbCrABuffer,
553  const ULWord inNumPixels)
554 {
555  for (ULWord count(0); count < inNumPixels; count++)
556  {
557  ULWord value = CCIR601_10BIT_WHITE<<20; // Set Alpha to '1';
558  value |= (ULWord(*pInYCbCrBuffer++)<<10); // Cb or Cr
559  value |= *pInYCbCrBuffer++; // Y
560  pOutYCbCrABuffer[count] = value;
561  }
562 }
563 
564 // ConvertLineto10BitRGB
565 // 8 Bit RGBA to and 10 Bit RGB Packed Version
566 void ConvertLineto10BitRGB (const RGBAlphaPixel * pInRGBA8Buffer,
567  ULWord * pOutRGB10Buffer,
568  const ULWord inNumPixels)
569 
570 {
571  for (ULWord count(0); count < inNumPixels; count++)
572  {
573  *pOutRGB10Buffer = (ULWord(pInRGBA8Buffer->Blue)<<22) +
574  (ULWord(pInRGBA8Buffer->Green)<<12) +
575  (ULWord(pInRGBA8Buffer->Red)<<2);
576  pOutRGB10Buffer++;
577  pInRGBA8Buffer++;
578  }
579 }
580 
581 // ConvertRGBLineto10BitRGB
582 // 8 Bit RGB and 10 Bit RGB Version
583 void ConvertRGBLineto10BitRGB (const RGBAlphaPixel * pInRGBA8Buffer,
584  RGBAlpha10BitPixel * pOutRGBA10Buffer,
585  const ULWord inNumPixels)
586 {
587  for (ULWord i(0); i < inNumPixels; i++)
588  {
589  pOutRGBA10Buffer[i].Blue = (pInRGBA8Buffer[i].Blue<<2);
590  pOutRGBA10Buffer[i].Green = (pInRGBA8Buffer[i].Green<<2);
591  pOutRGBA10Buffer[i].Red = (pInRGBA8Buffer[i].Red<<2);
592  pOutRGBA10Buffer[i].Alpha = (pInRGBA8Buffer[i].Alpha<<2);
593  }
594 
595 }
596 
597 
598 
599 // ConvertLineto8BitYCbCr
600 // 10 Bit YCbCr to 8 Bit YCbCr
601 void ConvertLineto8BitYCbCr(UWord * ycbcr10BitBuffer,
602  UByte * ycbcr8BitBuffer,
603  ULWord numPixels)
604 {
605  for ( ULWord pixel=0;pixel<numPixels*2;pixel++)
606  {
607  ycbcr8BitBuffer[pixel] = ycbcr10BitBuffer[pixel]>>2;
608  }
609 
610 }
611 
612 // Converts UYVY(2yuv) -> YUY2(yuv2) in place
613 void Convert8BitYCbCrToYUY2(UByte * ycbcrBuffer,
614  ULWord numPixels)
615 {
616  for ( ULWord pixel=0;pixel<numPixels*2;pixel+=4)
617  {
618  UByte Cb = ycbcrBuffer[pixel];
619  UByte Y1 = ycbcrBuffer[pixel+1];
620  UByte Cr = ycbcrBuffer[pixel+2];
621  UByte Y2 = ycbcrBuffer[pixel+3];
622  ycbcrBuffer[pixel] = Y1;
623  ycbcrBuffer[pixel+1] = Cb;
624  ycbcrBuffer[pixel+2] = Y2;
625  ycbcrBuffer[pixel+3] = Cr;
626  }
627 }
628 
629 // Converts 8 Bit ARGB 8 Bit RGBA in place
630 void ConvertARGBYCbCrToRGBA(UByte* rgbaBuffer,ULWord numPixels)
631 {
632  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
633  {
634  UByte B = rgbaBuffer[pixel];
635  UByte G = rgbaBuffer[pixel+1];
636  UByte R = rgbaBuffer[pixel+2];
637  UByte A = rgbaBuffer[pixel+3];
638  rgbaBuffer[pixel] = A;
639  rgbaBuffer[pixel+1] = R;
640  rgbaBuffer[pixel+2] = G;
641  rgbaBuffer[pixel+3] = B;
642  }
643 }
644 
645 // Converts 8 Bit ARGB 8 Bit ABGR in place
646 void ConvertARGBYCbCrToABGR(UByte* rgbaBuffer,ULWord numPixels)
647 {
648  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
649  {
650  UByte B = rgbaBuffer[pixel];
651  UByte G = rgbaBuffer[pixel+1];
652  UByte R = rgbaBuffer[pixel+2];
653  UByte A = rgbaBuffer[pixel+3];
654  rgbaBuffer[pixel] = R;
655  rgbaBuffer[pixel+1] = G;
656  rgbaBuffer[pixel+2] = B;
657  rgbaBuffer[pixel+3] = A;
658  }
659 }
660 
661 // Convert 8 Bit ARGB to 8 bit RGB
662 void ConvertARGBToRGB(UByte *rgbaLineBuffer ,UByte * rgbLineBuffer,ULWord numPixels)
663 {
664  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
665  {
666  UByte B = rgbaLineBuffer[pixel];
667  UByte G = rgbaLineBuffer[pixel+1];
668  UByte R = rgbaLineBuffer[pixel+2];
669  *rgbLineBuffer++ = R;
670  *rgbLineBuffer++ = G;
671  *rgbLineBuffer++ = B;
672 
673  }
674 }
675 //KAM
676 // Convert 16 Bit ARGB to 16 bit RGB
677 void Convert16BitARGBTo16BitRGBEx(UWord *rgbaLineBuffer ,UWord * rgbLineBuffer,ULWord numPixels)
678 {
679  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
680  {
681  // TODO: is this ordering correct? seems wrong...
682  RGBAlpha16BitPixel* pixelBuffer = (RGBAlpha16BitPixel*)&(rgbaLineBuffer[pixel]);
683  UWord B = pixelBuffer->Blue;
684  UWord G = pixelBuffer->Green;
685  UWord R = pixelBuffer->Red;
686  *rgbLineBuffer++ = R;
687  *rgbLineBuffer++ = G;
688  *rgbLineBuffer++ = B;
689  }
690 }
691 // KAM
692 void Convert16BitARGBTo16BitRGB(RGBAlpha16BitPixel *rgbaLineBuffer ,UWord * rgbLineBuffer,ULWord numPixels)
693 {
694  for ( ULWord pixel=0;pixel<numPixels;pixel++)
695  {
696  UWord B = rgbaLineBuffer[pixel].Blue;
697  UWord G = rgbaLineBuffer[pixel].Green;
698  UWord R = rgbaLineBuffer[pixel].Red;
699  *rgbLineBuffer++ = R;
700  *rgbLineBuffer++ = G;
701  *rgbLineBuffer++ = B;
702  }
703 }
704 
705 void Convert16BitARGBTo12BitRGBPacked(RGBAlpha16BitPixel *rgbaLineBuffer ,UByte * rgbLineBuffer,ULWord numPixels)
706 {
707  for ( ULWord pixel=0;pixel<numPixels;pixel+=8)
708  {
709  for(ULWord i = 0;i<8;i+=2)
710  {
711  UWord R = rgbaLineBuffer[pixel+i].Red;
712  UWord G = rgbaLineBuffer[pixel+i].Green;
713  UWord B = rgbaLineBuffer[pixel+i].Blue;
714  *rgbLineBuffer++ = (R & 0xFF00)>>8;
715  *rgbLineBuffer++ = (((R & 0x00F0)) | ((G & 0xF000)>>12));
716  *rgbLineBuffer++ = (G & 0x0FF0)>>4;
717  *rgbLineBuffer++ = (B & 0xFF00)>>8;
718  R = rgbaLineBuffer[pixel+i+1].Red;
719  *rgbLineBuffer++ = (((B & 0x00F0)) | ((R & 0xF000)>>12));
720  *rgbLineBuffer++ = (R & 0x0FF0)>>4;
721  G = rgbaLineBuffer[pixel+i+1].Green;
722  B = rgbaLineBuffer[pixel+i+1].Blue;
723  *rgbLineBuffer++ = (G & 0xFF00)>>8;
724  *rgbLineBuffer++ = (((G & 0x00F0)) | ((B & 0xF000)>>12));
725  *rgbLineBuffer++ = (B & 0x0FF0)>>4;
726  }
727  }
728 }
729 
730 // Convert 8 Bit ARGB to 8 bit BGR
731 void ConvertARGBToBGR (const UByte * pInRGBALineBuffer, UByte * pOutRGBLineBuffer, const ULWord inNumPixels)
732 {
733  for (ULWord pixel = 0; pixel < inNumPixels * 4; pixel += 4)
734  {
735  UByte B = pInRGBALineBuffer[pixel];
736  UByte G = pInRGBALineBuffer[pixel+1];
737  UByte R = pInRGBALineBuffer[pixel+2];
738  *pOutRGBLineBuffer++ = B;
739  *pOutRGBLineBuffer++ = G;
740  *pOutRGBLineBuffer++ = R;
741 
742  }
743 }
744 
745 // Pack 10 Bit RGBA to 10 Bit RGB Format for our board
746 void PackRGB10BitFor10BitRGB (RGBAlpha10BitPixel* pBuffer, const ULWord inNumPixels)
747 {
748  ULWord* outputBuffer(reinterpret_cast<ULWord*>(pBuffer));
749  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
750  {
751  const ULWord Red (pBuffer[pixel].Red);
752  const ULWord Green (pBuffer[pixel].Green);
753  const ULWord Blue (pBuffer[pixel].Blue);
754  outputBuffer[pixel] = (Blue<<20) + (Green<<10) + Red;
755  }
756 
757 
758 }
759 
760 // Pack 10 Bit RGBA to 10 Bit DPX Format for our board
761 void PackRGB10BitFor10BitDPX (RGBAlpha10BitPixel * pBuffer, const ULWord inNumPixels, const bool inBigEndian)
762 {
763  ULWord * pOutputBuffer (reinterpret_cast<ULWord*>(pBuffer));
764  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
765  {
766  const ULWord Red (pBuffer[pixel].Red);
767  const ULWord Green (pBuffer[pixel].Green);
768  const ULWord Blue (pBuffer[pixel].Blue);
769  const ULWord value ((Red << 22) + (Green << 12) + (Blue << 2));
770  if (inBigEndian)
771  pOutputBuffer[pixel] = ((value&0xFF)<<24) + (((value>>8)&0xFF)<<16) + (((value>>16)&0xFF)<<8) + ((value>>24)&0xFF);
772  else
773  pOutputBuffer[pixel] = value;
774  }
775 
776 
777 }
778 
779 // Pack 10 Bit RGBA to NTV2_FBF_10BIT_RGB_PACKED Format for our board
780 void PackRGB10BitFor10BitRGBPacked (RGBAlpha10BitPixel * pBuffer, const ULWord inNumPixels)
781 {
782  ULWord * pOutputBuffer (reinterpret_cast<ULWord*>(pBuffer));
783  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
784  {
785  const ULWord Red (pBuffer[pixel].Red);
786  const ULWord Green (pBuffer[pixel].Green);
787  const ULWord Blue (pBuffer[pixel].Blue);
788  ULWord value = (((Red>>2)&0xFF)<<16) + (((Green>>2)&0xFF)<<8) + ((Blue>>2)&0xFF);
789  value |= ((Red&0x3)<<28) + ((Green&0x3)<<26) + ((Blue&0x3)<<24);
790 
791  pOutputBuffer[pixel] = value;
792  }
793 }
794 
795 /* KAM
796 // ConvertLineto16BitRGB
797 // 16 Bit Version
798 void ConvertLineto16BitRGB(UByte * ycbcrBuffer,
799  RGBAlpha16BitPixel * rgbaBuffer,
800  ULWord numPixels,
801  bool fUseSDMatrix)
802 {
803  YCbCrAlphaPixel ycbcrPixel;
804  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
805 
806  // take a line(CbYCrYCbYCrY....) to RGBAlpha16BitPixels.
807  // 2 RGBAlphaPixels at a time.
808  Cb1 = *ycbcrBuffer++;
809  Y1 = *ycbcrBuffer++;
810  Cr1 = *ycbcrBuffer++;
811  for ( ULWord count = 0; count < numPixels; count+=2 )
812  {
813  ycbcrPixel.cb = (UByte)Cb1;
814  ycbcrPixel.y = (UByte)Y1;
815  ycbcrPixel.cr = (UByte)Cr1;
816 // warns that ycbcrPixel is used before intilialized.?
817  if(fUseSDMatrix) {
818  SDConvertYCbCrto16BitRGB(&ycbcrPixel,&rgbaBuffer[count]);
819  } else {
820  HDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count]);
821  }
822  // Read lone midde Y;
823  ycbcrPixel.y = *ycbcrBuffer++;
824 
825  // Read Next full bandwidth sample
826  Cb2 = *ycbcrBuffer++;
827  Y2 = *ycbcrBuffer++;
828  Cr2 = *ycbcrBuffer++;
829 
830  // Interpolate and write Inpterpolated RGBAlphaPixel
831  ycbcrPixel.cb = (UByte)((Cb1+Cb2)/2);
832  ycbcrPixel.cr = (UByte)((Cr1+Cr2)/2);
833  if(fUseSDMatrix) {
834  SDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
835  } else {
836  HDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
837  }
838  // Setup for next loop
839  Cb1 = Cb2;
840  Cr1 = Cr2;
841  Y1 = Y2;
842 
843  }
844 }
845 */
846 
847 // KAM - start
848 // ConvertLinetoRGB
849 // 10 Bit YCbCr 16 Bit RGB version
850 void ConvertLineto16BitRGB(UWord * ycbcrBuffer,
851  RGBAlpha16BitPixel * rgbaBuffer,
852  ULWord numPixels,
853  bool fUseSDMatrix,
854  bool fUseSMPTERange)
855 {
856  YCbCr10BitAlphaPixel ycbcrPixel = {0,0,0,0};
857  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
858 
859  // take a line(CbYCrYCbYCrY....) to RGBAlpha16Pixels.
860  // 2 RGBAlpha16Pixels at a time.
861  Cb1 = *ycbcrBuffer++;
862  Y1 = *ycbcrBuffer++;
863  Cr1 = *ycbcrBuffer++;
864  for ( ULWord count = 0; count < numPixels; count+=2 )
865  {
866  ycbcrPixel.cb = (UWord)Cb1;
867  ycbcrPixel.y = (UWord)Y1;
868  ycbcrPixel.cr = (UWord)Cr1;
869 
870  if(fUseSDMatrix) {
871  if (fUseSMPTERange) {
872  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
873  } else {
874  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
875  }
876  rgbaBuffer[count].Red = (rgbaBuffer[count].Red) << 6;
877  rgbaBuffer[count].Green = (rgbaBuffer[count].Green) << 6;
878  rgbaBuffer[count].Blue = (rgbaBuffer[count].Blue) << 6;
879  } else {
880  if (fUseSMPTERange) {
881  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
882  } else {
883  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
884  }
885  rgbaBuffer[count].Red = (rgbaBuffer[count].Red) << 6;
886  rgbaBuffer[count].Green = (rgbaBuffer[count].Green) << 6;
887  rgbaBuffer[count].Blue = (rgbaBuffer[count].Blue) << 6;
888  }
889 
890  // Read lone midde Y;
891  ycbcrPixel.y = *ycbcrBuffer++;
892 
893  // Read Next full bandwidth sample
894  // unless we are at the end of a line
895  if ( (count + 2 ) >= numPixels )
896  {
897  Cb2 = (UWord)Cb1;
898  Y2 = (UWord)Y1;
899  Cr2 = (UWord)Cr1;
900  }
901  else
902  {
903  Cb2 = *ycbcrBuffer++;
904  Y2 = *ycbcrBuffer++;
905  Cr2 = *ycbcrBuffer++;
906  }
907  // Interpolate and write Inpterpolated RGBAlpha16Pixel
908  ycbcrPixel.cb = (UWord)((Cb1+Cb2)/2);
909  ycbcrPixel.cr = (UWord)((Cr1+Cr2)/2);
910  if(fUseSDMatrix) {
911  if (fUseSMPTERange) {
912  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
913  } else {
914  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
915  }
916  rgbaBuffer[count+1].Red = (rgbaBuffer[count+1].Red) << 6;
917  rgbaBuffer[count+1].Green = (rgbaBuffer[count+1].Green) << 6;
918  rgbaBuffer[count+1].Blue = (rgbaBuffer[count+1].Blue) << 6;
919  } else {
920  if (fUseSMPTERange) {
921  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
922  } else {
923  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
924  }
925  rgbaBuffer[count+1].Red = (rgbaBuffer[count+1].Red) << 6;
926  rgbaBuffer[count+1].Green = (rgbaBuffer[count+1].Green) << 6;
927  rgbaBuffer[count+1].Blue = (rgbaBuffer[count+1].Blue) << 6;
928  }
929 
930  // Setup for next loop
931  Cb1 = Cb2;
932  Cr1 = Cr2;
933  Y1 = Y2;
934 
935  }
936 }
937 // KAM - end
RGBPixel::Green
unsigned char Green
Definition: ntv2videodefines.h:175
HDConvertRGBAlphatoYCbCr
void HDConvertRGBAlphatoYCbCr(RGBAlphaPixel *pSource, YCbCrPixel *pTarget)
Definition: ntv2transcode.h:284
ConvertLine_8bitABGR_to_48bitRGB
bool ConvertLine_8bitABGR_to_48bitRGB(const UByte *pInSrcLine_8bitABGR, ULWord *pOutDstLine_48BitRGB, const ULWord inNumPixels)
Converts a single 8-bit ABGR raster line to 48-bit RGB (from NTV2_FBF_ABGR to NTV2_FBF_48BIT_RGB ).
Definition: ntv2transcode.cpp:187
LWord
int32_t LWord
Definition: ajatypes.h:252
RGBAlpha10BitPixel::Alpha
UWord Alpha
Definition: ntv2videodefines.h:149
ConvertLineto8BitYCbCr
void ConvertLineto8BitYCbCr(UWord *ycbcr10BitBuffer, UByte *ycbcr8BitBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:601
Convert16BitARGBTo16BitRGBEx
void Convert16BitARGBTo16BitRGBEx(UWord *rgbaLineBuffer, UWord *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:677
ConvertARGBYCbCrToABGR
void ConvertARGBYCbCrToABGR(UByte *rgbaBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:646
ConvertLineto10BitYCbCrA
void ConvertLineto10BitYCbCrA(const UWord *pInYCbCrBuffer, ULWord *pOutYCbCrABuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:551
YCbCrPixel::cb
unsigned char cb
Definition: ntv2videodefines.h:195
ntv2transcode.h
Declares a number of pixel format transcoder functions.
SDConvert10BitYCbCrtoRGB
void SDConvert10BitYCbCrtoRGB(const YCbCr10BitAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:378
RGBAlphaPixel::Alpha
unsigned char Alpha
Definition: ntv2videodefines.h:141
Convert8BitYCbCrToYUY2
void Convert8BitYCbCrToYUY2(UByte *ycbcrBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:613
RGBAlphaPixel::Red
unsigned char Red
Definition: ntv2videodefines.h:140
YCbCrAlphaPixel::Alpha
unsigned char Alpha
Definition: ntv2videodefines.h:187
YCbCr10BitPixel::cb
UWord cb
Definition: ntv2videodefines.h:202
BGRPixel::Blue
unsigned char Blue
Definition: ntv2videodefines.h:180
YCbCrPixel::y
unsigned char y
Definition: ntv2videodefines.h:196
YCbCr10BitAlphaPixel::cb
UWord cb
Definition: ntv2videodefines.h:210
NTV2EndianSwap32HtoL
#define NTV2EndianSwap32HtoL(__val__)
Definition: ntv2endian.h:72
YCbCr10BitPixel::cr
UWord cr
Definition: ntv2videodefines.h:204
ntv2endian.h
Defines a number of handy byte-swapping macros.
ConvertRGBALineToRGB
void ConvertRGBALineToRGB(RGBAlphaPixel *rgbaBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:429
YCbCr10BitAlphaPixel::y
UWord y
Definition: ntv2videodefines.h:211
YCbCr10BitAlphaPixel::Alpha
UWord Alpha
Definition: ntv2videodefines.h:209
RGBAlphaPixel::Green
unsigned char Green
Definition: ntv2videodefines.h:139
HDConvertYCbCrtoRGBSmpte
void HDConvertYCbCrtoRGBSmpte(YCbCrAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:631
YCbCr10BitAlphaPixel
Definition: ntv2videodefines.h:207
ConvertARGBToBGR
void ConvertARGBToBGR(const UByte *pInRGBALineBuffer, UByte *pOutRGBLineBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:731
ConvertLineToYCbCr422
void ConvertLineToYCbCr422(RGBAlphaPixel *RGBLine, UByte *YCbCrLine, LWord numPixels, LWord startPixel, bool fUseSDMatrix)
Definition: ntv2transcode.cpp:209
ConvertLineto16BitRGB
void ConvertLineto16BitRGB(UWord *ycbcrBuffer, RGBAlpha16BitPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange)
Definition: ntv2transcode.cpp:850
CCIR601_10BIT_WHITE
#define CCIR601_10BIT_WHITE
Definition: videoutilities.h:19
ConvertLine_8bitABGR_to_10bitABGR
bool ConvertLine_8bitABGR_to_10bitABGR(const UByte *pInSrcLine_8bitABGR, ULWord *pOutDstLine_10BitABGR, const ULWord inNumPixels)
Converts a single 8-bit ABGR raster line to 10-bit ABGR (from NTV2_FBF_ABGR to NTV2_FBF_10BIT_RGB ).
Definition: ntv2transcode.cpp:90
YCbCrPixel
Definition: ntv2videodefines.h:193
ConvertARGBYCbCrToRGBA
void ConvertARGBYCbCrToRGBA(UByte *rgbaBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:630
ConvertLine_8bitABGR_to_10bitRGBDPXLE
bool ConvertLine_8bitABGR_to_10bitRGBDPXLE(const UByte *pInSrcLine_8bitABGR, ULWord *pOutDstLine_10BitDPXLE, const ULWord inNumPixels)
Converts a single 8-bit ABGR raster line to 10-bit RGB DPX (from NTV2_FBF_ABGR to NTV2_FBF_10BIT_DPX_...
Definition: ntv2transcode.cpp:129
ConvertLine_8bitABGR_to_24bitRGB
bool ConvertLine_8bitABGR_to_24bitRGB(const UByte *pInSrcLine_8bitABGR, UByte *pOutDstLine_24BitRGB, const ULWord inNumPixels)
Converts a single 8-bit ABGR raster line to 24-bit RGB (from NTV2_FBF_ABGR to NTV2_FBF_24BIT_RGB ).
Definition: ntv2transcode.cpp:148
SDConvert10BitYCbCrto10BitRGBSmpte
void SDConvert10BitYCbCrto10BitRGBSmpte(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:686
BGRPixel
Definition: ntv2videodefines.h:179
YCbCrAlphaPixel::cb
unsigned char cb
Definition: ntv2videodefines.h:190
YCbCr10BitPixel
Definition: ntv2videodefines.h:200
Convert16BitARGBTo16BitRGB
void Convert16BitARGBTo16BitRGB(RGBAlpha16BitPixel *rgbaLineBuffer, UWord *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:692
ConvertLinetoRGB
void ConvertLinetoRGB(UByte *ycbcrBuffer, RGBAlphaPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange)
Definition: ntv2transcode.cpp:280
NTV2EndianSwap16
#define NTV2EndianSwap16(__val__)
Definition: ntv2endian.h:15
ULWord
uint32_t ULWord
Definition: ajatypes.h:253
SDConvert10BitYCbCrtoRGBSmpte
void SDConvert10BitYCbCrtoRGBSmpte(YCbCr10BitAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:604
BGRPixel::Green
unsigned char Green
Definition: ntv2videodefines.h:181
PackRGB10BitFor10BitRGB
void PackRGB10BitFor10BitRGB(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:746
SDConvertYCbCrtoRGBSmpte
void SDConvertYCbCrtoRGBSmpte(YCbCrAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:577
YCbCrAlphaPixel
Definition: ntv2videodefines.h:185
UWord
uint16_t UWord
Definition: ajatypes.h:251
RGBAlpha10BitPixel::Green
UWord Green
Definition: ntv2videodefines.h:147
SDConvert10BitYCbCrto10BitRGB
void SDConvert10BitYCbCrto10BitRGB(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:460
RGBAlpha16BitPixel::Red
UWord Red
Definition: ntv2videodefines.h:155
HDConvert10BitYCbCrtoRGB
void HDConvert10BitYCbCrtoRGB(const YCbCr10BitAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:432
SDConvertYCbCrtoRGB
void SDConvertYCbCrtoRGB(YCbCrAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:351
RGBPixel
Definition: ntv2videodefines.h:173
ConvertARGBToRGB
void ConvertARGBToRGB(UByte *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:662
RGBAlpha16BitPixel::Blue
UWord Blue
Definition: ntv2videodefines.h:153
ConvertLine_2vuy_to_v210
bool ConvertLine_2vuy_to_v210(const UByte *pSrc2vuyLine, ULWord *pDstv210Line, const ULWord inNumPixels)
Converts a single 8-bit YCbCr '2vuy' raster line to 10-bit YCbCr 'v210' (from NTV2_FBF_8BIT_YCBCR to ...
Definition: ntv2transcode.cpp:14
ConvertRGBLineto10BitRGB
void ConvertRGBLineto10BitRGB(const RGBAlphaPixel *pInRGBA8Buffer, RGBAlpha10BitPixel *pOutRGBA10Buffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:583
RGBPixel::Red
unsigned char Red
Definition: ntv2videodefines.h:174
PackRGB10BitFor10BitDPX
void PackRGB10BitFor10BitDPX(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels, const bool inBigEndian)
Definition: ntv2transcode.cpp:761
Convert16BitARGBTo12BitRGBPacked
void Convert16BitARGBTo12BitRGBPacked(RGBAlpha16BitPixel *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:705
RGBAlpha16BitPixel
Definition: ntv2videodefines.h:152
UByte
uint8_t UByte
Definition: ajatypes.h:248
RGBAlphaPixel::Blue
unsigned char Blue
Definition: ntv2videodefines.h:138
ConvertLine_8bitABGR_to_10bitRGBDPX
bool ConvertLine_8bitABGR_to_10bitRGBDPX(const UByte *pInSrcLine_8bitABGR, ULWord *pOutDstLine_10BitDPX, const ULWord inNumPixels)
Converts a single 8-bit ABGR raster line to 10-bit RGB DPX (from NTV2_FBF_ABGR to NTV2_FBF_10BIT_DPX ...
Definition: ntv2transcode.cpp:110
YCbCr10BitAlphaPixel::cr
UWord cr
Definition: ntv2videodefines.h:212
std
Definition: json.hpp:5362
YCbCrAlphaPixel::y
unsigned char y
Definition: ntv2videodefines.h:189
HDConvert10BitYCbCrtoRGBSmpte
void HDConvert10BitYCbCrtoRGBSmpte(YCbCr10BitAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:658
AJAExport
#define AJAExport
Definition: export.h:33
YCbCrPixel::cr
unsigned char cr
Definition: ntv2videodefines.h:197
RGBPixel::Blue
unsigned char Blue
Definition: ntv2videodefines.h:176
RGBAlpha10BitPixel::Red
UWord Red
Definition: ntv2videodefines.h:148
RGBAlpha16BitPixel::Green
UWord Green
Definition: ntv2videodefines.h:154
RGBAlpha10BitPixel::Blue
UWord Blue
Definition: ntv2videodefines.h:146
HDConvertYCbCrtoRGB
void HDConvertYCbCrtoRGB(YCbCrAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:405
PackRGB10BitFor10BitRGBPacked
void PackRGB10BitFor10BitRGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:780
YCbCrAlphaPixel::cr
unsigned char cr
Definition: ntv2videodefines.h:188
ConvertLine_v210_to_2vuy
bool ConvertLine_v210_to_2vuy(const ULWord *pSrcv210Line, UByte *pDst2vuyLine, const ULWord inNumPixels)
Converts a single 10-bit YCbCr 'v210' raster line to 8-bit YCbCr '2vuy'.
Definition: ntv2transcode.cpp:49
ConvertRGBALineToBGR
void ConvertRGBALineToBGR(RGBAlphaPixel *rgbaBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:453
ConvertLine_2vuy_to_yuy2
bool ConvertLine_2vuy_to_yuy2(const UByte *pInSrcLine_2vuy, UWord *pOutDstLine_yuy2, const ULWord inNumPixels)
Converts a single 8-bit YCbCr '2vuy' raster line to 10-bit YCbCr 'v210' (from NTV2_FBF_8BIT_YCBCR to ...
Definition: ntv2transcode.cpp:32
RGBAlpha10BitPixel
Definition: ntv2videodefines.h:145
YCbCr10BitPixel::y
UWord y
Definition: ntv2videodefines.h:203
BGRPixel::Red
unsigned char Red
Definition: ntv2videodefines.h:182
ConvertLine_8bitABGR_to_24bitBGR
bool ConvertLine_8bitABGR_to_24bitBGR(const UByte *pInSrcLine_8bitABGR, UByte *pOutDstLine_24BitBGR, const ULWord inNumPixels)
Converts a single 8-bit ABGR raster line to 24-bit BGR (from NTV2_FBF_ABGR to NTV2_FBF_24BIT_BGR ).
Definition: ntv2transcode.cpp:167
RGBAlphaPixel
Definition: ntv2videodefines.h:137
SDConvertRGBAlphatoYCbCr
void SDConvertRGBAlphatoYCbCr(RGBAlphaPixel *pSource, YCbCrPixel *pTarget)
Definition: ntv2transcode.h:262
ConvertLineto10BitRGB
void ConvertLineto10BitRGB(UWord *ycbcrBuffer, RGBAlpha10BitPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange)
Definition: ntv2transcode.cpp:475
HDConvert10BitYCbCrto10BitRGBSmpte
void HDConvert10BitYCbCrto10BitRGBSmpte(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:713
HDConvert10BitYCbCrto10BitRGB
void HDConvert10BitYCbCrto10BitRGB(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:487