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;
260 luma_depth = pixel_range_presets[idx].bitdepth;
261 dsh->
color_range = pixel_range_presets[idx].color_range;
277 if ((dsh->
width % (1<<chroma_x_shift)) || (dsh->
height % (1<<chroma_y_shift))) {
279 av_log(log_ctx,
AV_LOG_ERROR,
"Dimensions must be an integer multiple of the chroma subsampling\n");
292 dsh->
colorspace = dirac_color_presets[idx].colorspace;
293 dsh->
color_trc = dirac_color_presets[idx].color_trc;
317 dsh->
colorspace = dirac_color_presets[idx].colorspace;
318 dsh->
color_trc = dirac_color_presets[idx].color_trc;
326 const uint8_t *buf,
size_t buf_size,
331 unsigned video_format, picture_coding_mode;
356 if (video_format > 20
U) {
362 dsh->
width = dirac_source_parameters_defaults[video_format].width;
363 dsh->
height = dirac_source_parameters_defaults[video_format].height;
364 dsh->
chroma_format = dirac_source_parameters_defaults[video_format].chroma_format;
365 dsh->
interlaced = dirac_source_parameters_defaults[video_format].interlaced;
366 dsh->
top_field_first = dirac_source_parameters_defaults[video_format].top_field_first;
367 dsh->
frame_rate_index = dirac_source_parameters_defaults[video_format].frame_rate_index;
368 dsh->
aspect_ratio_index = dirac_source_parameters_defaults[video_format].aspect_ratio_index;
369 dsh->
clean_width = dirac_source_parameters_defaults[video_format].clean_width;
370 dsh->
clean_height = dirac_source_parameters_defaults[video_format].clean_height;
371 dsh->
clean_left_offset = dirac_source_parameters_defaults[video_format].clean_left_offset;
372 dsh->
clean_right_offset = dirac_source_parameters_defaults[video_format].clean_right_offset;
373 dsh->
pixel_range_index = dirac_source_parameters_defaults[video_format].pixel_range_index;
374 dsh->
color_spec_index = dirac_source_parameters_defaults[video_format].color_spec_index;
378 ret = parse_source_parameters(dsh, &gb, log_ctx);
385 if (picture_coding_mode != 0) {
388 picture_coding_mode);
403 const uint8_t *buf,
size_t buf_size,