Ocean
Loading...
Searching...
No Matches
FrameConverterYUVA32.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_CV_FRAME_CONVERTER_YUVA_32_H
9#define META_OCEAN_CV_FRAME_CONVERTER_YUVA_32_H
10
11#include "ocean/cv/CV.h"
14
15#include "ocean/base/Worker.h"
16
17namespace Ocean
18{
19
20namespace CV
21{
22
23/**
24 * This class provides functions to convert frames with YUVA32 pixel format to other pixel formats.
25 * @ingroup cv
26 */
27class OCEAN_CV_EXPORT FrameConverterYUVA32 : public FrameConverter
28{
29 public:
30
31 /**
32 * Converts a YUVA 32 bit frame to a Y 8 bit frame using the exact conversion.
33 * @param source The source frame buffer, must be valid
34 * @param target The target frame buffer, must be valid
35 * @param width The width of the frame in pixel, with range [1, infinity)
36 * @param height The height of the frame in pixel, with range [1, infinity)
37 * @param flag Determining the type of conversion
38 * @param sourcePaddingElements The number of padding elements at the end of each source row, in elements, with range [0, infinity)
39 * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
40 * @param worker Optional worker object to distribute the computation
41 */
42 static inline void convertYUVA32ToY8(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);
43};
44
45inline void FrameConverterYUVA32::convertYUVA32ToY8(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)
46{
47 ocean_assert(source != nullptr && target != nullptr);
48 ocean_assert(width >= 1u && height >= 1u);
49
50 // source frame Y U V A
51 // 0 1 2 3
52 // target frame Y
53 // pattern 0
54
55 constexpr unsigned int shufflePattern = 0x0u;
56
57 FrameChannels::shuffleChannels<uint8_t, 4u, 1u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
58}
59
60}
61
62}
63
64#endif // META_OCEAN_CV_FRAME_CONVERTER_YUVA_32_H
This is the base class for all frame converter classes.
Definition FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition FrameConverter.h:39
This class provides functions to convert frames with YUVA32 pixel format to other pixel formats.
Definition FrameConverterYUVA32.h:28
static void convertYUVA32ToY8(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 YUVA 32 bit frame to a Y 8 bit frame using the exact conversion.
Definition FrameConverterYUVA32.h:45
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
The namespace covering the entire Ocean framework.
Definition Accessor.h:15