8 #ifndef META_OCEAN_CV_FRAME_CONVERTER_RGB_24_H
9 #define META_OCEAN_CV_FRAME_CONVERTER_RGB_24_H
43 static inline void convertRGB24ToARGB32(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const uint8_t alphaValue = 0xFF,
Worker* worker =
nullptr);
56 static inline void convertRGB24ToBGR24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
70 static inline void convertRGB24ToBGR32(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker);
83 static inline void convertRGB24ToBGRA32(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const uint8_t alphaValue = 0xFF,
Worker* worker =
nullptr);
92 static inline void changeRGB24ToBGR24(uint8_t* frame,
const unsigned int width,
const unsigned int height,
Worker* worker =
nullptr);
105 static inline void convertRGB24ToRGB24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
119 static inline void convertRGB24ToRGB32(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
133 static inline void convertRGB24ToRGBA32(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const uint8_t alphaValue = 0xFF,
Worker* worker =
nullptr);
147 static inline void convertRGB24ToY8(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
160 static inline void convertRGB24ToYUV24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
179 static inline void convertRGB24FullRangeToY_UV12LimitedRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* uvTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int uvTargetPaddingElements,
Worker* worker =
nullptr);
198 static inline void convertRGB24FullRangeToY_VU12LimitedRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* vuTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vuTargetPaddingElements,
Worker* worker =
nullptr);
217 static inline void convertRGB24FullRangeToY_UV12FullRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* uvTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int uvTargetPaddingElements,
Worker* worker =
nullptr);
236 static inline void convertRGB24FullRangeToY_VU12FullRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* vuTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vuTargetPaddingElements,
Worker* worker =
nullptr);
257 static inline void convertRGB24FullRangeToY_U_V12LimitedRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* uTarget, uint8_t* vTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int uTargetPaddingElements,
const unsigned int vTargetPaddingElements,
Worker* worker =
nullptr);
278 static inline void convertRGB24FullRangeToY_V_U12LimitedRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* vTarget, uint8_t* uTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vTargetPaddingElements,
const unsigned int uTargetPaddingElements,
Worker* worker =
nullptr);
299 static inline void convertRGB24FullRangeToY_U_V12FullRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* uTarget, uint8_t* vTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int uTargetPaddingElements,
const unsigned int vTargetPaddingElements,
Worker* worker =
nullptr);
320 static inline void convertRGB24FullRangeToY_V_U12FullRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* vTarget, uint8_t* uTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vTargetPaddingElements,
const unsigned int uTargetPaddingElements,
Worker* worker =
nullptr);
329 static inline void changeRGB24ToYUV24(uint8_t* frame,
const unsigned int width,
const unsigned int height,
Worker* worker =
nullptr);
337 static inline void convertRGB24ToYUV24Pixel(
const uint8_t* rgb, uint8_t* yuv);
354 static inline void convertRGB24ToR_G_B24(
const uint8_t* source, uint8_t* rTarget, uint8_t* gTarget, uint8_t* bTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int rTargetPaddingElements,
const unsigned int gTargetPaddingElements,
const unsigned int bTargetPaddingElements,
Worker* worker =
nullptr);
365 static void changeRGB24ToBGR24Subset(uint8_t* frame,
const unsigned int width,
const unsigned int firstRow,
const unsigned int numberRows);
374 static void changeRGB24ToYUV24Subset(uint8_t* frame,
const unsigned int width,
const unsigned int firstRow,
const unsigned int numberRows);
376 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
394 static OCEAN_FORCE_INLINE
void convert16PixelsRGB24ToYUV24Precision7BitNEON(
const uint8_t*
const source, uint8_t*
const target);
401 ocean_assert(source !=
nullptr && target !=
nullptr);
402 ocean_assert(width >= 1u && height >= 1u);
404 FrameChannels::addFirstChannelValue<uint8_t, 3u>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
409 ocean_assert(source !=
nullptr && target !=
nullptr);
410 ocean_assert(width >= 1u && height >= 1u);
412 FrameChannels::reverseChannelOrder<uint8_t, 3u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
418 ocean_assert(width != 0u && height != 0u);
432 ocean_assert(source !=
nullptr && target !=
nullptr);
433 ocean_assert(width >= 1u && height >= 1u);
439 constexpr
unsigned int shufflePattern = 0x012u;
441 FrameChannels::shuffleChannelsAndSetLastChannelValue<uint8_t, 3u, 4u, shufflePattern>(source, 0u, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
446 ocean_assert(source !=
nullptr && target !=
nullptr);
447 ocean_assert(width >= 1u && height >= 1u);
453 constexpr
unsigned int shufflePattern = 0x012u;
455 FrameChannels::shuffleChannelsAndSetLastChannelValue<uint8_t, 3u, 4u, shufflePattern>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
460 ocean_assert(source !=
nullptr && target !=
nullptr);
461 ocean_assert(width >= 1u && height >= 1u);
463 FrameChannels::transformGeneric<uint8_t, 3u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
468 ocean_assert(source !=
nullptr && target !=
nullptr);
469 ocean_assert(width >= 1u && height >= 1u);
471 FrameChannels::addLastChannelValue<uint8_t, 3u>(source, 0u, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
476 ocean_assert(source !=
nullptr && target !=
nullptr);
477 ocean_assert(width >= 1u && height >= 1u);
479 FrameChannels::addLastChannelValue<uint8_t, 3u>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
484 ocean_assert(source !=
nullptr && target !=
nullptr);
485 ocean_assert(width >= 1u && height >= 1u);
487 const unsigned int sourceStrideElements = width * 3u + sourcePaddingElements;
488 const unsigned int targetStrideElements = width + targetPaddingElements;
490 constexpr
unsigned int channelFactors[3] = {38u, 75u, 15u};
492 static_assert(channelFactors[0] + channelFactors[1] + channelFactors[2] == 128u,
"Invalid factors!");
494 constexpr
bool useFactorChannel0 = channelFactors[0] != 0u;
495 constexpr
bool useFactorChannel1 = channelFactors[1] != 0u;
496 constexpr
bool useFactorChannel2 = channelFactors[2] != 0u;
498 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
500 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag, CV::FrameChannels::convertRow3ChannelsTo1Channel8BitPerChannel7BitPrecision<useFactorChannel0, useFactorChannel1, useFactorChannel2>, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 1u>, areContinuous, channelFactors, worker);
505 ocean_assert(source !=
nullptr && target !=
nullptr);
506 ocean_assert(width >= 1u && height >= 1u);
508 const unsigned int sourceStrideElements = width * 3u + sourcePaddingElements;
509 const unsigned int targetStrideElements = width * 3u + targetPaddingElements;
511 #if defined(OCEAN_USE_HARDCODED_RGB24_TO_YUV24_CONVERTER) && OCEAN_HARDWARE_NEON_VERSION >= 10
515 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
FrameConverterRGB24::convertRGB24ToYUV24RowPrecision7BitNEON, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>,
nullptr, worker);
524 const int parameters[12] = {33, -19, 56, 64, -37, -47, 13, 56, -9, 16, 128, 128};
526 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
528 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
CV::FrameChannels::convertRow3ChannelsTo3Channels8BitPerChannel7BitPrecision, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>, areContinuous, parameters, worker);
535 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uvTarget !=
nullptr);
537 ocean_assert(width >= 2u && width % 2u == 0u);
538 ocean_assert(height >= 2u && height % 2u == 0u);
540 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
560 const int options[3 + 9 + 3] =
563 int(sourcePaddingElements), int(yTargetPaddingElements), int(uvTargetPaddingElements),
566 33, -19, 56, 64, -37, -47, 13, 56, -9,
583 ocean_assert(source !=
nullptr && yTarget !=
nullptr && vuTarget !=
nullptr);
585 ocean_assert(width >= 2u && width % 2u == 0u);
586 ocean_assert(height >= 2u && height % 2u == 0u);
588 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
608 const int options[3 + 9 + 3] =
611 int(sourcePaddingElements), int(yTargetPaddingElements), int(vuTargetPaddingElements),
614 33, 56, -19, 64, -47, -37, 13, -9, 56,
631 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uvTarget !=
nullptr);
633 ocean_assert(width >= 2u && width % 2u == 0u);
634 ocean_assert(height >= 2u && height % 2u == 0u);
636 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
656 const int options[3 + 9 + 3] =
659 int(sourcePaddingElements), int(yTargetPaddingElements), int(uvTargetPaddingElements),
662 38, -22, 64, 75, -42, -54, 15, 64, -10,
679 ocean_assert(source !=
nullptr && yTarget !=
nullptr && vuTarget !=
nullptr);
681 ocean_assert(width >= 2u && width % 2u == 0u);
682 ocean_assert(height >= 2u && height % 2u == 0u);
684 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
704 const int options[3 + 9 + 3] =
707 int(sourcePaddingElements), int(yTargetPaddingElements), int(vuTargetPaddingElements),
710 38, 64, -22, 75, -54, -42, 15, -10, 64,
725 inline void FrameConverterRGB24::convertRGB24FullRangeToY_U_V12LimitedRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* uTarget, uint8_t* vTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int uTargetPaddingElements,
const unsigned int vTargetPaddingElements,
Worker* worker)
727 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uTarget !=
nullptr && vTarget !=
nullptr);
729 ocean_assert(width >= 2u && width % 2u == 0u);
730 ocean_assert(height >= 2u && height % 2u == 0u);
732 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
752 const int options[4 + 9 + 3] =
755 int(sourcePaddingElements), int(yTargetPaddingElements), int(uTargetPaddingElements), int(vTargetPaddingElements),
758 33, -19, 56, 64, -37, -47, 13, 56, -9,
774 inline void FrameConverterRGB24::convertRGB24FullRangeToY_V_U12LimitedRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* vTarget, uint8_t* uTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vTargetPaddingElements,
const unsigned int uTargetPaddingElements,
Worker* worker)
778 convertRGB24FullRangeToY_U_V12LimitedRange(source, yTarget, uTarget, vTarget, width, height, flag, sourcePaddingElements, yTargetPaddingElements, uTargetPaddingElements, vTargetPaddingElements, worker);
781 inline void FrameConverterRGB24::convertRGB24FullRangeToY_U_V12FullRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* uTarget, uint8_t* vTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int uTargetPaddingElements,
const unsigned int vTargetPaddingElements,
Worker* worker)
783 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uTarget !=
nullptr && vTarget !=
nullptr);
785 ocean_assert(width >= 2u && width % 2u == 0u);
786 ocean_assert(height >= 2u && height % 2u == 0u);
788 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
808 const int options[4 + 9 + 3] =
811 int(sourcePaddingElements), int(yTargetPaddingElements), int(uTargetPaddingElements), int(vTargetPaddingElements),
814 38, -22, 64, 75, -42, -54, 15, 64, -10,
830 inline void FrameConverterRGB24::convertRGB24FullRangeToY_V_U12FullRange(
const uint8_t* source, uint8_t* yTarget, uint8_t* vTarget, uint8_t* uTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vTargetPaddingElements,
const unsigned int uTargetPaddingElements,
Worker* worker)
834 convertRGB24FullRangeToY_U_V12FullRange(source, yTarget, uTarget, vTarget, width, height, flag, sourcePaddingElements, yTargetPaddingElements, uTargetPaddingElements, vTargetPaddingElements, worker);
853 ocean_assert(rgb && yuv);
855 yuv[0] = uint8_t(((rgb[0] * 66 + rgb[1] * 129 + rgb[2] * 25 + 128) >> 8) + 16);
856 yuv[1] = uint8_t(((rgb[0] * -38 - rgb[1] * 74 + rgb[2] * 112 + 128) >> 8) + 128);
857 yuv[2] = uint8_t(((rgb[0] * 112 - rgb[1] * 94 - rgb[2] * 18 + 128) >> 8) + 128);
859 ocean_assert(abs(
int(yuv[0]) -
int(((rgb[0] * 66 + rgb[1] * 129 + rgb[2] * 25 + 128) / 256) + 16)) <= 1);
860 ocean_assert(abs(
int(yuv[1]) -
int(((rgb[0] * -38 - rgb[1] * 74 + rgb[2] * 112 + 128) / 256) + 128)) <= 1);
861 ocean_assert(abs(
int(yuv[2]) -
int(((rgb[0] * 112 - rgb[1] * 94 - rgb[2] * 18 + 128) / 256) + 128)) <= 1);
864 inline void FrameConverterRGB24::convertRGB24ToR_G_B24(
const uint8_t* source, uint8_t* rTarget, uint8_t* gTarget, uint8_t* bTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int rTargetPaddingElements,
const unsigned int gTargetPaddingElements,
const unsigned int bTargetPaddingElements,
Worker* worker)
866 ocean_assert(source !=
nullptr && rTarget !=
nullptr && gTarget !=
nullptr && bTarget !=
nullptr);
868 if (width < 1u || height < 1u)
873 const unsigned int options[4] = {sourcePaddingElements, rTargetPaddingElements, gTargetPaddingElements, bTargetPaddingElements};
882 FrameConverter::convertArbitraryPixelFormat((
const void**)(&source), targets, width, height, flag, 1u, FrameConverter::mapOneRow_1Plane3Channels_To_3Plane1Channel_8BitPerChannel<0u, 1u, 2u>, options, worker);
885 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
889 ocean_assert(source !=
nullptr && target !=
nullptr);
909 const uint8x16x3_t source_u_8x16x3 = vld3q_u8(source);
911 const uint8x8_t source0_low_u_8x8 = vget_low_u8(source_u_8x16x3.val[0]);
912 const uint8x8_t source0_high_u_8x8 = vget_high_u8(source_u_8x16x3.val[0]);
914 const uint8x8_t source1_low_u_8x8 = vget_low_u8(source_u_8x16x3.val[1]);
915 const uint8x8_t source1_high_u_8x8 = vget_high_u8(source_u_8x16x3.val[1]);
917 const uint8x8_t source2_low_u_8x8 = vget_low_u8(source_u_8x16x3.val[2]);
918 const uint8x8_t source2_high_u_8x8 = vget_high_u8(source_u_8x16x3.val[2]);
921 const uint8x8_t constant33_u_8x8 = vdup_n_u8(33);
922 uint16x8_t intermediateResults0_low_u_16x8 = vmull_u8(source0_low_u_8x8, constant33_u_8x8);
923 uint16x8_t intermediateResults0_high_u_16x8 = vmull_u8(source0_high_u_8x8, constant33_u_8x8);
925 const uint8x8_t constant64_u_8x8 = vdup_n_u8(64);
926 intermediateResults0_low_u_16x8 = vmlal_u8(intermediateResults0_low_u_16x8, source1_low_u_8x8, constant64_u_8x8);
927 intermediateResults0_high_u_16x8 = vmlal_u8(intermediateResults0_high_u_16x8, source1_high_u_8x8, constant64_u_8x8);
929 const uint8x8_t constant13_u_8x8 = vdup_n_u8(13);
930 intermediateResults0_low_u_16x8 = vmlal_u8(intermediateResults0_low_u_16x8, source2_low_u_8x8, constant13_u_8x8);
931 intermediateResults0_high_u_16x8 = vmlal_u8(intermediateResults0_high_u_16x8, source2_high_u_8x8, constant13_u_8x8);
934 const uint8x8_t constant56_u_8x8 = vdup_n_u8(56);
935 uint16x8_t intermediateResults1_low_u_16x8 = vmull_u8(source2_low_u_8x8, constant56_u_8x8);
936 uint16x8_t intermediateResults1_high_u_16x8 = vmull_u8(source2_high_u_8x8, constant56_u_8x8);
938 uint16x8_t intermediateResults2_low_u_16x8 = vmull_u8(source0_low_u_8x8, constant56_u_8x8);
939 uint16x8_t intermediateResults2_high_u_16x8 = vmull_u8(source0_high_u_8x8, constant56_u_8x8);
942 const uint8x8_t constant19_u_8x8 = vdup_n_u8(19);
943 intermediateResults1_low_u_16x8 = vmlsl_u8(intermediateResults1_low_u_16x8, source0_low_u_8x8, constant19_u_8x8);
944 intermediateResults1_high_u_16x8 = vmlsl_u8(intermediateResults1_high_u_16x8, source0_high_u_8x8, constant19_u_8x8);
946 const uint8x8_t constant37_u_8x8 = vdup_n_u8(37);
947 intermediateResults1_low_u_16x8 = vmlsl_u8(intermediateResults1_low_u_16x8, source1_low_u_8x8, constant37_u_8x8);
948 intermediateResults1_high_u_16x8 = vmlsl_u8(intermediateResults1_high_u_16x8, source1_high_u_8x8, constant37_u_8x8);
951 const uint8x8_t constant47_u_8x8 = vdup_n_u8(47);
952 intermediateResults2_low_u_16x8 = vmlsl_u8(intermediateResults2_low_u_16x8, source1_low_u_8x8, constant47_u_8x8);
953 intermediateResults2_high_u_16x8 = vmlsl_u8(intermediateResults2_high_u_16x8, source1_high_u_8x8, constant47_u_8x8);
955 const uint8x8_t constant9_u_8x8 = vdup_n_u8(9);
956 intermediateResults2_low_u_16x8 = vmlsl_u8(intermediateResults2_low_u_16x8, source2_low_u_8x8, constant9_u_8x8);
957 intermediateResults2_high_u_16x8 = vmlsl_u8(intermediateResults2_high_u_16x8, source2_high_u_8x8, constant9_u_8x8);
960 const int16x8_t constant16_s_16x8 = vdupq_n_s16(16 * 128);
961 const int16x8_t constant128_s_16x8 = vdupq_n_s16(128 * 128);
963 const int16x8_t intermediateResults0_low_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults0_low_u_16x8), constant16_s_16x8);
964 const int16x8_t intermediateResults0_high_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults0_high_u_16x8), constant16_s_16x8);
966 const int16x8_t intermediateResults1_low_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults1_low_u_16x8), constant128_s_16x8);
967 const int16x8_t intermediateResults1_high_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults1_high_u_16x8), constant128_s_16x8);
969 const int16x8_t intermediateResults2_low_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults2_low_u_16x8), constant128_s_16x8);
970 const int16x8_t intermediateResults2_high_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults2_high_u_16x8), constant128_s_16x8);
974 uint8x16x3_t results_u_8x16x3;
975 results_u_8x16x3.val[0] = vcombine_u8(vqrshrun_n_s16(intermediateResults0_low_s_16x8, 7), vqrshrun_n_s16(intermediateResults0_high_s_16x8, 7));
976 results_u_8x16x3.val[1] = vcombine_u8(vqrshrun_n_s16(intermediateResults1_low_s_16x8, 7), vqrshrun_n_s16(intermediateResults1_high_s_16x8, 7));
977 results_u_8x16x3.val[2] = vcombine_u8(vqrshrun_n_s16(intermediateResults2_low_s_16x8, 7), vqrshrun_n_s16(intermediateResults2_high_s_16x8, 7));
980 vst3q_u8(target, results_u_8x16x3);
static void convertRow3ChannelsTo3Channels8BitPerChannel7BitPrecision(const uint8_t *source, uint8_t *target, const size_t size, const void *parameters)
Converts a row of pixels with 3 channels to pixels with 3 channels by a linear combination of the thr...
This is the base class for all frame converter classes.
Definition: FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
static void convertGenericPixelFormat(const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideElements, const unsigned int targetStrideElements, const ConversionFlag flag, const RowConversionFunction< TSource, TTarget > rowConversionFunction, const RowReversePixelOrderInPlaceFunction< TTarget > targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void *options, Worker *worker)
Converts a frame with generic pixel format (e.g., RGBA32, BGR24, YUV24, ...) to a frame with generic ...
Definition: FrameConverter.h:3211
static void convertTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelsDownsampled2x2_8BitPerChannel_Precision7Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a RGB pixel format to two rows of an image with e....
static void convertTwoRows_1Plane3Channels_To_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_8BitPerChannel_Precision7Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a RGB pixel format to two rows of an image with e....
static void convertArbitraryPixelFormat(const void **sources, void **targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void *options, Worker *worker)
Converts a frame with arbitrary pixel format (e.g., Y_UV12, Y_VU12, YUYV16, ...) to a frame with arbi...
Definition: FrameConverter.h:3234
This class provides functions to convert or to change frames with RGB pixel format.
Definition: FrameConverterRGB24.h:28
static void convertRGB24FullRangeToY_VU12FullRange(const uint8_t *source, uint8_t *yTarget, uint8_t *vuTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int vuTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a full range Y_VU12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:677
static void changeRGB24ToBGR24(uint8_t *frame, const unsigned int width, const unsigned int height, Worker *worker=nullptr)
Changes a RGB 24 bit frame to a BGR 24 bit frame in place.
Definition: FrameConverterRGB24.h:415
static void convertRGB24ToRGB24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a RGB 24 bit frame.
Definition: FrameConverterRGB24.h:458
static void convertRGB24FullRangeToY_VU12LimitedRange(const uint8_t *source, uint8_t *yTarget, uint8_t *vuTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int vuTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a limited range Y_VU12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:581
static void convertRGB24FullRangeToY_UV12FullRange(const uint8_t *source, uint8_t *yTarget, uint8_t *uvTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uvTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a full range Y_UV12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:629
static OCEAN_FORCE_INLINE void convert16PixelsRGB24ToYUV24Precision7BitNEON(const uint8_t *const source, uint8_t *const target)
Converts 16 RGB24 pixels to 16 YUV24 pixels by using NEON instructions.
Definition: FrameConverterRGB24.h:887
static void convertRGB24FullRangeToY_V_U12LimitedRange(const uint8_t *source, uint8_t *yTarget, uint8_t *vTarget, uint8_t *uTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int vTargetPaddingElements, const unsigned int uTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a limited range Y_V_U12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:774
static void convertRGB24ToARGB32(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a ARGB 32 bit frame.
Definition: FrameConverterRGB24.h:399
static void convertRGB24ToR_G_B24(const uint8_t *source, uint8_t *rTarget, uint8_t *gTarget, uint8_t *bTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int rTargetPaddingElements, const unsigned int gTargetPaddingElements, const unsigned int bTargetPaddingElements, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a R_G_B 24 bit frame.
Definition: FrameConverterRGB24.h:864
static void convertRGB24FullRangeToY_U_V12FullRange(const uint8_t *source, uint8_t *yTarget, uint8_t *uTarget, uint8_t *vTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uTargetPaddingElements, const unsigned int vTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a full range Y_U_V12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:781
static void convertRGB24ToBGR24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a BGR 24 bit frame.
Definition: FrameConverterRGB24.h:407
static void convertRGB24FullRangeToY_UV12LimitedRange(const uint8_t *source, uint8_t *yTarget, uint8_t *uvTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uvTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a limited range Y_UV12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:533
static void convertRGB24FullRangeToY_U_V12LimitedRange(const uint8_t *source, uint8_t *yTarget, uint8_t *uTarget, uint8_t *vTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uTargetPaddingElements, const unsigned int vTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a limited range Y_U_V12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:725
static void changeRGB24ToBGR24Subset(uint8_t *frame, const unsigned int width, const unsigned int firstRow, const unsigned int numberRows)
Changes a subset of RGB 24 bit frame to a BGR 24 bit frame.
static void convertRGB24ToBGR32(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker)
Converts a RGB 24 bit frame to a BGR 32 bit frame.
Definition: FrameConverterRGB24.h:430
static void convertRGB24ToYUV24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a YUV 24 bit frame by the exact conversion.
Definition: FrameConverterRGB24.h:503
static void convertRGB24FullRangeToY_V_U12FullRange(const uint8_t *source, uint8_t *yTarget, uint8_t *vTarget, uint8_t *uTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int vTargetPaddingElements, const unsigned int uTargetPaddingElements, Worker *worker=nullptr)
Converts a full range RGB24 frame to a full range Y_V_U12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:830
static void convertRGB24ToRGBA32(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a RGBA 32 bit frame.
Definition: FrameConverterRGB24.h:474
static void convertRGB24ToYUV24RowPrecision7BitNEON(const uint8_t *source, uint8_t *target, const size_t size, const void *parameters)
Converts a RGB 24 bit row to a YUV 24 bit row by using NEON instructions.
static void convertRGB24ToY8(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a RGB frame to a gray scale frame.
Definition: FrameConverterRGB24.h:482
static void convertRGB24ToRGB32(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a RGB 32 bit frame.
Definition: FrameConverterRGB24.h:466
static void changeRGB24ToYUV24(uint8_t *frame, const unsigned int width, const unsigned int height, Worker *worker=nullptr)
Changes a RGB 24 bit frame to a YUV 24 bit frame by the exact conversion in place.
Definition: FrameConverterRGB24.h:837
static void convertRGB24ToBGRA32(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a RGB 24 bit frame to a BGRA 32 bit frame.
Definition: FrameConverterRGB24.h:444
static void changeRGB24ToYUV24Subset(uint8_t *frame, const unsigned int width, const unsigned int firstRow, const unsigned int numberRows)
Changes a subset of a RGB 24 bit frame to a YUV 24 bit frame by exact conversion.
static void convertRGB24ToYUV24Pixel(const uint8_t *rgb, uint8_t *yuv)
Converts one RGB 24 bit pixel to one YUV 24 bit pixel.
Definition: FrameConverterRGB24.h:851
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition: Caller.h:2876
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15