37 #if CONFIG_DIRAC_PARSE
39 typedef struct dirac_source_params {
51 uint16_t clean_height;
52 uint16_t clean_left_offset;
53 uint16_t clean_right_offset;
57 } dirac_source_params;
60 static const dirac_source_params dirac_source_parameters_defaults[] = {
61 { 640, 480, 2, 0, 0, 1, 1, 640, 480, 0, 0, 1, 0 },
62 { 176, 120, 2, 0, 0, 9, 2, 176, 120, 0, 0, 1, 1 },
63 { 176, 144, 2, 0, 1, 10, 3, 176, 144, 0, 0, 1, 2 },
64 { 352, 240, 2, 0, 0, 9, 2, 352, 240, 0, 0, 1, 1 },
65 { 352, 288, 2, 0, 1, 10, 3, 352, 288, 0, 0, 1, 2 },
66 { 704, 480, 2, 0, 0, 9, 2, 704, 480, 0, 0, 1, 1 },
67 { 704, 576, 2, 0, 1, 10, 3, 704, 576, 0, 0, 1, 2 },
68 { 720, 480, 1, 1, 0, 4, 2, 704, 480, 8, 0, 3, 1 },
69 { 720, 576, 1, 1, 1, 3, 3, 704, 576, 8, 0, 3, 2 },
71 { 1280, 720, 1, 0, 1, 7, 1, 1280, 720, 0, 0, 3, 3 },
72 { 1280, 720, 1, 0, 1, 6, 1, 1280, 720, 0, 0, 3, 3 },
73 { 1920, 1080, 1, 1, 1, 4, 1, 1920, 1080, 0, 0, 3, 3 },
74 { 1920, 1080, 1, 1, 1, 3, 1, 1920, 1080, 0, 0, 3, 3 },
75 { 1920, 1080, 1, 0, 1, 7, 1, 1920, 1080, 0, 0, 3, 3 },
76 { 1920, 1080, 1, 0, 1, 6, 1, 1920, 1080, 0, 0, 3, 3 },
77 { 2048, 1080, 0, 0, 1, 2, 1, 2048, 1080, 0, 0, 4, 4 },
78 { 4096, 2160, 0, 0, 1, 2, 1, 4096, 2160, 0, 0, 4, 4 },
80 { 3840, 2160, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 },
81 { 3840, 2160, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
82 { 7680, 4320, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 },
83 { 7680, 4320, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
87 static const AVRational dirac_preset_aspect_ratios[] = {
106 static const struct {
109 } pixel_range_presets[] = {
122 static const struct {
126 } dirac_color_presets[] = {
147 unsigned luma_depth = 8, luma_offset = 16;
149 int chroma_x_shift, chroma_y_shift;
259 luma_depth = pixel_range_presets[idx].bitdepth;
260 dsh->
color_range = pixel_range_presets[idx].color_range;
273 if ((dsh->
width % (1<<chroma_x_shift)) || (dsh->
height % (1<<chroma_y_shift))) {
275 av_log(log_ctx,
AV_LOG_ERROR,
"Dimensions must be an integer multiple of the chroma subsampling\n");
288 dsh->
colorspace = dirac_color_presets[idx].colorspace;
289 dsh->
color_trc = dirac_color_presets[idx].color_trc;
313 dsh->
colorspace = dirac_color_presets[idx].colorspace;
314 dsh->
color_trc = dirac_color_presets[idx].color_trc;
327 unsigned video_format, picture_coding_mode;
352 if (video_format > 20
U) {
358 dsh->
width = dirac_source_parameters_defaults[video_format].width;
359 dsh->
height = dirac_source_parameters_defaults[video_format].height;
360 dsh->
chroma_format = dirac_source_parameters_defaults[video_format].chroma_format;
361 dsh->
interlaced = dirac_source_parameters_defaults[video_format].interlaced;
362 dsh->
top_field_first = dirac_source_parameters_defaults[video_format].top_field_first;
363 dsh->
frame_rate_index = dirac_source_parameters_defaults[video_format].frame_rate_index;
364 dsh->
aspect_ratio_index = dirac_source_parameters_defaults[video_format].aspect_ratio_index;
365 dsh->
clean_width = dirac_source_parameters_defaults[video_format].clean_width;
366 dsh->
clean_height = dirac_source_parameters_defaults[video_format].clean_height;
367 dsh->
clean_left_offset = dirac_source_parameters_defaults[video_format].clean_left_offset;
368 dsh->
clean_right_offset = dirac_source_parameters_defaults[video_format].clean_right_offset;
369 dsh->
pixel_range_index = dirac_source_parameters_defaults[video_format].pixel_range_index;
370 dsh->
color_spec_index = dirac_source_parameters_defaults[video_format].color_spec_index;
374 ret = parse_source_parameters(dsh, &gb, log_ctx);
381 if (picture_coding_mode != 0) {
384 picture_coding_mode);
399 const uint8_t *buf,
size_t buf_size,
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
#define AV_PIX_FMT_YUV420P12
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
attribute_deprecated void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
AVColorTransferCharacteristic
Color Transfer Characteristic.
int av_dirac_parse_sequence_header(AVDiracSeqHeader **pdsh, const uint8_t *buf, size_t buf_size, void *log_ctx)
Parse a Dirac sequence header.
Interface to Dirac Decoder/Encoder.
AVColorSpace
YUV colorspace type.
AVColorRange
MPEG vs JPEG YUV range.
#define AV_PIX_FMT_YUV422P12
AVColorPrimaries
Chromaticity coordinates of the source primaries.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
#define AV_PIX_FMT_YUV444P10
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
the normal 2^n-1 "JPEG" YUV ranges
Libavcodec external API header.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits1(GetBitContext *s)
#define AV_PIX_FMT_YUV420P10
Rational number (pair of numerator and denominator).
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
the normal 219*2^(n-8) "MPEG" YUV ranges
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
static unsigned get_interleaved_ue_golomb(GetBitContext *gb)
AVPixelFormat
Pixel format.
const AVRational ff_mpeg12_frame_rate_tab[]