comparison vc9.c @ 2967:ef2149182f1c libavcodec

COSMETICS: Remove all trailing whitespace.
author diego
date Sat, 17 Dec 2005 18:14:38 +0000
parents 6f8bcb169256
children 0b546eab515d
comparison
equal deleted inserted replaced
2966:564788471dd4 2967:ef2149182f1c
233 /** Sequence header data for all Profiles 233 /** Sequence header data for all Profiles
234 * TODO: choose between ints, uint8_ts and monobit flags 234 * TODO: choose between ints, uint8_ts and monobit flags
235 */ 235 */
236 //@{ 236 //@{
237 int profile; ///< 2bits, Profile 237 int profile; ///< 2bits, Profile
238 int frmrtq_postproc; ///< 3bits, 238 int frmrtq_postproc; ///< 3bits,
239 int bitrtq_postproc; ///< 5bits, quantized framerate-based postprocessing strength 239 int bitrtq_postproc; ///< 5bits, quantized framerate-based postprocessing strength
240 int fastuvmc; ///< Rounding of qpel vector to hpel ? (not in Simple) 240 int fastuvmc; ///< Rounding of qpel vector to hpel ? (not in Simple)
241 int extended_mv; ///< Ext MV in P/B (not in Simple) 241 int extended_mv; ///< Ext MV in P/B (not in Simple)
242 int dquant; ///< How qscale varies with MBs, 2bits (not in Simple) 242 int dquant; ///< How qscale varies with MBs, 2bits (not in Simple)
243 int vstransform; ///< variable-size [48]x[48] transform type + info 243 int vstransform; ///< variable-size [48]x[48] transform type + info
694 av_log(avctx, AV_LOG_DEBUG, "Advanced profile not supported yet\n"); 694 av_log(avctx, AV_LOG_DEBUG, "Advanced profile not supported yet\n");
695 return -1; 695 return -1;
696 } 696 }
697 #endif 697 #endif
698 698
699 /** 699 /**
700 * Decode Simple/Main Profiles sequence header 700 * Decode Simple/Main Profiles sequence header
701 * @see Figure 7-8, p16-17 701 * @see Figure 7-8, p16-17
702 * @param avctx Codec context 702 * @param avctx Codec context
703 * @param gb GetBit context initialized from Codec context extra_data 703 * @param gb GetBit context initialized from Codec context extra_data
704 * @return Status 704 * @return Status
932 int alloc_bitplane(BitPlane *bp, int width, int height) 932 int alloc_bitplane(BitPlane *bp, int width, int height)
933 { 933 {
934 if (!bp || bp->width<0 || bp->height<0) return -1; 934 if (!bp || bp->width<0 || bp->height<0) return -1;
935 bp->data = (uint8_t*)av_malloc(width*height); 935 bp->data = (uint8_t*)av_malloc(width*height);
936 if (!bp->data) return -1; 936 if (!bp->data) return -1;
937 bp->width = bp->stride = width; 937 bp->width = bp->stride = width;
938 bp->height = height; 938 bp->height = height;
939 return 0; 939 return 0;
940 } 940 }
941 941
942 /** Free the bitplane's buffer 942 /** Free the bitplane's buffer
959 959
960 for (y=0; y<height; y++){ 960 for (y=0; y<height; y++){
961 if (!get_bits(gb, 1)) //rowskip 961 if (!get_bits(gb, 1)) //rowskip
962 memset(plane, 0, width); 962 memset(plane, 0, width);
963 else 963 else
964 for (x=0; x<width; x++) 964 for (x=0; x<width; x++)
965 plane[x] = get_bits(gb, 1); 965 plane[x] = get_bits(gb, 1);
966 plane += stride; 966 plane += stride;
967 } 967 }
968 } 968 }
969 969
1160 } 1160 }
1161 return 0; 1161 return 0;
1162 } 1162 }
1163 1163
1164 /***********************************************************************/ 1164 /***********************************************************************/
1165 /** 1165 /**
1166 * @defgroup all_frame_hdr All VC9 profiles frame header 1166 * @defgroup all_frame_hdr All VC9 profiles frame header
1167 * @brief Part of the frame header decoding from all profiles 1167 * @brief Part of the frame header decoding from all profiles
1168 * @warning Only pro/epilog differs between Simple/Main and Advanced => check caller 1168 * @warning Only pro/epilog differs between Simple/Main and Advanced => check caller
1169 * @{ 1169 * @{
1170 */ 1170 */
1486 } 1486 }
1487 /** @} */ //End of group all_frm_hdr 1487 /** @} */ //End of group all_frm_hdr
1488 1488
1489 1489
1490 /***********************************************************************/ 1490 /***********************************************************************/
1491 /** 1491 /**
1492 * @defgroup std_frame_hdr VC9 Simple/Main Profiles header decoding 1492 * @defgroup std_frame_hdr VC9 Simple/Main Profiles header decoding
1493 * @brief Part of the frame header decoding belonging to Simple/Main Profiles 1493 * @brief Part of the frame header decoding belonging to Simple/Main Profiles
1494 * @warning Only pro/epilog differs between Simple/Main and Advanced => 1494 * @warning Only pro/epilog differs between Simple/Main and Advanced =>
1495 * check caller 1495 * check caller
1496 * @{ 1496 * @{
1571 } 1571 }
1572 /** @} */ //End for group std_frame_hdr 1572 /** @} */ //End for group std_frame_hdr
1573 1573
1574 #if HAS_ADVANCED_PROFILE 1574 #if HAS_ADVANCED_PROFILE
1575 /***********************************************************************/ 1575 /***********************************************************************/
1576 /** 1576 /**
1577 * @defgroup adv_frame_hdr VC9 Advanced Profile header decoding 1577 * @defgroup adv_frame_hdr VC9 Advanced Profile header decoding
1578 * @brief Part of the frame header decoding belonging to Advanced Profiles 1578 * @brief Part of the frame header decoding belonging to Advanced Profiles
1579 * @warning Only pro/epilog differs between Simple/Main and Advanced => 1579 * @warning Only pro/epilog differs between Simple/Main and Advanced =>
1580 * check caller 1580 * check caller
1581 * @{ 1581 * @{
1582 */ 1582 */
1583 /** Frame header decoding, primary part 1583 /** Frame header decoding, primary part
1584 * @param v VC9 context 1584 * @param v VC9 context
1585 * @return Status 1585 * @return Status
1586 */ 1586 */
1587 static int advanced_decode_picture_primary_header(VC9Context *v) 1587 static int advanced_decode_picture_primary_header(VC9Context *v)
1588 { 1588 {
1652 switch(v->s.pict_type) 1652 switch(v->s.pict_type)
1653 { 1653 {
1654 case P_TYPE: status = decode_p_picture_secondary_header(v); break; 1654 case P_TYPE: status = decode_p_picture_secondary_header(v); break;
1655 case B_TYPE: status = decode_b_picture_secondary_header(v); break; 1655 case B_TYPE: status = decode_b_picture_secondary_header(v); break;
1656 case BI_TYPE: 1656 case BI_TYPE:
1657 case I_TYPE: status = decode_i_picture_secondary_header(v); break; 1657 case I_TYPE: status = decode_i_picture_secondary_header(v); break;
1658 } 1658 }
1659 if (status<0) return FRAME_SKIPPED; 1659 if (status<0) return FRAME_SKIPPED;
1660 1660
1661 /* AC Syntax */ 1661 /* AC Syntax */
1662 v->c_ac_table_index = decode012(gb); 1662 v->c_ac_table_index = decode012(gb);
1671 } 1671 }
1672 #endif 1672 #endif
1673 /** @} */ //End for adv_frame_hdr 1673 /** @} */ //End for adv_frame_hdr
1674 1674
1675 /***********************************************************************/ 1675 /***********************************************************************/
1676 /** 1676 /**
1677 * @defgroup block VC9 Block-level functions 1677 * @defgroup block VC9 Block-level functions
1678 * @see 7.1.4, p91 and 8.1.1.7, p(1)04 1678 * @see 7.1.4, p91 and 8.1.1.7, p(1)04
1679 * @todo TODO: Integrate to MpegEncContext facilities 1679 * @todo TODO: Integrate to MpegEncContext facilities
1680 * @{ 1680 * @{
1681 */ 1681 */
1760 uint16_t **dc_val_ptr, int *dir_ptr) 1760 uint16_t **dc_val_ptr, int *dir_ptr)
1761 { 1761 {
1762 int a, b, c, wrap, pred, scale; 1762 int a, b, c, wrap, pred, scale;
1763 int16_t *dc_val; 1763 int16_t *dc_val;
1764 static const uint16_t dcpred[31] = { 1764 static const uint16_t dcpred[31] = {
1765 1024, 512, 341, 256, 205, 171, 146, 128, 1765 1024, 512, 341, 256, 205, 171, 146, 128,
1766 114, 102, 93, 85, 79, 73, 68, 64, 1766 114, 102, 93, 85, 79, 73, 68, 64,
1767 60, 57, 54, 51, 49, 47, 45, 43, 1767 60, 57, 54, 51, 49, 47, 45, 43,
1768 41, 39, 38, 37, 35, 34, 33 1768 41, 39, 38, 37, 35, 34, 33
1769 }; 1769 };
1770 1770
1771 /* find prediction - wmv3_dc_scale always used here in fact */ 1771 /* find prediction - wmv3_dc_scale always used here in fact */
1772 if (n < 4) scale = s->y_dc_scale; 1772 if (n < 4) scale = s->y_dc_scale;
1774 1774
1775 wrap = s->block_wrap[n]; 1775 wrap = s->block_wrap[n];
1776 dc_val= s->dc_val[0] + s->block_index[n]; 1776 dc_val= s->dc_val[0] + s->block_index[n];
1777 1777
1778 /* B C 1778 /* B C
1779 * A X 1779 * A X
1780 */ 1780 */
1781 a = dc_val[ - 1]; 1781 a = dc_val[ - 1];
1782 b = dc_val[ - 1 - wrap]; 1782 b = dc_val[ - 1 - wrap];
1783 c = dc_val[ - wrap]; 1783 c = dc_val[ - wrap];
1784 1784
1785 /* XXX: Rule B is used only for I and BI frames in S/M/C profile 1785 /* XXX: Rule B is used only for I and BI frames in S/M/C profile
1786 * with overlap filtering off 1786 * with overlap filtering off
1787 */ 1787 */
1788 if ((s->pict_type == I_TYPE || s->pict_type == BI_TYPE) && 1788 if ((s->pict_type == I_TYPE || s->pict_type == BI_TYPE) &&
1789 1 /* XXX: overlap filtering off */) 1789 1 /* XXX: overlap filtering off */)
1790 { 1790 {
1791 /* Set outer values */ 1791 /* Set outer values */
1941 } 1941 }
1942 1942
1943 /** @} */ //End for group block 1943 /** @} */ //End for group block
1944 1944
1945 /***********************************************************************/ 1945 /***********************************************************************/
1946 /** 1946 /**
1947 * @defgroup std_mb VC9 Macroblock-level functions in Simple/Main Profiles 1947 * @defgroup std_mb VC9 Macroblock-level functions in Simple/Main Profiles
1948 * @see 7.1.4, p91 and 8.1.1.7, p(1)04 1948 * @see 7.1.4, p91 and 8.1.1.7, p(1)04
1949 * @todo TODO: Integrate to MpegEncContext facilities 1949 * @todo TODO: Integrate to MpegEncContext facilities
1950 * @{ 1950 * @{
1951 */ 1951 */
1956 1956
1957 xy = s->block_index[n]; 1957 xy = s->block_index[n];
1958 wrap = s->b8_stride; 1958 wrap = s->b8_stride;
1959 1959
1960 /* B C 1960 /* B C
1961 * A X 1961 * A X
1962 */ 1962 */
1963 a = s->coded_block[xy - 1 ]; 1963 a = s->coded_block[xy - 1 ];
1964 b = s->coded_block[xy - 1 - wrap]; 1964 b = s->coded_block[xy - 1 - wrap];
1965 c = s->coded_block[xy - wrap]; 1965 c = s->coded_block[xy - wrap];
1966 1966
2018 MpegEncContext *s = &v->s; 2018 MpegEncContext *s = &v->s;
2019 GetBitContext *gb = &s->gb; 2019 GetBitContext *gb = &s->gb;
2020 int i, mb_offset = s->mb_x + s->mb_y*s->mb_width; /* XXX: mb_stride */ 2020 int i, mb_offset = s->mb_x + s->mb_y*s->mb_width; /* XXX: mb_stride */
2021 int cbp; /* cbp decoding stuff */ 2021 int cbp; /* cbp decoding stuff */
2022 int hybrid_pred; /* Prediction types */ 2022 int hybrid_pred; /* Prediction types */
2023 int mv_mode_bit = 0; 2023 int mv_mode_bit = 0;
2024 int mqdiff, mquant; /* MB quantization */ 2024 int mqdiff, mquant; /* MB quantization */
2025 int ttmb; /* MB Transform type */ 2025 int ttmb; /* MB Transform type */
2026 int status; 2026 int status;
2027 uint8_t *coded_val; 2027 uint8_t *coded_val;
2028 2028
2302 } 2302 }
2303 /** @} */ //End for group std_mb 2303 /** @} */ //End for group std_mb
2304 2304
2305 #if HAS_ADVANCED_PROFILE 2305 #if HAS_ADVANCED_PROFILE
2306 /***********************************************************************/ 2306 /***********************************************************************/
2307 /** 2307 /**
2308 * @defgroup adv_mb VC9 Macroblock-level functions in Advanced Profile 2308 * @defgroup adv_mb VC9 Macroblock-level functions in Advanced Profile
2309 * @todo TODO: Integrate to MpegEncContext facilities 2309 * @todo TODO: Integrate to MpegEncContext facilities
2310 * @todo TODO: Code P, B and BI 2310 * @todo TODO: Code P, B and BI
2311 * @{ 2311 * @{
2312 */ 2312 */
2454 scp = ((scp<<8)|buf[i])&0xffffff; 2454 scp = ((scp<<8)|buf[i])&0xffffff;
2455 2455
2456 if (scp != 0x000001) 2456 if (scp != 0x000001)
2457 break; // eof ? 2457 break; // eof ?
2458 2458
2459 scs = buf[i++]; 2459 scs = buf[i++];
2460 2460
2461 init_get_bits(gb, buf+i, (buf_size-i)*8); 2461 init_get_bits(gb, buf+i, (buf_size-i)*8);
2462 2462
2463 switch(scs) 2463 switch(scs)
2464 { 2464 {