39 #if CONFIG_DIRAC_PARSE 
   41 typedef struct dirac_source_params {
 
   44     uint8_t chroma_format;          
 
   47     uint8_t top_field_first;
 
   49     uint8_t frame_rate_index;       
 
   50     uint8_t aspect_ratio_index;     
 
   53     uint16_t clean_height;
 
   54     uint16_t clean_left_offset;
 
   55     uint16_t clean_right_offset;
 
   57     uint8_t pixel_range_index;      
 
   58     uint8_t color_spec_index;       
 
   59 } dirac_source_params;
 
   62 static const dirac_source_params dirac_source_parameters_defaults[] = {
 
   63     {  640,  480, 2, 0, 0,  1, 1,  640,  480, 0, 0, 1, 0 },
 
   64     {  176,  120, 2, 0, 0,  9, 2,  176,  120, 0, 0, 1, 1 },
 
   65     {  176,  144, 2, 0, 1, 10, 3,  176,  144, 0, 0, 1, 2 },
 
   66     {  352,  240, 2, 0, 0,  9, 2,  352,  240, 0, 0, 1, 1 },
 
   67     {  352,  288, 2, 0, 1, 10, 3,  352,  288, 0, 0, 1, 2 },
 
   68     {  704,  480, 2, 0, 0,  9, 2,  704,  480, 0, 0, 1, 1 },
 
   69     {  704,  576, 2, 0, 1, 10, 3,  704,  576, 0, 0, 1, 2 },
 
   70     {  720,  480, 1, 1, 0,  4, 2,  704,  480, 8, 0, 3, 1 },
 
   71     {  720,  576, 1, 1, 1,  3, 3,  704,  576, 8, 0, 3, 2 },
 
   73     { 1280,  720, 1, 0, 1,  7, 1, 1280,  720, 0, 0, 3, 3 },
 
   74     { 1280,  720, 1, 0, 1,  6, 1, 1280,  720, 0, 0, 3, 3 },
 
   75     { 1920, 1080, 1, 1, 1,  4, 1, 1920, 1080, 0, 0, 3, 3 },
 
   76     { 1920, 1080, 1, 1, 1,  3, 1, 1920, 1080, 0, 0, 3, 3 },
 
   77     { 1920, 1080, 1, 0, 1,  7, 1, 1920, 1080, 0, 0, 3, 3 },
 
   78     { 1920, 1080, 1, 0, 1,  6, 1, 1920, 1080, 0, 0, 3, 3 },
 
   79     { 2048, 1080, 0, 0, 1,  2, 1, 2048, 1080, 0, 0, 4, 4 },
 
   80     { 4096, 2160, 0, 0, 1,  2, 1, 4096, 2160, 0, 0, 4, 4 },
 
   82     { 3840, 2160, 1, 0, 1,  7, 1, 3840, 2160, 0, 0, 3, 3 },
 
   83     { 3840, 2160, 1, 0, 1,  6, 1, 3840, 2160, 0, 0, 3, 3 },
 
   84     { 7680, 4320, 1, 0, 1,  7, 1, 3840, 2160, 0, 0, 3, 3 },
 
   85     { 7680, 4320, 1, 0, 1,  6, 1, 3840, 2160, 0, 0, 3, 3 },
 
   89 static const AVRational dirac_preset_aspect_ratios[] = {
 
  101 static const AVRational dirac_frame_rate[] = {
 
  108 static const struct {
 
  111 } pixel_range_presets[] = {
 
  124 static const struct {
 
  128 } dirac_color_presets[] = {
 
  149     unsigned luma_depth = 8, luma_offset = 16;
 
  151     int chroma_x_shift, chroma_y_shift;
 
  262         luma_depth         = pixel_range_presets[idx].bitdepth;
 
  263         dsh->
color_range   = pixel_range_presets[idx].color_range;
 
  279     if ((dsh->
width % (1<<chroma_x_shift)) || (dsh->
height % (1<<chroma_y_shift))) {
 
  281             av_log(log_ctx, 
AV_LOG_ERROR, 
"Dimensions must be an integer multiple of the chroma subsampling\n");
 
  294         dsh->
colorspace      = dirac_color_presets[idx].colorspace;
 
  295         dsh->
color_trc       = dirac_color_presets[idx].color_trc;
 
  319         dsh->
colorspace      = dirac_color_presets[idx].colorspace;
 
  320         dsh->
color_trc       = dirac_color_presets[idx].color_trc;
 
  328                                    const uint8_t *buf, 
size_t buf_size,
 
  333     unsigned video_format, picture_coding_mode;
 
  358     if (video_format > 20
U) {
 
  364     dsh->
width              = dirac_source_parameters_defaults[video_format].width;
 
  365     dsh->
height             = dirac_source_parameters_defaults[video_format].height;
 
  366     dsh->
chroma_format      = dirac_source_parameters_defaults[video_format].chroma_format;
 
  367     dsh->
interlaced         = dirac_source_parameters_defaults[video_format].interlaced;
 
  368     dsh->
top_field_first    = dirac_source_parameters_defaults[video_format].top_field_first;
 
  369     dsh->
frame_rate_index   = dirac_source_parameters_defaults[video_format].frame_rate_index;
 
  370     dsh->
aspect_ratio_index = dirac_source_parameters_defaults[video_format].aspect_ratio_index;
 
  371     dsh->
clean_width        = dirac_source_parameters_defaults[video_format].clean_width;
 
  372     dsh->
clean_height       = dirac_source_parameters_defaults[video_format].clean_height;
 
  373     dsh->
clean_left_offset  = dirac_source_parameters_defaults[video_format].clean_left_offset;
 
  374     dsh->
clean_right_offset = dirac_source_parameters_defaults[video_format].clean_right_offset;
 
  375     dsh->
pixel_range_index  = dirac_source_parameters_defaults[video_format].pixel_range_index;
 
  376     dsh->
color_spec_index   = dirac_source_parameters_defaults[video_format].color_spec_index;
 
  380     ret = parse_source_parameters(dsh, &gb, log_ctx);
 
  387     if (picture_coding_mode != 0) {
 
  390                    picture_coding_mode);
 
  405                                    const uint8_t *buf, 
size_t buf_size,