1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*! @file sections.h
*
* @brief Declaration of routines for handling sections in the encoder.
*
* (C) Copyright 2018 GoPro Inc (http://gopro.com/).
*
* Licensed under either:
* - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
* - MIT license, http://opensource.org/licenses/MIT
* at your option.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SECTIONS_H
#define SECTIONS_H
/*
@brief Enumeration of the predefined section numbers
The predefined section numbers are defined in ST 2073-2.
*/
typedef enum _section_number
{
SECTION_NUMBER_IMAGE = 1, //!< Image section
SECTION_NUMBER_HEADER = 2, //!< Bitstream header section
SECTION_NUMBER_LAYER = 3, //!< Layer section
SECTION_NUMBER_CHANNEL = 4, //!< Channel section
SECTION_NUMBER_WAVELET = 5, //!< Wavelet section
SECTION_NUMBER_SUBBAND = 6, //!< Subband section
//TODO: Add more section number definitions as required
//! Modify the smallest and largest section numbers as more sections are added
SECTION_NUMBER_MINIMUM = SECTION_NUMBER_IMAGE,
SECTION_NUMBER_MAXIMUM = SECTION_NUMBER_SUBBAND,
} SECTION_NUMBER;
/*
@Macro for creating a section number bit mask from a section number
The macro does not check that the section number argument is valid.
*/
#define SECTION_NUMBER_MASK(section_number) (1 << (section_number - 1))
/*
@brief Data type for the bit mask that represents enabled sections
The bit mask indicates which section numbers defined in ST 2073-2 are enabled
at runtime.
*/
typedef uint32_t ENABLED_SECTIONS;
#define VC5_ENABLED_SECTIONS (SECTION_NUMBER_MASK(SECTION_NUMBER_CHANNEL) | \
SECTION_NUMBER_MASK(SECTION_NUMBER_WAVELET) | \
SECTION_NUMBER_MASK(SECTION_NUMBER_SUBBAND))
#ifdef __cplusplus
extern "C" {
#endif
bool IsSectionEnabled(struct _encoder *encoder, SECTION_NUMBER section_number);
CODEC_ERROR BeginSection(BITSTREAM *bitstream, TAGWORD tag);
CODEC_ERROR EndSection(BITSTREAM *bitstream);
CODEC_ERROR BeginImageSection(struct _encoder *encoder, BITSTREAM *stream);
CODEC_ERROR BeginHeaderSection(struct _encoder *encoder, BITSTREAM *stream);
CODEC_ERROR BeginLayerSection(struct _encoder *encoder, BITSTREAM *stream);
CODEC_ERROR BeginChannelSection(struct _encoder *encoder, BITSTREAM *stream);
CODEC_ERROR BeginWaveletSection(struct _encoder *encoder, BITSTREAM *stream);
CODEC_ERROR BeginSubbandSection(struct _encoder *encoder, BITSTREAM *stream);
bool GetEnabledSections(const char *string, uint32_t *enabled_sections_out);
#ifdef __cplusplus
}
#endif
#endif // SECTIONS_H
|