8 #ifndef AJA_VIDEOUTILS_H
9 #define AJA_VIDEOUTILS_H
14 #define DEFAULT_PATT_GAIN 0.9 // some patterns pay attention to this...
15 #define HD_NUMCOMPONENTPIXELS_2K 2048
16 #define HD_NUMCOMPONENTPIXELS_1080_2K 2048
17 #define HD_NUMCOMPONENTPIXELS_1080 1920
18 #define CCIR601_10BIT_BLACK 64
19 #define CCIR601_10BIT_WHITE 940
20 #define CCIR601_10BIT_CHROMAOFFSET 512
22 #define CCIR601_8BIT_BLACK 16
23 #define CCIR601_8BIT_WHITE 235
24 #define CCIR601_8BIT_CHROMAOFFSET 128
26 #define MIN_RGB_8BIT 0
27 #define MAX_RGB_8BIT 255
28 #define MIN_RGB_10BIT 0
29 #define MAX_RGB_10BIT 1023
30 #define MIN_RGB_16BIT 0
31 #define MAX_RGB_16BIT 65535
34 #define FRAME_0_BASE (0x0)
35 #define FRAME_1080_10BIT_LINEPITCH (1280*4)
36 #define FRAME_1080_8BIT_LINEPITCH (1920*2)
37 #define FRAME_QUADHD_10BIT_SIZE (FRAME_1080_10BIT_LINEPITCH*2160)
38 #define FRAME_QUADHD_8BIT_SIZE (FRAME_1080_8BIT_LINEPITCH*2160)
39 #define FRAME_BASE(__frameNum__,__frameSize__) ((__frameNum__)*(__frameSize__))
44 #if !defined(ClipRGB_8BIT)
45 #define ClipRGB_8BIT(__x__) ((__x__) > MAX_RGB_8BIT ? (MAX_RGB_8BIT) \
46 : ((__x__) <= MIN_RGB_8BIT ? (MIN_RGB_8BIT) \
49 #if !defined(ClipRGB_10BIT)
50 #define ClipRGB_10BIT(__x__) ((__x__) > MAX_RGB_10BIT ? (MAX_RGB_10BIT) \
51 : ((__x__) <= MIN_RGB_10BIT ? (MIN_RGB_10BIT) \
55 #define MIN_YCBCR_10BIT 4
56 #define MAX_YCBCR_10BIT 1019
57 #define ClipYCbCr_10BIT(X) ((X) > MAX_YCBCR_10BIT ? (MAX_YCBCR_10BIT) : ((X) < MIN_YCBCR_10BIT ? (MIN_YCBCR_10BIT) : (X)))
150 void AJA_EXPORT AJA_ReSampleLine(int16_t *Input, int16_t *Output, uint16_t startPixel, uint16_t endPixel, int32_t numInputPixels, int32_t numOutputPixels);
152 void AJA_EXPORT AJA_ReSampleAudio(int16_t *Input, int16_t *Output, uint16_t startPixel, uint16_t endPixel, int32_t numInputPixels, int32_t numOutputPixels, int16_t channelInterleaveMulitplier=1);
155 uint8_t* pOutputBuffer,uint32_t* pPackedLineBuffer);
157 uint32_t numPixels, uint32_t linePitch, uint8_t* pOutputBuffer,uint32_t* pPackedLineBuffer);
163 bool fUseRGBFullRange=
false);
171 retValue = (int16_t)(-((-inFix+0x8000)>>16));
175 retValue = (int16_t)((inFix + 0x8000)>>16);
183 int32_t Red,Green,Blue;
210 int32_t Red,Green,Blue;
237 int32_t Red,Green,Blue;
264 int32_t Red,Green,Blue;
295 (int32_t)0x810F*pSource->
Green +
296 (int32_t)0x1910*pSource->
Blue )>>14);
297 pTarget->
y = (uint16_t)Y;
300 (int32_t)0x4A7E*pSource->
Green +
301 (int32_t)0x7070*pSource->
Blue )>>14);
303 pTarget->
cb = uint16_t(Cb&0x3FF);
306 (int32_t)0x5E27*pSource->
Green -
307 (int32_t)0x1249*pSource->
Blue )>>14);
309 pTarget->
cr = uint16_t(Cr&0x3FF);
317 (int32_t)0x9C9F*pSource->
Green +
318 (int32_t)0x0FD2*pSource->
Blue )>>14);
319 pTarget->
y = (uint16_t)Y;
322 (int32_t)0x545B*pSource->
Green +
323 (int32_t)0x6DA9*pSource->
Blue )>>14);
325 pTarget->
cb = uint16_t(Cb&0x3FF);
328 (int32_t)0x6305*pSource->
Green -
329 (int32_t)0x0A06*pSource->
Blue )>>14);
331 pTarget->
cr = uint16_t(Cr&0x3FF);
340 dY = (double(pSource->
Red ) * 0.182068) +
341 (double(pSource->
Green) * 0.612427) +
342 (double(pSource->
Blue ) * 0.061829);
344 pTarget->
y = uint16_t(Y&0x3FF);
346 dCb = (double(pSource->
Red ) * (-0.100342)) +
347 (
double(pSource->
Green) * (-0.337585)) +
348 (
double(pSource->
Blue ) * (0.437927));
350 pTarget->
cb = uint16_t(Cb&0x3FF);
352 dCr = (double(pSource->
Red ) * (0.437927)) +
353 (
double(pSource->
Green) * (-0.397766)) +
354 (
double(pSource->
Blue ) * (-0.040161));
356 pTarget->
cr = uint16_t(Cr&0x3FF);
361 dY = (double(pSource->
Red ) * 0.212585) +
362 (double(pSource->
Green) * 0.715210) +
363 (double(pSource->
Blue ) * 0.072205);
365 pTarget->
y = uint16_t(Y&0x3FF);
367 dCb = (double(pSource->
Red ) * (-0.117188)) +
368 (
double(pSource->
Green) * (-0.394226)) +
369 (
double(pSource->
Blue ) * (0.511414));
371 pTarget->
cb = uint16_t(Cb&0x3FF);
373 dCr = (double(pSource->
Red ) * (0.511414)) +
374 (
double(pSource->
Green) * (-0.464508)) +
375 (
double(pSource->
Blue ) * (-0.046906));
377 pTarget->
cr = uint16_t(Cr&0x3FF);
381 #endif // AJA_VIDEOUTILS_H