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);
348 static void changeRGB24ToBGR24Subset(uint8_t* frame,
const unsigned int width,
const unsigned int firstRow,
const unsigned int numberRows);
357 static void changeRGB24ToYUV24Subset(uint8_t* frame,
const unsigned int width,
const unsigned int firstRow,
const unsigned int numberRows);
359 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
377 static OCEAN_FORCE_INLINE
void convert16PixelsRGB24ToYUV24Precision7BitNEON(
const uint8_t*
const source, uint8_t*
const target);
384 ocean_assert(source !=
nullptr && target !=
nullptr);
385 ocean_assert(width >= 1u && height >= 1u);
387 FrameChannels::addFirstChannelValue<uint8_t, 3u>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
392 ocean_assert(source !=
nullptr && target !=
nullptr);
393 ocean_assert(width >= 1u && height >= 1u);
395 FrameChannels::reverseChannelOrder<uint8_t, 3u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
401 ocean_assert(width != 0u && height != 0u);
415 ocean_assert(source !=
nullptr && target !=
nullptr);
416 ocean_assert(width >= 1u && height >= 1u);
422 constexpr
unsigned int shufflePattern = 0x012u;
424 FrameChannels::shuffleChannelsAndSetLastChannelValue<uint8_t, 3u, 4u, shufflePattern>(source, 0u, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
429 ocean_assert(source !=
nullptr && target !=
nullptr);
430 ocean_assert(width >= 1u && height >= 1u);
436 constexpr
unsigned int shufflePattern = 0x012u;
438 FrameChannels::shuffleChannelsAndSetLastChannelValue<uint8_t, 3u, 4u, shufflePattern>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
443 ocean_assert(source !=
nullptr && target !=
nullptr);
444 ocean_assert(width >= 1u && height >= 1u);
446 FrameChannels::transformGeneric<uint8_t, 3u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
451 ocean_assert(source !=
nullptr && target !=
nullptr);
452 ocean_assert(width >= 1u && height >= 1u);
454 FrameChannels::addLastChannelValue<uint8_t, 3u>(source, 0u, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
459 ocean_assert(source !=
nullptr && target !=
nullptr);
460 ocean_assert(width >= 1u && height >= 1u);
462 FrameChannels::addLastChannelValue<uint8_t, 3u>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
467 ocean_assert(source !=
nullptr && target !=
nullptr);
468 ocean_assert(width >= 1u && height >= 1u);
470 const unsigned int sourceStrideElements = width * 3u + sourcePaddingElements;
471 const unsigned int targetStrideElements = width + targetPaddingElements;
473 constexpr
unsigned int channelFactors[3] = {38u, 75u, 15u};
475 static_assert(channelFactors[0] + channelFactors[1] + channelFactors[2] == 128u,
"Invalid factors!");
477 constexpr
bool useFactorChannel0 = channelFactors[0] != 0u;
478 constexpr
bool useFactorChannel1 = channelFactors[1] != 0u;
479 constexpr
bool useFactorChannel2 = channelFactors[2] != 0u;
481 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
483 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag, CV::FrameChannels::convertRow3ChannelsTo1Channel8BitPerChannel7BitPrecision<useFactorChannel0, useFactorChannel1, useFactorChannel2>, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 1u>, areContinuous, channelFactors, worker);
488 ocean_assert(source !=
nullptr && target !=
nullptr);
489 ocean_assert(width >= 1u && height >= 1u);
491 const unsigned int sourceStrideElements = width * 3u + sourcePaddingElements;
492 const unsigned int targetStrideElements = width * 3u + targetPaddingElements;
494 #if defined(OCEAN_USE_HARDCODED_RGB24_TO_YUV24_CONVERTER) && OCEAN_HARDWARE_NEON_VERSION >= 10
498 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
FrameConverterRGB24::convertRGB24ToYUV24RowPrecision7BitNEON, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>,
nullptr, worker);
507 const int parameters[12] = {33, -19, 56, 64, -37, -47, 13, 56, -9, 16, 128, 128};
509 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
511 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
CV::FrameChannels::convertRow3ChannelsTo3Channels8BitPerChannel7BitPrecision, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>, areContinuous, parameters, worker);
518 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uvTarget !=
nullptr);
520 ocean_assert(width >= 2u && width % 2u == 0u);
521 ocean_assert(height >= 2u && height % 2u == 0u);
523 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
543 const int options[3 + 9 + 3] =
546 int(sourcePaddingElements), int(yTargetPaddingElements), int(uvTargetPaddingElements),
549 33, -19, 56, 64, -37, -47, 13, 56, -9,
566 ocean_assert(source !=
nullptr && yTarget !=
nullptr && vuTarget !=
nullptr);
568 ocean_assert(width >= 2u && width % 2u == 0u);
569 ocean_assert(height >= 2u && height % 2u == 0u);
571 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
591 const int options[3 + 9 + 3] =
594 int(sourcePaddingElements), int(yTargetPaddingElements), int(vuTargetPaddingElements),
597 33, 56, -19, 64, -47, -37, 13, -9, 56,
614 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uvTarget !=
nullptr);
616 ocean_assert(width >= 2u && width % 2u == 0u);
617 ocean_assert(height >= 2u && height % 2u == 0u);
619 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
639 const int options[3 + 9 + 3] =
642 int(sourcePaddingElements), int(yTargetPaddingElements), int(uvTargetPaddingElements),
645 38, -22, 64, 75, -42, -54, 15, 64, -10,
662 ocean_assert(source !=
nullptr && yTarget !=
nullptr && vuTarget !=
nullptr);
664 ocean_assert(width >= 2u && width % 2u == 0u);
665 ocean_assert(height >= 2u && height % 2u == 0u);
667 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
687 const int options[3 + 9 + 3] =
690 int(sourcePaddingElements), int(yTargetPaddingElements), int(vuTargetPaddingElements),
693 38, 64, -22, 75, -54, -42, 15, -10, 64,
708 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)
710 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uTarget !=
nullptr && vTarget !=
nullptr);
712 ocean_assert(width >= 2u && width % 2u == 0u);
713 ocean_assert(height >= 2u && height % 2u == 0u);
715 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
735 const int options[4 + 9 + 3] =
738 int(sourcePaddingElements), int(yTargetPaddingElements), int(uTargetPaddingElements), int(vTargetPaddingElements),
741 33, -19, 56, 64, -37, -47, 13, 56, -9,
757 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)
761 convertRGB24FullRangeToY_U_V12LimitedRange(source, yTarget, uTarget, vTarget, width, height, flag, sourcePaddingElements, yTargetPaddingElements, uTargetPaddingElements, vTargetPaddingElements, worker);
764 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)
766 ocean_assert(source !=
nullptr && yTarget !=
nullptr && uTarget !=
nullptr && vTarget !=
nullptr);
768 ocean_assert(width >= 2u && width % 2u == 0u);
769 ocean_assert(height >= 2u && height % 2u == 0u);
771 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
791 const int options[4 + 9 + 3] =
794 int(sourcePaddingElements), int(yTargetPaddingElements), int(uTargetPaddingElements), int(vTargetPaddingElements),
797 38, -22, 64, 75, -42, -54, 15, 64, -10,
813 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)
817 convertRGB24FullRangeToY_U_V12FullRange(source, yTarget, uTarget, vTarget, width, height, flag, sourcePaddingElements, yTargetPaddingElements, uTargetPaddingElements, vTargetPaddingElements, worker);
836 ocean_assert(rgb && yuv);
838 yuv[0] = uint8_t(((rgb[0] * 66 + rgb[1] * 129 + rgb[2] * 25 + 128) >> 8) + 16);
839 yuv[1] = uint8_t(((rgb[0] * -38 - rgb[1] * 74 + rgb[2] * 112 + 128) >> 8) + 128);
840 yuv[2] = uint8_t(((rgb[0] * 112 - rgb[1] * 94 - rgb[2] * 18 + 128) >> 8) + 128);
842 ocean_assert(abs(
int(yuv[0]) -
int(((rgb[0] * 66 + rgb[1] * 129 + rgb[2] * 25 + 128) / 256) + 16)) <= 1);
843 ocean_assert(abs(
int(yuv[1]) -
int(((rgb[0] * -38 - rgb[1] * 74 + rgb[2] * 112 + 128) / 256) + 128)) <= 1);
844 ocean_assert(abs(
int(yuv[2]) -
int(((rgb[0] * 112 - rgb[1] * 94 - rgb[2] * 18 + 128) / 256) + 128)) <= 1);
847 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
851 ocean_assert(source !=
nullptr && target !=
nullptr);
871 const uint8x16x3_t source_u_8x16x3 = vld3q_u8(source);
873 const uint8x8_t source0_low_u_8x8 = vget_low_u8(source_u_8x16x3.val[0]);
874 const uint8x8_t source0_high_u_8x8 = vget_high_u8(source_u_8x16x3.val[0]);
876 const uint8x8_t source1_low_u_8x8 = vget_low_u8(source_u_8x16x3.val[1]);
877 const uint8x8_t source1_high_u_8x8 = vget_high_u8(source_u_8x16x3.val[1]);
879 const uint8x8_t source2_low_u_8x8 = vget_low_u8(source_u_8x16x3.val[2]);
880 const uint8x8_t source2_high_u_8x8 = vget_high_u8(source_u_8x16x3.val[2]);
883 const uint8x8_t constant33_u_8x8 = vdup_n_u8(33);
884 uint16x8_t intermediateResults0_low_u_16x8 = vmull_u8(source0_low_u_8x8, constant33_u_8x8);
885 uint16x8_t intermediateResults0_high_u_16x8 = vmull_u8(source0_high_u_8x8, constant33_u_8x8);
887 const uint8x8_t constant64_u_8x8 = vdup_n_u8(64);
888 intermediateResults0_low_u_16x8 = vmlal_u8(intermediateResults0_low_u_16x8, source1_low_u_8x8, constant64_u_8x8);
889 intermediateResults0_high_u_16x8 = vmlal_u8(intermediateResults0_high_u_16x8, source1_high_u_8x8, constant64_u_8x8);
891 const uint8x8_t constant13_u_8x8 = vdup_n_u8(13);
892 intermediateResults0_low_u_16x8 = vmlal_u8(intermediateResults0_low_u_16x8, source2_low_u_8x8, constant13_u_8x8);
893 intermediateResults0_high_u_16x8 = vmlal_u8(intermediateResults0_high_u_16x8, source2_high_u_8x8, constant13_u_8x8);
896 const uint8x8_t constant56_u_8x8 = vdup_n_u8(56);
897 uint16x8_t intermediateResults1_low_u_16x8 = vmull_u8(source2_low_u_8x8, constant56_u_8x8);
898 uint16x8_t intermediateResults1_high_u_16x8 = vmull_u8(source2_high_u_8x8, constant56_u_8x8);
900 uint16x8_t intermediateResults2_low_u_16x8 = vmull_u8(source0_low_u_8x8, constant56_u_8x8);
901 uint16x8_t intermediateResults2_high_u_16x8 = vmull_u8(source0_high_u_8x8, constant56_u_8x8);
904 const uint8x8_t constant19_u_8x8 = vdup_n_u8(19);
905 intermediateResults1_low_u_16x8 = vmlsl_u8(intermediateResults1_low_u_16x8, source0_low_u_8x8, constant19_u_8x8);
906 intermediateResults1_high_u_16x8 = vmlsl_u8(intermediateResults1_high_u_16x8, source0_high_u_8x8, constant19_u_8x8);
908 const uint8x8_t constant37_u_8x8 = vdup_n_u8(37);
909 intermediateResults1_low_u_16x8 = vmlsl_u8(intermediateResults1_low_u_16x8, source1_low_u_8x8, constant37_u_8x8);
910 intermediateResults1_high_u_16x8 = vmlsl_u8(intermediateResults1_high_u_16x8, source1_high_u_8x8, constant37_u_8x8);
913 const uint8x8_t constant47_u_8x8 = vdup_n_u8(47);
914 intermediateResults2_low_u_16x8 = vmlsl_u8(intermediateResults2_low_u_16x8, source1_low_u_8x8, constant47_u_8x8);
915 intermediateResults2_high_u_16x8 = vmlsl_u8(intermediateResults2_high_u_16x8, source1_high_u_8x8, constant47_u_8x8);
917 const uint8x8_t constant9_u_8x8 = vdup_n_u8(9);
918 intermediateResults2_low_u_16x8 = vmlsl_u8(intermediateResults2_low_u_16x8, source2_low_u_8x8, constant9_u_8x8);
919 intermediateResults2_high_u_16x8 = vmlsl_u8(intermediateResults2_high_u_16x8, source2_high_u_8x8, constant9_u_8x8);
922 const int16x8_t constant16_s_16x8 = vdupq_n_s16(16 * 128);
923 const int16x8_t constant128_s_16x8 = vdupq_n_s16(128 * 128);
925 const int16x8_t intermediateResults0_low_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults0_low_u_16x8), constant16_s_16x8);
926 const int16x8_t intermediateResults0_high_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults0_high_u_16x8), constant16_s_16x8);
928 const int16x8_t intermediateResults1_low_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults1_low_u_16x8), constant128_s_16x8);
929 const int16x8_t intermediateResults1_high_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults1_high_u_16x8), constant128_s_16x8);
931 const int16x8_t intermediateResults2_low_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults2_low_u_16x8), constant128_s_16x8);
932 const int16x8_t intermediateResults2_high_s_16x8 = vqaddq_s16(vreinterpretq_s16_u16(intermediateResults2_high_u_16x8), constant128_s_16x8);
936 uint8x16x3_t results_u_8x16x3;
937 results_u_8x16x3.val[0] = vcombine_u8(vqrshrun_n_s16(intermediateResults0_low_s_16x8, 7), vqrshrun_n_s16(intermediateResults0_high_s_16x8, 7));
938 results_u_8x16x3.val[1] = vcombine_u8(vqrshrun_n_s16(intermediateResults1_low_s_16x8, 7), vqrshrun_n_s16(intermediateResults1_high_s_16x8, 7));
939 results_u_8x16x3.val[2] = vcombine_u8(vqrshrun_n_s16(intermediateResults2_low_s_16x8, 7), vqrshrun_n_s16(intermediateResults2_high_s_16x8, 7));
942 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:3160
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:3183
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:660
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:398
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:441
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:564
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:612
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:849
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 full range Y_V_U12 frame with 7-bit precision using BT....
Definition: FrameConverterRGB24.h:757
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:382
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:764
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:390
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:516
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:708
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:413
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:486
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:813
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:457
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:465
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:449
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:820
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:427
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:834
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