diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 462252bc66..ac65348352 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -30,7 +30,7 @@ /** Markers used in VC-1 AP frame data */ //@{ -enum VC1Code{ +enum VC1Code { VC1_CODE_RES0 = 0x00000100, VC1_CODE_ENDOFSEQ = 0x0000010A, VC1_CODE_SLICE, @@ -133,10 +133,10 @@ enum TransformTypes { TT_8X8, TT_8X4_BOTTOM, TT_8X4_TOP, - TT_8X4, //Both halves + TT_8X4, // both halves TT_4X8_RIGHT, TT_4X8_LEFT, - TT_4X8, //Both halves + TT_4X8, // both halves TT_4X4 }; //@} @@ -224,16 +224,16 @@ typedef struct VC1Context{ /** Frame decoding info for all profiles */ //@{ - uint8_t mv_mode; ///< MV coding monde - uint8_t mv_mode2; ///< Secondary MV coding mode (B frames) - int k_x; ///< Number of bits for MVs (depends on MV range) - int k_y; ///< Number of bits for MVs (depends on MV range) - int range_x, range_y; ///< MV range - uint8_t pq, altpq; ///< Current/alternate frame quantizer scale - uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT + uint8_t mv_mode; ///< MV coding monde + uint8_t mv_mode2; ///< Secondary MV coding mode (B frames) + int k_x; ///< Number of bits for MVs (depends on MV range) + int k_y; ///< Number of bits for MVs (depends on MV range) + int range_x, range_y; ///< MV range + uint8_t pq, altpq; ///< Current/alternate frame quantizer scale + uint8_t zz_8x8[4][64]; ///< Zigzag table for TT_8x8, permuted for IDCT int left_blk_sh, top_blk_sh; ///< Either 3 or 0, positions of l/t in blk[] - const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode - const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode + const uint8_t* zz_8x4; ///< Zigzag scan table for TT_8x4 coding mode + const uint8_t* zz_4x8; ///< Zigzag scan table for TT_4x8 coding mode /** pquant parameters */ //@{ uint8_t dquantfrm; @@ -245,15 +245,15 @@ typedef struct VC1Context{ * @see 8.1.1.10, p(1)10 */ //@{ - int c_ac_table_index; ///< Chroma index from ACFRM element - int y_ac_table_index; ///< Luma index from AC2FRM element + int c_ac_table_index; ///< Chroma index from ACFRM element + int y_ac_table_index; ///< Luma index from AC2FRM element //@} - int ttfrm; ///< Transform type info present at frame level - uint8_t ttmbf; ///< Transform type flag + int ttfrm; ///< Transform type info present at frame level + uint8_t ttmbf; ///< Transform type flag int *ttblk_base, *ttblk; ///< Transform type at the block level - int codingset; ///< index of current table set from 11.8 to use for luma block decoding - int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding - int pqindex; ///< raw pqindex used in coding set selection + int codingset; ///< index of current table set from 11.8 to use for luma block decoding + int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding + int pqindex; ///< raw pqindex used in coding set selection int a_avail, c_avail; uint8_t *mb_type_base, *mb_type[3]; @@ -273,24 +273,24 @@ typedef struct VC1Context{ * -# 2 -> [-512, 511.f] x [-128, 127.f] * -# 3 -> [-1024, 1023.f] x [-256, 255.f] */ - uint8_t mvrange; ///< Extended MV range flag - uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use - VLC *cbpcy_vlc; ///< CBPCY VLC table - int tt_index; ///< Index for Transform Type tables (to decode TTMB) - uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) - uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs - uint8_t* forward_mb_plane; ///< bitplane for "forward" MBs - int mv_type_is_raw; ///< mv type mb plane is not coded - int dmb_is_raw; ///< direct mb plane is raw - int fmb_is_raw; ///< forward mb plane is raw - int skip_is_raw; ///< skip mb plane is not coded - uint8_t luty[256], lutuv[256];///< lookup tables used for intensity compensation - int use_ic; ///< use intensity compensation in B-frames - int rnd; ///< rounding control + uint8_t mvrange; ///< Extended MV range flag + uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use + VLC *cbpcy_vlc; ///< CBPCY VLC table + int tt_index; ///< Index for Transform Type tables (to decode TTMB) + uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) + uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs + uint8_t* forward_mb_plane; ///< bitplane for "forward" MBs + int mv_type_is_raw; ///< mv type mb plane is not coded + int dmb_is_raw; ///< direct mb plane is raw + int fmb_is_raw; ///< forward mb plane is raw + int skip_is_raw; ///< skip mb plane is not coded + uint8_t luty[256], lutuv[256]; ///< lookup tables used for intensity compensation + int use_ic; ///< use intensity compensation in B-frames + int rnd; ///< rounding control /** Frame decoding info for S/M profiles only */ //@{ - uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128) + uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128) uint8_t interpfrm; //@} @@ -342,22 +342,22 @@ typedef struct VC1Context{ uint8_t *mv_f_base, *mv_f[2]; ///< 0: MV obtained from same field, 1: opposite field uint8_t *mv_f_last_base, *mv_f_last[2]; uint8_t *mv_f_next_base, *mv_f_next[2]; - int field_mode; ///< 1 for interlaced field pictures + int field_mode; ///< 1 for interlaced field pictures int fptype; int second_field; - int refdist; ///< distance of the current picture from reference - int numref; ///< number of past field pictures used as reference - // 0 corresponds to 1 and 1 corresponds to 2 references - int reffield; ///< if numref = 0 (1 reference) then reffield decides which - // field to use among the two fields from previous frame - int intcompfield; ///< which of the two fields to be intensity compensated - // 0: both fields, 1: bottom field, 2: top field + int refdist; ///< distance of the current picture from reference + int numref; ///< number of past field pictures used as reference + // 0 corresponds to 1 and 1 corresponds to 2 references + int reffield; ///< if numref = 0 (1 reference) then reffield decides which + // field to use among the two fields from previous frame + int intcompfield; ///< which of the two fields to be intensity compensated + // 0: both fields, 1: bottom field, 2: top field int cur_field_type; ///< 0: top, 1: bottom int ref_field_type[2]; ///< forward and backward reference field type (top or bottom) int blocks_off, mb_off; - int qs_last; ///< if qpel has been used in the previous (tr.) picture + int qs_last; ///< if qpel has been used in the previous (tr.) picture int bmvtype; - int frfd, brfd; ///< reference frame distance (forward or backward) + int frfd, brfd; ///< reference frame distance (forward or backward) int pic_header_flag; /** Frame decoding info for sprite modes */ @@ -378,11 +378,11 @@ typedef struct VC1Context{ uint32_t *cbp_base, *cbp; uint8_t *is_intra_base, *is_intra; int16_t (*luma_mv_base)[2], (*luma_mv)[2]; - uint8_t bfraction_lut_index;///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[]) - uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element) - uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element) + uint8_t bfraction_lut_index; ///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[]) + uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element) + uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element) - int parse_only; ///< Context is used within parser + int parse_only; ///< Context is used within parser int warn_interlaced; } VC1Context; @@ -394,11 +394,12 @@ static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, cons { uint32_t mrk = 0xFFFFFFFF; - if(end-src < 4) return end; - while(src < end){ + if (end-src < 4) + return end; + while (src < end) { mrk = (mrk << 8) | *src++; - if(IS_MARKER(mrk)) - return src-4; + if (IS_MARKER(mrk)) + return src - 4; } return end; } @@ -407,12 +408,13 @@ static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, ui { int dsize = 0, i; - if(size < 4){ - for(dsize = 0; dsize < size; dsize++) *dst++ = *src++; + if (size < 4) { + for (dsize = 0; dsize < size; dsize++) + *dst++ = *src++; return size; } - for(i = 0; i < size; i++, src++) { - if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { + for (i = 0; i < size; i++, src++) { + if (src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { dst[dsize++] = src[1]; src++; i++;