23 static const SEGMENT StartMarkerSegment = ((0x56 << 24) | (0x43 << 16) | (0x2D << 8) | 0x35);
74 #
if VC5_ENABLED_PART(VC5_PART_IMAGE_FORMATS)
90 #if VC5_ENABLED_PART(VC5_PART_LAYERS) 96 #if VC5_ENABLED_PART(VC5_PART_SECTIONS) 109 #if VC5_ENABLED_PART(VC5_PART_METADATA) 117 #if VC5_ENABLED_PART(VC5_PART_IMAGE_FORMATS) 142 #if VC5_ENABLED_PART(VC5_PART_SECTIONS) 171 #define SECTION_NUMBER_MASK(section_number) (1 << (section_number - 1)) 179 typedef uint32_t ENABLED_SECTIONS;
197 BAND_ENCODING_ZEROTREE = 1,
198 BAND_ENCODING_CODEBOOK,
199 BAND_ENCODING_RUNLENGTHS,
201 BAND_ENCODING_LOSSLESS
231 #if VC5_ENABLED_PART(VC5_PART_IMAGE_FORMATS) 239 #if VC5_ENABLED_PART(VC5_PART_LAYERS) 326 #if VC5_ENABLED_PART(VC5_PART_LAYERS) 340 #if VC5_ENABLED_PART(VC5_PART_SECTIONS) 370 uint32_t RepackedEncoderVersion(uint32_t value);
374 #if VC5_ENABLED_PART(VC5_PART_IMAGE_FORMATS) 394 #if VC5_ENABLED_PART(VC5_PART_IMAGE_FORMATS) 400 #if VC5_ENABLED_PART(VC5_PART_SECTIONS) int height
Height of the current layer.
Definition: codec.h:334
struct _codec CODEC
Fields that are common to the encoder and decoder.
enum _image_format IMAGE_FORMAT
Format of the encoded sample.
bool end_of_sample
Indicates that enough of the sample has been read to allow decoding the sample.
Definition: codec.h:272
uint_least8_t channel_count
Number of channels in the current layer.
Definition: codec.h:246
CODEC_ERROR error
Error code from the most recent codec operation.
Definition: codec.h:354
Mask for detecting the tag for a small or large chunk (including codeblocks)
Definition: codec.h:72
bool codeblock
Most recent syntax element was a codeblock (large chunk element)
Definition: codec.h:281
Packed prescale shift for each wavelet level.
Definition: codec.h:57
struct _codec_state::@2 input
Information about the packed image input to the encoder (for debugging)
bool IsImageSectionEnabled(ENABLED_PARTS enabled_parts, ENABLED_SECTIONS enabled_sections)
Return true if image sections are enabled.
Definition: codec.c:443
Section that contains a single layer.
Definition: codec.h:103
RGB image with optional alpha channel.
Definition: codec.h:128
The image format has not been specified.
Definition: codec.h:127
Small chunk with a 16-bit payload size (in segments)
Definition: codec.h:68
Unique number assigned to an image bitstream section.
Definition: codec.h:98
DIMENSION channel_width
Width of the next channel in the bitstream.
Definition: codec.h:225
Small chunk containing metadata tuples (VC-5 Part 7)
Definition: codec.h:111
uint32_t encoded_format
Internal encoded representation.
Definition: codec.h:253
Small chunk containing the inverse component permutation.
Definition: codec.h:84
int LowpassChannelOffset(CODEC_STATE *codec, PIXEL_FORMAT output_format)
Compute the channel offset added to each lowpass pixel value.
Definition: codec.c:322
Number of image bitstream sections in the bitstream.
Definition: codec.h:97
int16_t TAGWORD
Bitstream tag or value.
Definition: syntax.h:27
Bayer image format (special case of CFA)
Definition: codec.h:130
bool difference_coding
Enables or disables differential coding.
Definition: codec.h:268
size_t channel_position
The channel position is used for skipping subbands and jumping to particular channels.
Definition: codec.h:251
IMAGE_FORMAT DefaultImageFormat(PIXEL_FORMAT pixel_format)
Set the image format using the pixel format.
Definition: codec.c:118
uint16_t channel_number
Index of current channel being decoded.
Definition: codec.h:224
ALLOCATOR * allocator
Memory allocator used to allocate all dyynamic data.
Definition: codec.h:355
uint8_t active_codebook
Non-zero value indicates which codebook is used.
Definition: codec.h:267
YCbCr image with optional alpha channel.
Definition: codec.h:129
Number of the next layer in the bitstream.
Definition: codec.h:92
Small chunk containing the identifier and sequence number for the image.
Definition: codec.h:87
Number of components in each sample in the pattern element.
Definition: codec.h:78
Number of layers in the bitstream.
Definition: codec.h:91
Modify the smallest and largest section numbers as more sections are added.
Definition: codec.h:161
uint_least16_t DIMENSION
Data type for image and frame dimensions.
Definition: types.h:24
struct _codec_state::_picture_aspect_ratio picture_aspect_ratio
Picture aspect ratio read from the sample.
Section that contains a single image.
Definition: codec.h:101
bool progressive
True if the encoded frame is progressive.
Definition: codec.h:258
DIMENSION image_width
Upper bound on the channel width.
Definition: codec.h:294
Channel section.
Definition: codec.h:154
Fields that are common to the encoder and decoder.
Definition: codec.h:351
uint16_t subband_number
Index of current subband being decoded.
Definition: codec.h:229
ENABLED_PARTS enabled_parts
Parts of the VC-5 standard that are supported at runtime by the codec implementation.
Definition: codec.h:360
int EncodedPrecision(PIXEL_FORMAT format)
Return the encoded precision for an input pixel format.
Definition: codec.c:179
Pixel fomrat of the packed input image.
Definition: codec.h:63
CODEC_ERROR UpdatePrescaleTable(CODEC_STATE *codec, TAGWORD value)
Unpack the tag value into the prescale table.
Definition: codec.c:261
Upper bound on the width of the image.
Definition: codec.h:48
Upper bound on the height of the image.
Definition: codec.h:49
Channel number.
Definition: codec.h:53
void SetCodecVersion(uint8_t version[3], uint16_t value)
Unpack the version tag value into its components.
Definition: codec.c:94
Small chunk containing the inverse component transform (8 bit representation)
Definition: codec.h:85
Wavelet section.
Definition: codec.h:155
Section that contains all subbands for one wavelet.
Definition: codec.h:105
uint32_t decoded_layer_mask
Indicates which layers have been decoded.
Definition: codec.h:243
uint_least8_t subband_count
Number of suibbands in the current layer.
Definition: codec.h:248
PRECISION lowpass_precision
Number of bits per lowpass coefficient.
Definition: codec.h:297
Number of encoded subbands.
Definition: codec.h:52
uint_least8_t group_length
Number of frames in a group of pictures (GOP)
Definition: codec.h:264
Generic color filter array (CFA) image.
Definition: codec.h:131
uint16_t PRESCALE
Integer value for the amount of prescale shift.
Definition: types.h:45
uint_least8_t wavelet_count
Number of wavelets in the current layer.
Definition: codec.h:247
PRECISION bits_per_component
Precision of the component array (in bits)
Definition: codec.h:227
VERSION version
Codec version (major, minor, revision, build)
Definition: codec.h:357
DIMENSION pattern_width
Width of the pattern elements (in samples)
Definition: codec.h:233
Height of the next channel in the bitstream.
Definition: codec.h:59
CODEC_STATE codec
Information gathered while decoding the current sample.
Definition: codec.h:356
bool IsPartEnabled(ENABLED_PARTS enabled_parts, int part_number)
Return true if the specified part is enabled at runtime.
Definition: codec.c:415
Section that contains a single channel.
Definition: codec.h:104
CODEC_ERROR SetBandCoding(CODEC_STATE *codec, TAGWORD value)
Set the flags that determine the band coding.
Definition: codec.c:397
Quantization applied to band.
Definition: codec.h:56
Mask indicating the use cases in the bitstream.
Definition: codec.h:93
struct _codec_state::@3 layer
< Parameters of the current layer
Large chunk containing metadata tuples (VC-5 Part 7)
Definition: codec.h:112
Bitstream header section.
Definition: codec.h:152
const char * ImageFormatString(IMAGE_FORMAT image_format)
Return a string for the name of the image format.
Definition: codec.c:152
band_encoding
Band encoding method.
Definition: codec.h:196
DIMENSION image_height
Upper bound on the channel height.
Definition: codec.h:295
Large chunk with a 24-bit payload size (in segments)
Definition: codec.h:69
Format of the image represented by the bitstream.
Definition: codec.h:79
Section that contains the bitstream header.
Definition: codec.h:102
Section that contains a single subband.
Definition: codec.h:106
DIMENSION channel_height
Height of the next channel in the bitstream.
Definition: codec.h:226
uint16_t quantization
Quantization parameter.
Definition: codec.h:290
uint_least16_t COUNT
Data type for an unsigned number (count) that can be the value in a tag-value pair.
Definition: types.h:27
int InputPrecision(PIXEL_FORMAT format)
Return the precision of a pixel format.
Definition: codec.c:211
Number of bits in the source image.
Definition: codec.h:50
Number of channels in the transform.
Definition: codec.h:51
DIMENSION pattern_height
Height of the pattern elements (in rows)
Definition: codec.h:234
enum _pixel_format PIXEL_FORMAT
Pixels formats supported by the codec.
bool end_of_layer
Indicates that the layer has been decoded.
Definition: codec.h:275
Subband number of this wavelet band.
Definition: codec.h:54
uint_least16_t x
Relative width of the picture.
Definition: codec.h:321
uint32_t decoded_subband_mask
Indicates which subbands have been decoded.
Definition: codec.h:256
Subband section.
Definition: codec.h:156
uint16_t layer_pattern
Indicates the use case for layers in the bitstream.
Definition: codec.h:242
Width of the next channel in the bitstream.
Definition: codec.h:58
Image section.
Definition: codec.h:151
enum _codec_tag CODEC_TAG
Tags that define elements in the bitstream.
uint_least8_t PRECISION
Number of bits in a component value.
Definition: types.h:51
Number of bits per lowpass coefficient.
Definition: codec.h:55
struct _codec_state::@1 band
Parameters of the most recently decoded subband.
CODEC_ERROR UpdateFrameStructureFlags(CODEC_STATE *codec, TAGWORD value)
Update the flags that describe the frame structure.
Definition: codec.c:288
bool top_field_first
True if the top field is encoded first.
Definition: codec.h:260
PRECISION max_bits_per_component
Maximum number of bits for each value in the component arrays.
Definition: codec.h:236
Large chunk that contains a codeblock.
Definition: codec.h:66
struct _codec_state CODEC_STATE
CODEC_ERROR PrepareCodecState(CODEC_STATE *codec)
Initialize the codec state to before encoding or decoding the bitstream.
Definition: codec.c:36
Codec version number (major, minor, revision, build)
Definition: types.h:80
bool frame_inverted
True if the frame is encoded upside down.
Definition: codec.h:262
int section_number
Number of the most recent section encountered in the bitstream.
Definition: codec.h:341
COUNT layer_number
Number of the next layer in the bitstream.
Definition: codec.h:241
DIMENSION components_per_sample
Number of components in each sample in the pattern element.
Definition: codec.h:235
enum _codec_error CODEC_ERROR
Codec error codes.
void * ALLOCATOR
Opaque data type for the default memory allocator.
Definition: allocator.h:20
uint32_t encoded_quality
Quality setting of the encoded video.
Definition: codec.h:254
Number of image formats that have been defined.
Definition: codec.h:136
Number of rows of samples in each pattern element.
Definition: codec.h:77
int section_length
Length of the most recent section element payload (in segments)
Definition: codec.h:342
_codec_tag
Tags that define elements in the bitstream.
Definition: codec.h:46
_image_format
Format of the encoded sample.
Definition: codec.h:125
uint32_t EncoderVersion(uint32_t value)
Reformat a segment value into the encoder version.
Definition: codec.c:84
_section_number
Definition: codec.h:149
bool header
Most recent tag-value pair was a header parameter.
Definition: codec.h:278
Small chunk containing vendor-specific data.
Definition: codec.h:83
PIXEL_FORMAT format
Pixel format of the input image.
Definition: codec.h:303
COUNT layer_count
Number of layers in the bitstream.
Definition: codec.h:240
uint_least16_t y
Relative height of the picture.
Definition: codec.h:322
bool IsSectionEnabled(ENABLED_SECTIONS enabled_sections, SECTION_NUMBER section_number)
Return true if the specified type of section is enabled.
Definition: codec.c:426
Picture aspect ratio read from the encoded sample.
Definition: codec.h:319
Small chunk containing the inverse component transform (16 bit representation)
Definition: codec.h:86
int width
Width of the current layer.
Definition: codec.h:333
uint32_t SEGMENT
The bitstream is a sequence of segments.
Definition: syntax.h:25
IMAGE_FORMAT image_format
Format of the image represented by the bitstream.
Definition: codec.h:232
Number of samples per row in each pattern element.
Definition: codec.h:76
uint_least8_t subband
Subband index.
Definition: codec.h:288
Upper bound on the number of bits per component.
Definition: codec.h:80
uint32_t ENABLED_PARTS
Data type for the bit mask that represents enabled parts.
Definition: types.h:70
FILE * logfile
File for writing debugging information.
Definition: codec.h:353
PRESCALE prescale_table[MAX_WAVELET_COUNT]
Table of prescale shifts applied before computing each wavelet transform.
Definition: codec.h:316
Layer section.
Definition: codec.h:153