AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
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 = ycbcrPixel.y/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  if( fAlphaFromLuma )
387  ycbcrPixel.Alpha = ycbcrPixel.y/4;
388 
389  // Read Next full bandwidth sample
390  // unless we are at the end of a line
391  if ( (count + 2 ) >= numPixels )
392  {
393  Cb2 = (UWord)Cb1;
394  Y2 = (UWord)Y1;
395  Cr2 = (UWord)Cr1;
396  }
397  else
398  {
399  Cb2 = *ycbcrBuffer++;
400  Y2 = *ycbcrBuffer++;
401  Cr2 = *ycbcrBuffer++;
402  }
403  // Interpolate and write Inpterpolated RGBAlphaPixel
404  ycbcrPixel.cb = (UWord)((Cb1+Cb2)/2);
405  ycbcrPixel.cr = (UWord)((Cr1+Cr2)/2);
406  if(fUseSDMatrix) {
407  if (fUseSMPTERange) {
408  SDConvert10BitYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
409  } else {
410  SDConvert10BitYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
411  }
412  } else {
413  if (fUseSMPTERange) {
414  HDConvert10BitYCbCrtoRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
415  } else {
416  HDConvert10BitYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
417  }
418  }
419 
420  // Setup for next loop
421  Cb1 = Cb2;
422  Cr1 = Cr2;
423  Y1 = Y2;
424 
425  }
426 }
427 
428 // ConvertRGBALineToRGB
429 // 8 bit RGBA to 8 bit RGB (RGB24)
430 AJAExport
432  ULWord numPixels)
433 {
434  RGBPixel* rgbLineBuffer = (RGBPixel*) rgbaBuffer;
435 
436  for ( ULWord pixel=0; pixel<numPixels; pixel++ )
437  {
438  UByte R = rgbaBuffer->Red;
439  UByte G = rgbaBuffer->Green;
440  UByte B = rgbaBuffer->Blue;
441 
442  rgbLineBuffer->Red = R;
443  rgbLineBuffer->Green = G;
444  rgbLineBuffer->Blue = B;
445 
446  rgbaBuffer++;
447  rgbLineBuffer++;
448  }
449 }
450 
451 // ConvertRGBALineToBGR
452 // 8 bit RGBA to 8 bit BGR (BGR24)
453 // Conversion is done into the same buffer
454 AJAExport
456  ULWord numPixels)
457 {
458  BGRPixel* bgrLineBuffer = (BGRPixel*) rgbaBuffer;
459 
460  for ( ULWord pixel=0; pixel<numPixels; pixel++ )
461  {
462  UByte B = rgbaBuffer->Blue;
463  UByte G = rgbaBuffer->Green;
464  UByte R = rgbaBuffer->Red;
465 
466  bgrLineBuffer->Blue = B;
467  bgrLineBuffer->Green = G;
468  bgrLineBuffer->Red = R;
469 
470  rgbaBuffer++;
471  bgrLineBuffer++;
472  }
473 }
474 
475 // ConvertLineto10BitRGB
476 // 10 Bit YCbCr and 10 Bit RGB Version
477 void ConvertLineto10BitRGB(UWord * ycbcrBuffer,
478  RGBAlpha10BitPixel * rgbaBuffer,
479  ULWord numPixels,
480  bool fUseSDMatrix,
481  bool fUseSMPTERange,
482  bool fAlphaFromLuma)
483 {
484  YCbCr10BitAlphaPixel ycbcrPixel = {0,0,0,0};
485  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
486 
487  // take a line(CbYCrYCbYCrY....) to RGBAlphaPixels.
488  // 2 RGBAlphaPixels at a time.
489  Cb1 = *ycbcrBuffer++;
490  Y1 = *ycbcrBuffer++;
491  Cr1 = *ycbcrBuffer++;
492  for ( ULWord count = 0; count < numPixels; count+=2 )
493  {
494  ycbcrPixel.cb = (UWord)Cb1;
495  ycbcrPixel.y = (UWord)Y1;
496  ycbcrPixel.cr = (UWord)Cr1;
497  if( fAlphaFromLuma )
498  ycbcrPixel.Alpha = ycbcrPixel.y;
499 
500  if(fUseSDMatrix) {
501  if (fUseSMPTERange) {
502  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
503  } else {
504  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count]);
505  }
506  } else {
507  if (fUseSMPTERange) {
508  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count]);
509  } else {
510  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count]);
511  }
512  }
513  // Read lone midde Y;
514  ycbcrPixel.y = *ycbcrBuffer++;
515  if( fAlphaFromLuma )
516  ycbcrPixel.Alpha = ycbcrPixel.y;
517 
518  // Read Next full bandwidth sample
519  // unless we are at the end of a line
520  if ( (count + 2 ) >= numPixels )
521  {
522  Cb2 = (UWord)Cb1;
523  Y2 = (UWord)Y1;
524  Cr2 = (UWord)Cr1;
525  }
526  else
527  {
528  Cb2 = *ycbcrBuffer++;
529  Y2 = *ycbcrBuffer++;
530  Cr2 = *ycbcrBuffer++;
531  }
532  // Interpolate and write Inpterpolated RGBAlphaPixel
533  ycbcrPixel.cb = (UWord)((Cb1+Cb2)/2);
534  ycbcrPixel.cr = (UWord)((Cr1+Cr2)/2);
535  if(fUseSDMatrix) {
536  if (fUseSMPTERange) {
537  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
538  } else {
539  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
540  }
541  } else {
542  if (fUseSMPTERange) {
543  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,&rgbaBuffer[count+1]);
544  } else {
545  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
546  }
547  }
548 
549  // Setup for next loop
550  Cb1 = Cb2;
551  Cr1 = Cr2;
552  Y1 = Y2;
553  }
554 }
555 
556 // ConvertLineto10BitYCbCrA
557 // 10 Bit YCbCr to 10 Bit YCbCrA
558 void ConvertLineto10BitYCbCrA (const UWord * pInYCbCrBuffer,
559  ULWord * pOutYCbCrABuffer,
560  const ULWord inNumPixels)
561 {
562  for (ULWord count(0); count < inNumPixels; count++)
563  {
564  ULWord value = CCIR601_10BIT_WHITE<<20; // Set Alpha to '1';
565  value |= (ULWord(*pInYCbCrBuffer++)<<10); // Cb or Cr
566  value |= *pInYCbCrBuffer++; // Y
567  pOutYCbCrABuffer[count] = value;
568  }
569 }
570 
571 // ConvertLineto10BitRGB
572 // 8 Bit RGBA to and 10 Bit RGB Packed Version
573 void ConvertLineto10BitRGB (const RGBAlphaPixel * pInRGBA8Buffer,
574  ULWord * pOutRGB10Buffer,
575  const ULWord inNumPixels)
576 
577 {
578  for (ULWord count(0); count < inNumPixels; count++)
579  {
580  *pOutRGB10Buffer = (ULWord(pInRGBA8Buffer->Blue)<<22) +
581  (ULWord(pInRGBA8Buffer->Green)<<12) +
582  (ULWord(pInRGBA8Buffer->Red)<<2);
583  pOutRGB10Buffer++;
584  pInRGBA8Buffer++;
585  }
586 }
587 
588 // ConvertRGBLineto10BitRGB
589 // 8 Bit RGB and 10 Bit RGB Version
590 void ConvertRGBLineto10BitRGB (const RGBAlphaPixel * pInRGBA8Buffer,
591  RGBAlpha10BitPixel * pOutRGBA10Buffer,
592  const ULWord inNumPixels)
593 {
594  for (ULWord i(0); i < inNumPixels; i++)
595  {
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);
600  }
601 
602 }
603 
604 
605 
606 // ConvertLineto8BitYCbCr
607 // 10 Bit YCbCr to 8 Bit YCbCr
608 void ConvertLineto8BitYCbCr(UWord * ycbcr10BitBuffer,
609  UByte * ycbcr8BitBuffer,
610  ULWord numPixels)
611 {
612  for ( ULWord pixel=0;pixel<numPixels*2;pixel++)
613  {
614  ycbcr8BitBuffer[pixel] = ycbcr10BitBuffer[pixel]>>2;
615  }
616 
617 }
618 
619 // Converts UYVY(2yuv) -> YUY2(yuv2) in place
620 void Convert8BitYCbCrToYUY2(UByte * ycbcrBuffer,
621  ULWord numPixels)
622 {
623  for ( ULWord pixel=0;pixel<numPixels*2;pixel+=4)
624  {
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;
633  }
634 }
635 
636 // Converts 8 Bit ARGB 8 Bit RGBA in place
637 void ConvertARGBYCbCrToRGBA(UByte* rgbaBuffer,ULWord numPixels)
638 {
639  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
640  {
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;
649  }
650 }
651 
652 // Converts 8 Bit ARGB 8 Bit ABGR in place
653 void ConvertARGBYCbCrToABGR(UByte* rgbaBuffer,ULWord numPixels)
654 {
655  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
656  {
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;
665  }
666 }
667 
668 // Convert 8 Bit ARGB to 8 bit RGB
669 void ConvertARGBToRGB(UByte *rgbaLineBuffer ,UByte * rgbLineBuffer,ULWord numPixels)
670 {
671  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
672  {
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;
679 
680  }
681 }
682 //KAM
683 // Convert 16 Bit ARGB to 16 bit RGB
684 void Convert16BitARGBTo16BitRGBEx(UWord *rgbaLineBuffer ,UWord * rgbLineBuffer,ULWord numPixels)
685 {
686  for ( ULWord pixel=0;pixel<numPixels*4;pixel+=4)
687  {
688  // TODO: is this ordering correct? seems wrong...
689  RGBAlpha16BitPixel* pixelBuffer = (RGBAlpha16BitPixel*)&(rgbaLineBuffer[pixel]);
690  UWord B = pixelBuffer->Blue;
691  UWord G = pixelBuffer->Green;
692  UWord R = pixelBuffer->Red;
693  *rgbLineBuffer++ = R;
694  *rgbLineBuffer++ = G;
695  *rgbLineBuffer++ = B;
696  }
697 }
698 // KAM
699 void Convert16BitARGBTo16BitRGB(RGBAlpha16BitPixel *rgbaLineBuffer ,UWord * rgbLineBuffer,ULWord numPixels)
700 {
701  for ( ULWord pixel=0;pixel<numPixels;pixel++)
702  {
703  UWord B = rgbaLineBuffer[pixel].Blue;
704  UWord G = rgbaLineBuffer[pixel].Green;
705  UWord R = rgbaLineBuffer[pixel].Red;
706  *rgbLineBuffer++ = R;
707  *rgbLineBuffer++ = G;
708  *rgbLineBuffer++ = B;
709  }
710 }
711 
712 void Convert16BitARGBTo12BitRGBPacked(RGBAlpha16BitPixel *rgbaLineBuffer ,UByte * rgbLineBuffer,ULWord numPixels)
713 {
714  for ( ULWord pixel=0;pixel<numPixels;pixel+=8)
715  {
716  for(ULWord i = 0;i<8;i+=2)
717  {
718  UWord R = rgbaLineBuffer[pixel+i].Red;
719  UWord G = rgbaLineBuffer[pixel+i].Green;
720  UWord B = rgbaLineBuffer[pixel+i].Blue;
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;
733  }
734  }
735 }
736 
737 // Convert 8 Bit ARGB to 8 bit BGR
738 void ConvertARGBToBGR (const UByte * pInRGBALineBuffer, UByte * pOutRGBLineBuffer, const ULWord inNumPixels)
739 {
740  for (ULWord pixel = 0; pixel < inNumPixels * 4; pixel += 4)
741  {
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;
748 
749  }
750 }
751 
752 // Pack 10 Bit RGBA to 10 Bit RGB Format for our board
753 void PackRGB10BitFor10BitRGB (RGBAlpha10BitPixel* pBuffer, const ULWord inNumPixels)
754 {
755  ULWord* outputBuffer(reinterpret_cast<ULWord*>(pBuffer));
756  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
757  {
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;
762  }
763 
764 
765 }
766 
767 // Pack 10 Bit RGBA to 10 Bit DPX Format for our board
768 void PackRGB10BitFor10BitDPX (RGBAlpha10BitPixel * pBuffer, const ULWord inNumPixels, const bool inBigEndian)
769 {
770  ULWord * pOutputBuffer (reinterpret_cast<ULWord*>(pBuffer));
771  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
772  {
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));
777  if (inBigEndian)
778  pOutputBuffer[pixel] = ((value&0xFF)<<24) + (((value>>8)&0xFF)<<16) + (((value>>16)&0xFF)<<8) + ((value>>24)&0xFF);
779  else
780  pOutputBuffer[pixel] = value;
781  }
782 
783 
784 }
785 
786 // Pack 10 Bit RGBA to NTV2_FBF_10BIT_RGB_PACKED Format for our board
787 void PackRGB10BitFor10BitRGBPacked (RGBAlpha10BitPixel * pBuffer, const ULWord inNumPixels)
788 {
789  ULWord * pOutputBuffer (reinterpret_cast<ULWord*>(pBuffer));
790  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
791  {
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);
797 
798  pOutputBuffer[pixel] = value;
799  }
800 }
801 
802 // Pack 10 Bit RGBA to NTV2_FBF_10BIT_ARGB Format for our board
803 void PackRGB10BitFor10BitARGBPacked (RGBAlpha10BitPixel * pBuffer, const ULWord inNumPixels)
804 {
805  UByte * pOutputBuffer (reinterpret_cast<UByte*>(pBuffer));
806  ULWord iByte = 0;
807  for (ULWord pixel(0); pixel < inNumPixels; pixel++)
808  {
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);
818  }
819 }
820 
821 /* KAM
822 // ConvertLineto16BitRGB
823 // 16 Bit Version
824 void ConvertLineto16BitRGB(UByte * ycbcrBuffer,
825  RGBAlpha16BitPixel * rgbaBuffer,
826  ULWord numPixels,
827  bool fUseSDMatrix)
828 {
829  YCbCrAlphaPixel ycbcrPixel;
830  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
831 
832  // take a line(CbYCrYCbYCrY....) to RGBAlpha16BitPixels.
833  // 2 RGBAlphaPixels at a time.
834  Cb1 = *ycbcrBuffer++;
835  Y1 = *ycbcrBuffer++;
836  Cr1 = *ycbcrBuffer++;
837  for ( ULWord count = 0; count < numPixels; count+=2 )
838  {
839  ycbcrPixel.cb = (UByte)Cb1;
840  ycbcrPixel.y = (UByte)Y1;
841  ycbcrPixel.cr = (UByte)Cr1;
842 // warns that ycbcrPixel is used before intilialized.?
843  if(fUseSDMatrix) {
844  SDConvertYCbCrto16BitRGB(&ycbcrPixel,&rgbaBuffer[count]);
845  } else {
846  HDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count]);
847  }
848  // Read lone midde Y;
849  ycbcrPixel.y = *ycbcrBuffer++;
850 
851  // Read Next full bandwidth sample
852  Cb2 = *ycbcrBuffer++;
853  Y2 = *ycbcrBuffer++;
854  Cr2 = *ycbcrBuffer++;
855 
856  // Interpolate and write Inpterpolated RGBAlphaPixel
857  ycbcrPixel.cb = (UByte)((Cb1+Cb2)/2);
858  ycbcrPixel.cr = (UByte)((Cr1+Cr2)/2);
859  if(fUseSDMatrix) {
860  SDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
861  } else {
862  HDConvertYCbCrtoRGB(&ycbcrPixel,&rgbaBuffer[count+1]);
863  }
864  // Setup for next loop
865  Cb1 = Cb2;
866  Cr1 = Cr2;
867  Y1 = Y2;
868 
869  }
870 }
871 */
872 
873 // KAM - start
874 // ConvertLinetoRGB
875 // 10 Bit YCbCr 16 Bit RGB version
876 void ConvertLineto16BitRGB(UWord * ycbcrBuffer,
877  RGBAlpha16BitPixel * rgbaBuffer,
878  ULWord numPixels,
879  bool fUseSDMatrix,
880  bool fUseSMPTERange)
881 {
882  YCbCr10BitAlphaPixel ycbcrPixel = {0,0,0,0};
883  UWord Cb1,Y1,Cr1,Cb2,Y2,Cr2;
884 
885  // take a line(CbYCrYCbYCrY....) to RGBAlpha16Pixels.
886  // 2 RGBAlpha16Pixels at a time.
887  Cb1 = *ycbcrBuffer++;
888  Y1 = *ycbcrBuffer++;
889  Cr1 = *ycbcrBuffer++;
890  for ( ULWord count = 0; count < numPixels; count+=2 )
891  {
892  ycbcrPixel.cb = (UWord)Cb1;
893  ycbcrPixel.y = (UWord)Y1;
894  ycbcrPixel.cr = (UWord)Cr1;
895 
896  if(fUseSDMatrix) {
897  if (fUseSMPTERange) {
898  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
899  } else {
900  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
901  }
902  rgbaBuffer[count].Red = (rgbaBuffer[count].Red) << 6;
903  rgbaBuffer[count].Green = (rgbaBuffer[count].Green) << 6;
904  rgbaBuffer[count].Blue = (rgbaBuffer[count].Blue) << 6;
905  } else {
906  if (fUseSMPTERange) {
907  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
908  } else {
909  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count]);
910  }
911  rgbaBuffer[count].Red = (rgbaBuffer[count].Red) << 6;
912  rgbaBuffer[count].Green = (rgbaBuffer[count].Green) << 6;
913  rgbaBuffer[count].Blue = (rgbaBuffer[count].Blue) << 6;
914  }
915 
916  // Read lone midde Y;
917  ycbcrPixel.y = *ycbcrBuffer++;
918 
919  // Read Next full bandwidth sample
920  // unless we are at the end of a line
921  if ( (count + 2 ) >= numPixels )
922  {
923  Cb2 = (UWord)Cb1;
924  Y2 = (UWord)Y1;
925  Cr2 = (UWord)Cr1;
926  }
927  else
928  {
929  Cb2 = *ycbcrBuffer++;
930  Y2 = *ycbcrBuffer++;
931  Cr2 = *ycbcrBuffer++;
932  }
933  // Interpolate and write Inpterpolated RGBAlpha16Pixel
934  ycbcrPixel.cb = (UWord)((Cb1+Cb2)/2);
935  ycbcrPixel.cr = (UWord)((Cr1+Cr2)/2);
936  if(fUseSDMatrix) {
937  if (fUseSMPTERange) {
938  SDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
939  } else {
940  SDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
941  }
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;
945  } else {
946  if (fUseSMPTERange) {
947  HDConvert10BitYCbCrto10BitRGBSmpte(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
948  } else {
949  HDConvert10BitYCbCrto10BitRGB(&ycbcrPixel,(RGBAlpha10BitPixel *)&rgbaBuffer[count+1]);
950  }
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;
954  }
955 
956  // Setup for next loop
957  Cb1 = Cb2;
958  Cr1 = Cr2;
959  Y1 = Y2;
960 
961  }
962 }
963 // KAM - end
RGBPixel::Green
unsigned char Green
Definition: ntv2videodefines.h:175
HDConvertRGBAlphatoYCbCr
void HDConvertRGBAlphatoYCbCr(RGBAlphaPixel *pSource, YCbCrPixel *pTarget)
Definition: ntv2transcode.h:290
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:275
RGBAlpha10BitPixel::Alpha
UWord Alpha
Definition: ntv2videodefines.h:149
ConvertLineto8BitYCbCr
void ConvertLineto8BitYCbCr(UWord *ycbcr10BitBuffer, UByte *ycbcr8BitBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:608
Convert16BitARGBTo16BitRGBEx
void Convert16BitARGBTo16BitRGBEx(UWord *rgbaLineBuffer, UWord *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:684
ConvertARGBYCbCrToABGR
void ConvertARGBYCbCrToABGR(UByte *rgbaBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:653
ConvertLineto10BitYCbCrA
void ConvertLineto10BitYCbCrA(const UWord *pInYCbCrBuffer, ULWord *pOutYCbCrABuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:558
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:384
RGBAlphaPixel::Alpha
unsigned char Alpha
Definition: ntv2videodefines.h:141
Convert8BitYCbCrToYUY2
void Convert8BitYCbCrToYUY2(UByte *ycbcrBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:620
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:431
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:637
YCbCr10BitAlphaPixel
Definition: ntv2videodefines.h:207
ConvertARGBToBGR
void ConvertARGBToBGR(const UByte *pInRGBALineBuffer, UByte *pOutRGBLineBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:738
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:876
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:637
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:692
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:699
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:276
SDConvert10BitYCbCrtoRGBSmpte
void SDConvert10BitYCbCrtoRGBSmpte(YCbCr10BitAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:610
BGRPixel::Green
unsigned char Green
Definition: ntv2videodefines.h:181
PackRGB10BitFor10BitRGB
void PackRGB10BitFor10BitRGB(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:753
SDConvertYCbCrtoRGBSmpte
void SDConvertYCbCrtoRGBSmpte(YCbCrAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:583
YCbCrAlphaPixel
Definition: ntv2videodefines.h:185
UWord
uint16_t UWord
Definition: ajatypes.h:274
RGBAlpha10BitPixel::Green
UWord Green
Definition: ntv2videodefines.h:147
SDConvert10BitYCbCrto10BitRGB
void SDConvert10BitYCbCrto10BitRGB(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:466
PackRGB10BitFor10BitARGBPacked
void PackRGB10BitFor10BitARGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:803
RGBAlpha16BitPixel::Red
UWord Red
Definition: ntv2videodefines.h:155
HDConvert10BitYCbCrtoRGB
void HDConvert10BitYCbCrtoRGB(const YCbCr10BitAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:438
ConvertLineto10BitRGB
void ConvertLineto10BitRGB(UWord *ycbcrBuffer, RGBAlpha10BitPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange, bool fAlphaFromLuma)
Definition: ntv2transcode.cpp:477
SDConvertYCbCrtoRGB
void SDConvertYCbCrtoRGB(YCbCrAlphaPixel *pSource, RGBAlphaPixel *pTarget)
Definition: ntv2transcode.h:357
RGBPixel
Definition: ntv2videodefines.h:173
ConvertARGBToRGB
void ConvertARGBToRGB(UByte *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:669
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:590
RGBPixel::Red
unsigned char Red
Definition: ntv2videodefines.h:174
PackRGB10BitFor10BitDPX
void PackRGB10BitFor10BitDPX(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels, const bool inBigEndian)
Definition: ntv2transcode.cpp:768
Convert16BitARGBTo12BitRGBPacked
void Convert16BitARGBTo12BitRGBPacked(RGBAlpha16BitPixel *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
Definition: ntv2transcode.cpp:712
RGBAlpha16BitPixel
Definition: ntv2videodefines.h:152
UByte
uint8_t UByte
Definition: ajatypes.h:271
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:664
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:411
PackRGB10BitFor10BitRGBPacked
void PackRGB10BitFor10BitRGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Definition: ntv2transcode.cpp:787
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:455
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:268
HDConvert10BitYCbCrto10BitRGBSmpte
void HDConvert10BitYCbCrto10BitRGBSmpte(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:719
HDConvert10BitYCbCrto10BitRGB
void HDConvert10BitYCbCrto10BitRGB(YCbCr10BitAlphaPixel *pSource, RGBAlpha10BitPixel *pTarget)
Definition: ntv2transcode.h:493