38 #if CONFIG_DIRAC_PARSE
40 typedef struct dirac_source_params {
43 uint8_t chroma_format;
46 uint8_t top_field_first;
48 uint8_t frame_rate_index;
49 uint8_t aspect_ratio_index;
52 uint16_t clean_height;
53 uint16_t clean_left_offset;
54 uint16_t clean_right_offset;
56 uint8_t pixel_range_index;
57 uint8_t color_spec_index;
58 } dirac_source_params;
61 static const dirac_source_params dirac_source_parameters_defaults[] = {
62 { 640, 480, 2, 0, 0, 1, 1, 640, 480, 0, 0, 1, 0 },
63 { 176, 120, 2, 0, 0, 9, 2, 176, 120, 0, 0, 1, 1 },
64 { 176, 144, 2, 0, 1, 10, 3, 176, 144, 0, 0, 1, 2 },
65 { 352, 240, 2, 0, 0, 9, 2, 352, 240, 0, 0, 1, 1 },
66 { 352, 288, 2, 0, 1, 10, 3, 352, 288, 0, 0, 1, 2 },
67 { 704, 480, 2, 0, 0, 9, 2, 704, 480, 0, 0, 1, 1 },
68 { 704, 576, 2, 0, 1, 10, 3, 704, 576, 0, 0, 1, 2 },
69 { 720, 480, 1, 1, 0, 4, 2, 704, 480, 8, 0, 3, 1 },
70 { 720, 576, 1, 1, 1, 3, 3, 704, 576, 8, 0, 3, 2 },
72 { 1280, 720, 1, 0, 1, 7, 1, 1280, 720, 0, 0, 3, 3 },
73 { 1280, 720, 1, 0, 1, 6, 1, 1280, 720, 0, 0, 3, 3 },
74 { 1920, 1080, 1, 1, 1, 4, 1, 1920, 1080, 0, 0, 3, 3 },
75 { 1920, 1080, 1, 1, 1, 3, 1, 1920, 1080, 0, 0, 3, 3 },
76 { 1920, 1080, 1, 0, 1, 7, 1, 1920, 1080, 0, 0, 3, 3 },
77 { 1920, 1080, 1, 0, 1, 6, 1, 1920, 1080, 0, 0, 3, 3 },
78 { 2048, 1080, 0, 0, 1, 2, 1, 2048, 1080, 0, 0, 4, 4 },
79 { 4096, 2160, 0, 0, 1, 2, 1, 4096, 2160, 0, 0, 4, 4 },
81 { 3840, 2160, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 },
82 { 3840, 2160, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
83 { 7680, 4320, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 },
84 { 7680, 4320, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
88 static const AVRational dirac_preset_aspect_ratios[] = {
100 static const AVRational dirac_frame_rate[] = {
107 static const struct {
110 } pixel_range_presets[] = {
123 static const struct {
127 } dirac_color_presets[] = {
148 unsigned luma_depth = 8, luma_offset = 16;
150 int chroma_x_shift, chroma_y_shift;
261 luma_depth = pixel_range_presets[idx].bitdepth;
262 dsh->
color_range = pixel_range_presets[idx].color_range;
278 if ((dsh->
width % (1<<chroma_x_shift)) || (dsh->
height % (1<<chroma_y_shift))) {
280 av_log(log_ctx,
AV_LOG_ERROR,
"Dimensions must be an integer multiple of the chroma subsampling\n");
293 dsh->
colorspace = dirac_color_presets[idx].colorspace;
294 dsh->
color_trc = dirac_color_presets[idx].color_trc;
318 dsh->
colorspace = dirac_color_presets[idx].colorspace;
319 dsh->
color_trc = dirac_color_presets[idx].color_trc;
327 const uint8_t *buf,
size_t buf_size,
332 unsigned video_format, picture_coding_mode;
357 if (video_format > 20
U) {
363 dsh->
width = dirac_source_parameters_defaults[video_format].width;
364 dsh->
height = dirac_source_parameters_defaults[video_format].height;
365 dsh->
chroma_format = dirac_source_parameters_defaults[video_format].chroma_format;
366 dsh->
interlaced = dirac_source_parameters_defaults[video_format].interlaced;
367 dsh->
top_field_first = dirac_source_parameters_defaults[video_format].top_field_first;
368 dsh->
frame_rate_index = dirac_source_parameters_defaults[video_format].frame_rate_index;
369 dsh->
aspect_ratio_index = dirac_source_parameters_defaults[video_format].aspect_ratio_index;
370 dsh->
clean_width = dirac_source_parameters_defaults[video_format].clean_width;
371 dsh->
clean_height = dirac_source_parameters_defaults[video_format].clean_height;
372 dsh->
clean_left_offset = dirac_source_parameters_defaults[video_format].clean_left_offset;
373 dsh->
clean_right_offset = dirac_source_parameters_defaults[video_format].clean_right_offset;
374 dsh->
pixel_range_index = dirac_source_parameters_defaults[video_format].pixel_range_index;
375 dsh->
color_spec_index = dirac_source_parameters_defaults[video_format].color_spec_index;
379 ret = parse_source_parameters(dsh, &gb, log_ctx);
386 if (picture_coding_mode != 0) {
389 picture_coding_mode);
404 const uint8_t *buf,
size_t buf_size,