Ejemplo n.º 1
0
QuantMatrixExtension::QuantMatrixExtension( BitReader &hdr )
{
  init();
  hdr.reset();

  ahabassert( hdr.readbits( 32 ) == 0x000001b5 );
  ahabassert( hdr.readbits( 4 ) == 3 );

  load_intra_quantiser_matrix = hdr.readbits( 1 );
  for ( int i = 0; i < 64; i++ ) {
    intra_quantiser_matrix[ mpeg2_normal_scan[ i ] ] =
      load_intra_quantiser_matrix
      ? hdr.readbits( 8 )
      : default_intra_quantiser_matrix[ i ];
    mpegassert( intra_quantiser_matrix[ mpeg2_normal_scan[ i ] ] != 0 );
  }

  load_non_intra_quantiser_matrix = hdr.readbits( 1 );
  for ( int i = 0; i < 64; i++ ) {
    non_intra_quantiser_matrix[ mpeg2_normal_scan[ i ] ] =
      load_non_intra_quantiser_matrix ? hdr.readbits( 8 ) : 16;
    mpegassert( intra_quantiser_matrix[ mpeg2_normal_scan[ i ] ] != 0 );
  }
}
Ejemplo n.º 2
0
PictureCodingExtension::PictureCodingExtension( BitReader &hdr )
{
  init();
  hdr.reset();

  ahabassert( hdr.readbits( 32 ) == 0x000001b5 );
  ahabassert( hdr.readbits( 4 ) == 8 );
  
  f_code_fh = hdr.readbits( 4 );
  f_code_fv = hdr.readbits( 4 );
  f_code_bh = hdr.readbits( 4 );
  f_code_bv = hdr.readbits( 4 );

  intra_dc_precision = hdr.readbits( 2 );
  picture_structure = hdr.readbits( 2 );

  top_field_first = hdr.readbits( 1 );
  frame_pred_frame_dct = hdr.readbits( 1 );
  concealment_motion_vectors = hdr.readbits( 1 );
  q_scale_type = hdr.readbits( 1 );
  intra_vlc_format = hdr.readbits( 1 );
  alternate_scan = hdr.readbits( 1 );
  repeat_first_field = hdr.readbits( 1 );
  chroma_420_type = hdr.readbits( 1 );
  progressive_frame = hdr.readbits( 1 );

  if ( picture_structure != 3 ) {
    fprintf( stderr, "Ahab does not support field pictures.\n" );
    throw ConformanceLimitExceeded();
  }

  mpegassert( ((f_code_fh >= 1) && (f_code_fh <= 9)) || (f_code_fh == 15) );
  mpegassert( ((f_code_fv >= 1) && (f_code_fv <= 9)) || (f_code_fv == 15) );
  mpegassert( ((f_code_bh >= 1) && (f_code_bh <= 9)) || (f_code_bh == 15) );
  mpegassert( ((f_code_bv >= 1) && (f_code_bv <= 9)) || (f_code_bv == 15) );
}
Ejemplo n.º 3
0
SequenceExtension::SequenceExtension( BitReader &hdr )
{
  init();
  hdr.reset();

  ahabassert( hdr.readbits( 32 ) == 0x000001b5 );
  ahabassert( hdr.readbits( 4 ) == 1 );

  escape_bit = hdr.readbits( 1 );
  profile = hdr.readbits( 3 );
  level = hdr.readbits( 4 );
  progressive_sequence = hdr.readbits( 1 );
  chroma_format = hdr.readbits( 2 );
  horizontal_size_extension = hdr.readbits( 2 );
  vertical_size_extension = hdr.readbits( 2 );
  bit_rate_extension = hdr.readbits( 12 );

  mpegassert( hdr.readbits( 1 ) == 1 );
  
  vbv_buffer_size_extension = hdr.readbits( 8 );
  low_delay = hdr.readbits( 1 );
  frame_rate_extension_n = hdr.readbits( 2 );
  frame_rate_extension_d = hdr.readbits( 5 );

  /* Check conformance limits */
  if ( escape_bit ) {
    throw ConformanceLimitExceeded();
  }

  /* Simple profile or Main profile */
  if ( (profile != 5) && (profile != 4) ) {
    throw ConformanceLimitExceeded();
  }

  /* 4:2:0 only */
  if ( chroma_format != 1 ) {
    throw ConformanceLimitExceeded();
  }
}