35 #if CONFIG_DIRAC_PARSE
37 typedef struct dirac_source_params {
40 uint8_t chroma_format;
43 uint8_t top_field_first;
45 uint8_t frame_rate_index;
46 uint8_t aspect_ratio_index;
49 uint16_t clean_height;
50 uint16_t clean_left_offset;
51 uint16_t clean_right_offset;
53 uint8_t pixel_range_index;
54 uint8_t color_spec_index;
55 } dirac_source_params;
58 static const dirac_source_params dirac_source_parameters_defaults[] = {
59 { 640, 480, 2, 0, 0, 1, 1, 640, 480, 0, 0, 1, 0 },
60 { 176, 120, 2, 0, 0, 9, 2, 176, 120, 0, 0, 1, 1 },
61 { 176, 144, 2, 0, 1, 10, 3, 176, 144, 0, 0, 1, 2 },
62 { 352, 240, 2, 0, 0, 9, 2, 352, 240, 0, 0, 1, 1 },
63 { 352, 288, 2, 0, 1, 10, 3, 352, 288, 0, 0, 1, 2 },
64 { 704, 480, 2, 0, 0, 9, 2, 704, 480, 0, 0, 1, 1 },
65 { 704, 576, 2, 0, 1, 10, 3, 704, 576, 0, 0, 1, 2 },
66 { 720, 480, 1, 1, 0, 4, 2, 704, 480, 8, 0, 3, 1 },
67 { 720, 576, 1, 1, 1, 3, 3, 704, 576, 8, 0, 3, 2 },
69 { 1280, 720, 1, 0, 1, 7, 1, 1280, 720, 0, 0, 3, 3 },
70 { 1280, 720, 1, 0, 1, 6, 1, 1280, 720, 0, 0, 3, 3 },
71 { 1920, 1080, 1, 1, 1, 4, 1, 1920, 1080, 0, 0, 3, 3 },
72 { 1920, 1080, 1, 1, 1, 3, 1, 1920, 1080, 0, 0, 3, 3 },
73 { 1920, 1080, 1, 0, 1, 7, 1, 1920, 1080, 0, 0, 3, 3 },
74 { 1920, 1080, 1, 0, 1, 6, 1, 1920, 1080, 0, 0, 3, 3 },
75 { 2048, 1080, 0, 0, 1, 2, 1, 2048, 1080, 0, 0, 4, 4 },
76 { 4096, 2160, 0, 0, 1, 2, 1, 4096, 2160, 0, 0, 4, 4 },
78 { 3840, 2160, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 },
79 { 3840, 2160, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
80 { 7680, 4320, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 },
81 { 7680, 4320, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
85 static const AVRational dirac_preset_aspect_ratios[] = {
104 static const struct {
107 } pixel_range_presets[] = {
120 static const struct {
124 } dirac_color_presets[] = {
145 unsigned luma_depth = 8, luma_offset = 16;
147 int chroma_x_shift, chroma_y_shift;
258 luma_depth = pixel_range_presets[idx].bitdepth;
259 dsh->
color_range = pixel_range_presets[idx].color_range;
275 if ((dsh->
width % (1<<chroma_x_shift)) || (dsh->
height % (1<<chroma_y_shift))) {
277 av_log(log_ctx,
AV_LOG_ERROR,
"Dimensions must be an integer multiple of the chroma subsampling\n");
290 dsh->
colorspace = dirac_color_presets[idx].colorspace;
291 dsh->
color_trc = dirac_color_presets[idx].color_trc;
315 dsh->
colorspace = dirac_color_presets[idx].colorspace;
316 dsh->
color_trc = dirac_color_presets[idx].color_trc;
324 const uint8_t *buf,
size_t buf_size,
329 unsigned video_format, picture_coding_mode;
354 if (video_format > 20
U) {
360 dsh->
width = dirac_source_parameters_defaults[video_format].width;
361 dsh->
height = dirac_source_parameters_defaults[video_format].height;
362 dsh->
chroma_format = dirac_source_parameters_defaults[video_format].chroma_format;
363 dsh->
interlaced = dirac_source_parameters_defaults[video_format].interlaced;
364 dsh->
top_field_first = dirac_source_parameters_defaults[video_format].top_field_first;
365 dsh->
frame_rate_index = dirac_source_parameters_defaults[video_format].frame_rate_index;
366 dsh->
aspect_ratio_index = dirac_source_parameters_defaults[video_format].aspect_ratio_index;
367 dsh->
clean_width = dirac_source_parameters_defaults[video_format].clean_width;
368 dsh->
clean_height = dirac_source_parameters_defaults[video_format].clean_height;
369 dsh->
clean_left_offset = dirac_source_parameters_defaults[video_format].clean_left_offset;
370 dsh->
clean_right_offset = dirac_source_parameters_defaults[video_format].clean_right_offset;
371 dsh->
pixel_range_index = dirac_source_parameters_defaults[video_format].pixel_range_index;
372 dsh->
color_spec_index = dirac_source_parameters_defaults[video_format].color_spec_index;
376 ret = parse_source_parameters(dsh, &gb, log_ctx);
383 if (picture_coding_mode != 0) {
386 picture_coding_mode);
401 const uint8_t *buf,
size_t buf_size,