Show
Ignore:
Timestamp:
2008-11-04 11:22:22 (2 months ago)
Author:
giles
Message:

Update dirac_parse_info for interlace spec changes.

After a patch by David Flynn.

Whether video is coded in frames or fields is set by the source_sampling
parameter in the video_format presets defined in table C.1, This can be
overridden by a custom value later in the sequence header. The field
order for interlaced video is defined by the preset only and cannot be
overridden.

Also normalize commas at the end of initializers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • liboggz/trunk/src/liboggz/dirac.c

    r3665 r3762  
    116116    {1,1}, /* this first value is never used */ 
    117117    {24000,1001}, {24,1}, {25,1}, {30000,1001}, {30,1}, 
    118     {50,1}, {60000,1001}, {60,1}, {15000,1001}, {25,2}, 
     118    {50,1}, {60000,1001}, {60,1}, {15000,1001}, {25,2} 
    119119  }; 
    120120 
    121121  static const ogg_uint32_t dirac_vidfmt_frate[] = { /* table C.1 */ 
    122     1, 9, 10, 9, 10, 9, 10, 4, 3, 7, 6, 4, 3, 7, 6, 2, 2, 7, 6, 7, 6, 
     122    1, 9, 10, 9, 10, 9, 10, 4, 3, 7, 6, 4, 3, 7, 6, 2, 2, 7, 6, 7, 6 
     123  }; 
     124 
     125  static const int dirac_source_sampling[] = { /* extracted from table C.1 */ 
     126    0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 
     127  }; 
     128  static const int dirac_top_field_first[] = { /* from table C.1 */ 
     129    0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 
    123130  }; 
    124131 
     
    151158    info->chroma_format = dirac_uint( &bs ); /* chroma_format */ 
    152159  } 
    153   if (dirac_bool( &bs )) { 
    154     info->interlaced = 0; 
    155     if (dirac_bool( &bs )) { /* interlaced */ 
    156         info->interlaced = 1; 
    157         info->top_field_first = dirac_bool( &bs ); /* top_field_first */ 
     160 
     161  if (dirac_bool( &bs )) { /* custom_scan_format_flag */ 
     162    int scan_format = dirac_uint( &bs ); /* scan_format */ 
     163    if (scan_format < 2) { 
     164      info->interlaced = scan_format; 
     165    } else { /* other scan_format values are reserved */ 
     166      info->interlaced = 0; 
    158167    } 
     168  } else { /* no custom scan_format, use the preset value */ 
     169    info->interlaced = dirac_source_sampling[video_format]; 
    159170  } 
     171  /* field order is set by video_format and cannot be custom */ 
     172  info->top_field_first = dirac_top_field_first[video_format]; 
    160173 
    161174  info->fps_numerator = dirac_frate_tbl[dirac_vidfmt_frate[video_format]].fps_numerator;