* qatar/master: h264: allow cropping to AVCodecContext.width/height mov: set AVCodecContext.width/height for h264 iac: generate codec tables as they are supposed to be indeo4: handle frame type 1 properly lavu: change versioning script to include all av* prefixed symbols Conflicts: libavcodec/h264.c libavutil/libavutil.v Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.0
| @@ -2969,7 +2969,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0) | |||||
| s->width = 16 * s->mb_width; | s->width = 16 * s->mb_width; | ||||
| s->height = 16 * s->mb_height; | s->height = 16 * s->mb_height; | ||||
| if(must_reinit) { | if(must_reinit) { | ||||
| free_tables(h, 0); | free_tables(h, 0); | ||||
| flush_dpb(s->avctx); | flush_dpb(s->avctx); | ||||
| @@ -114,6 +114,62 @@ static const int vlc_offsets[17] = { | |||||
| static VLC_TYPE vlc_tables[VLC_TABLES_SIZE][2]; | static VLC_TYPE vlc_tables[VLC_TABLES_SIZE][2]; | ||||
| static inline double freq2bark(double freq) | |||||
| { | |||||
| return 3.5 * atan((freq / 7500.0) * (freq / 7500.0)) + 13.0 * atan(freq * 0.00076); | |||||
| } | |||||
| static av_cold void iac_generate_tabs(IMCContext *q, int sampling_rate) | |||||
| { | |||||
| double freqmin[32], freqmid[32], freqmax[32]; | |||||
| double scale = sampling_rate / (256.0 * 2.0 * 2.0); | |||||
| double nyquist_freq = sampling_rate * 0.5; | |||||
| double freq, bark, prev_bark = 0, tf, tb; | |||||
| int i, j; | |||||
| for (i = 0; i < 32; i++) { | |||||
| freq = (band_tab[i] + band_tab[i + 1] - 1) * scale; | |||||
| bark = freq2bark(freq); | |||||
| if (i > 0) { | |||||
| tb = bark - prev_bark; | |||||
| q->weights1[i - 1] = pow(10.0, -1.0 * tb); | |||||
| q->weights2[i - 1] = pow(10.0, -2.7 * tb); | |||||
| } | |||||
| prev_bark = bark; | |||||
| freqmid[i] = freq; | |||||
| tf = freq; | |||||
| while (tf < nyquist_freq) { | |||||
| tf += 0.5; | |||||
| tb = freq2bark(tf); | |||||
| if (tb > bark + 0.5) | |||||
| break; | |||||
| } | |||||
| freqmax[i] = tf; | |||||
| tf = freq; | |||||
| while (tf > 0.0) { | |||||
| tf -= 0.5; | |||||
| tb = freq2bark(tf); | |||||
| if (tb <= bark - 0.5) | |||||
| break; | |||||
| } | |||||
| freqmin[i] = tf; | |||||
| } | |||||
| for (i = 0; i < 32; i++) { | |||||
| freq = freqmax[i]; | |||||
| for (j = 31; j > 0 && freq <= freqmid[j]; j--); | |||||
| q->cyclTab[i] = j + 1; | |||||
| freq = freqmin[i]; | |||||
| for (j = 0; j < 32 && freq >= freqmid[j]; j++); | |||||
| q->cyclTab2[i] = j - 1; | |||||
| } | |||||
| } | |||||
| static av_cold int imc_decode_init(AVCodecContext *avctx) | static av_cold int imc_decode_init(AVCodecContext *avctx) | ||||
| { | { | ||||
| int i, j, ret; | int i, j, ret; | ||||
| @@ -173,14 +229,14 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) | |||||
| } | } | ||||
| q->one_div_log2 = 1 / log(2); | q->one_div_log2 = 1 / log(2); | ||||
| memcpy(q->cyclTab, cyclTab, sizeof(cyclTab)); | |||||
| memcpy(q->cyclTab2, cyclTab2, sizeof(cyclTab2)); | |||||
| if (avctx->codec_id == CODEC_ID_IAC) { | if (avctx->codec_id == CODEC_ID_IAC) { | ||||
| q->cyclTab[29] = 31; | |||||
| q->cyclTab2[31] = 28; | |||||
| memcpy(q->weights1, iac_weights1, sizeof(iac_weights1)); | |||||
| memcpy(q->weights2, iac_weights2, sizeof(iac_weights2)); | |||||
| } | |||||
| if (avctx->codec_id == CODEC_ID_IAC) { | |||||
| iac_generate_tabs(q, avctx->sample_rate); | |||||
| } else { | } else { | ||||
| memcpy(q->cyclTab, cyclTab, sizeof(cyclTab)); | |||||
| memcpy(q->cyclTab2, cyclTab2, sizeof(cyclTab2)); | |||||
| memcpy(q->weights1, imc_weights1, sizeof(imc_weights1)); | memcpy(q->weights1, imc_weights1, sizeof(imc_weights1)); | ||||
| memcpy(q->weights2, imc_weights2, sizeof(imc_weights2)); | memcpy(q->weights2, imc_weights2, sizeof(imc_weights2)); | ||||
| } | } | ||||
| @@ -44,25 +44,6 @@ static const int8_t cyclTab2[32] = { | |||||
| 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, | 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22, | ||||
| 23, 24, 25, 26, 27, 28, 29}; | 23, 24, 25, 26, 27, 28, 29}; | ||||
| static const float iac_weights1[31] = { | |||||
| 0.0538585, 0.0576251, 0.0645592, 0.0494032, 0.0428915, 0.0592188, | |||||
| 0.0604145, 0.0673549, 0.0797351, 0.0972911, 0.119376, 0.144777, | |||||
| 0.17181, 0.198625, 0.242918, 0.262113, 0.278434, 0.310752, | |||||
| 0.319978, 0.328482, 0.354631, 0.380212, 0.388783, 0.400428, | |||||
| 0.43096, 0.462397, 0.479469, 0.499329, 0.534526, 0.568631, | |||||
| 0.589218 | |||||
| }; | |||||
| static const float iac_weights2[31] = { | |||||
| 0.000375307, 0.000450455, 0.000612191, 0.000297262, 0.000202956, | |||||
| 0.000484887, 0.000511777, 0.000686431, 0.00108256, 0.00185267, | |||||
| 0.00321869, 0.00541861, 0.00860266, 0.012726, 0.0219151, | |||||
| 0.0269104, 0.0316774, 0.0426107, 0.046113, 0.0494974, | |||||
| 0.0608692, 0.0734633, 0.0780208, 0.0844921, 0.103034, | |||||
| 0.124606, 0.137421, 0.153336, 0.184296, 0.217792, | |||||
| 0.239742 | |||||
| }; | |||||
| static const float imc_weights1[31] = { | static const float imc_weights1[31] = { | ||||
| 0.119595, 0.123124, 0.129192, 9.97377e-2, 8.1923e-2, 9.61153e-2, 8.77885e-2, 8.61174e-2, | 0.119595, 0.123124, 0.129192, 9.97377e-2, 8.1923e-2, 9.61153e-2, 8.77885e-2, 8.61174e-2, | ||||
| 9.00882e-2, 9.91658e-2, 0.112991, 0.131126, 0.152886, 0.177292, 0.221782, 0.244917, 0.267386, | 9.00882e-2, 9.91658e-2, 0.112991, 0.131126, 0.152886, 0.177292, 0.221782, 0.244917, 0.267386, | ||||
| @@ -40,7 +40,7 @@ | |||||
| */ | */ | ||||
| enum { | enum { | ||||
| FRAMETYPE_INTRA = 0, | FRAMETYPE_INTRA = 0, | ||||
| FRAMETYPE_BIDIR1 = 1, ///< bidirectional frame | |||||
| FRAMETYPE_INTRA1 = 1, ///< intra frame with slightly different bitstream coding | |||||
| FRAMETYPE_INTER = 2, ///< non-droppable P-frame | FRAMETYPE_INTER = 2, ///< non-droppable P-frame | ||||
| FRAMETYPE_BIDIR = 3, ///< bidirectional frame | FRAMETYPE_BIDIR = 3, ///< bidirectional frame | ||||
| FRAMETYPE_INTER_NOREF = 4, ///< droppable P-frame | FRAMETYPE_INTER_NOREF = 4, ///< droppable P-frame | ||||
| @@ -133,8 +133,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx) | |||||
| } | } | ||||
| #if IVI4_STREAM_ANALYSER | #if IVI4_STREAM_ANALYSER | ||||
| if ( ctx->frame_type == FRAMETYPE_BIDIR1 | |||||
| || ctx->frame_type == FRAMETYPE_BIDIR) | |||||
| if (ctx->frame_type == FRAMETYPE_BIDIR) | |||||
| ctx->has_b_frames = 1; | ctx->has_b_frames = 1; | ||||
| #endif | #endif | ||||
| @@ -500,7 +499,8 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, | |||||
| } else { | } else { | ||||
| if (band->inherit_mv && ref_mb) { | if (band->inherit_mv && ref_mb) { | ||||
| mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */ | mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */ | ||||
| } else if (ctx->frame_type == FRAMETYPE_INTRA) { | |||||
| } else if (ctx->frame_type == FRAMETYPE_INTRA || | |||||
| ctx->frame_type == FRAMETYPE_INTRA1) { | |||||
| mb->type = 0; /* mb_type is always INTRA for intra-frames */ | mb->type = 0; /* mb_type is always INTRA for intra-frames */ | ||||
| } else { | } else { | ||||
| mb->type = get_bits(&ctx->gb, mb_type_bits); | mb->type = get_bits(&ctx->gb, mb_type_bits); | ||||
| @@ -577,6 +577,7 @@ static void switch_buffers(IVI45DecContext *ctx) | |||||
| { | { | ||||
| switch (ctx->prev_frame_type) { | switch (ctx->prev_frame_type) { | ||||
| case FRAMETYPE_INTRA: | case FRAMETYPE_INTRA: | ||||
| case FRAMETYPE_INTRA1: | |||||
| case FRAMETYPE_INTER: | case FRAMETYPE_INTER: | ||||
| ctx->buf_switch ^= 1; | ctx->buf_switch ^= 1; | ||||
| ctx->dst_buf = ctx->buf_switch; | ctx->dst_buf = ctx->buf_switch; | ||||
| @@ -588,6 +589,7 @@ static void switch_buffers(IVI45DecContext *ctx) | |||||
| switch (ctx->frame_type) { | switch (ctx->frame_type) { | ||||
| case FRAMETYPE_INTRA: | case FRAMETYPE_INTRA: | ||||
| case FRAMETYPE_INTRA1: | |||||
| ctx->buf_switch = 0; | ctx->buf_switch = 0; | ||||
| /* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
| case FRAMETYPE_INTER: | case FRAMETYPE_INTER: | ||||
| @@ -2163,9 +2163,6 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) | |||||
| #if CONFIG_H263_DECODER | #if CONFIG_H263_DECODER | ||||
| case CODEC_ID_H263: | case CODEC_ID_H263: | ||||
| #endif | #endif | ||||
| #if CONFIG_H264_DECODER | |||||
| case CODEC_ID_H264: | |||||
| #endif | |||||
| #if CONFIG_MPEG4_DECODER | #if CONFIG_MPEG4_DECODER | ||||
| case CODEC_ID_MPEG4: | case CODEC_ID_MPEG4: | ||||
| #endif | #endif | ||||
| @@ -1,4 +1,4 @@ | |||||
| LIBAVUTIL_$MAJOR { | LIBAVUTIL_$MAJOR { | ||||
| global: av_*; ff_*; avutil_*; avpriv_*; | |||||
| global: av*; ff_*; | |||||
| local: *; | local: *; | ||||
| }; | }; | ||||