* commit 'b8f3ab8e6a7ce3627764da53b809628c828d4047': ac3dec: output planar float only svq3: make slice type value unsigned to match svq3_get_ue_golomb return type configure: Have protocols select network code instead of depending on it Conflicts: libavcodec/svq3.c Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.1
| @@ -1927,10 +1927,8 @@ ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl" | |||||
| ffrtmpcrypt_protocol_select="tcp_protocol" | ffrtmpcrypt_protocol_select="tcp_protocol" | ||||
| ffrtmphttp_protocol_deps="!librtmp_protocol" | ffrtmphttp_protocol_deps="!librtmp_protocol" | ||||
| ffrtmphttp_protocol_select="http_protocol" | ffrtmphttp_protocol_select="http_protocol" | ||||
| gopher_protocol_deps="network" | |||||
| httpproxy_protocol_deps="network" | |||||
| gopher_protocol_select="network" | |||||
| httpproxy_protocol_select="tcp_protocol" | httpproxy_protocol_select="tcp_protocol" | ||||
| http_protocol_deps="network" | |||||
| http_protocol_select="tcp_protocol" | http_protocol_select="tcp_protocol" | ||||
| https_protocol_select="tls_protocol" | https_protocol_select="tls_protocol" | ||||
| librtmp_protocol_deps="librtmp" | librtmp_protocol_deps="librtmp" | ||||
| @@ -1939,7 +1937,7 @@ librtmps_protocol_deps="librtmp" | |||||
| librtmpt_protocol_deps="librtmp" | librtmpt_protocol_deps="librtmp" | ||||
| librtmpte_protocol_deps="librtmp" | librtmpte_protocol_deps="librtmp" | ||||
| mmsh_protocol_select="http_protocol" | mmsh_protocol_select="http_protocol" | ||||
| mmst_protocol_deps="network" | |||||
| mmst_protocol_select="network" | |||||
| rtmp_protocol_deps="!librtmp_protocol" | rtmp_protocol_deps="!librtmp_protocol" | ||||
| rtmp_protocol_select="tcp_protocol" | rtmp_protocol_select="tcp_protocol" | ||||
| rtmpe_protocol_select="ffrtmpcrypt_protocol" | rtmpe_protocol_select="ffrtmpcrypt_protocol" | ||||
| @@ -1949,11 +1947,12 @@ rtmpt_protocol_select="ffrtmphttp_protocol" | |||||
| rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol" | rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol" | ||||
| rtmpts_protocol_select="ffrtmphttp_protocol https_protocol" | rtmpts_protocol_select="ffrtmphttp_protocol https_protocol" | ||||
| rtp_protocol_select="udp_protocol" | rtp_protocol_select="udp_protocol" | ||||
| sctp_protocol_deps="network struct_sctp_event_subscribe" | |||||
| tcp_protocol_deps="network" | |||||
| sctp_protocol_deps="struct_sctp_event_subscribe" | |||||
| sctp_protocol_select="network" | |||||
| tcp_protocol_select="network" | |||||
| tls_protocol_deps_any="openssl gnutls" | tls_protocol_deps_any="openssl gnutls" | ||||
| tls_protocol_select="tcp_protocol" | tls_protocol_select="tcp_protocol" | ||||
| udp_protocol_deps="network" | |||||
| udp_protocol_select="network" | |||||
| # filters | # filters | ||||
| aconvert_filter_deps="swresample" | aconvert_filter_deps="swresample" | ||||
| @@ -2079,7 +2078,6 @@ enable stripping | |||||
| enable asm | enable asm | ||||
| enable debug | enable debug | ||||
| enable doc | enable doc | ||||
| enable network | |||||
| enable optimizations | enable optimizations | ||||
| enable runtime_cpudetect | enable runtime_cpudetect | ||||
| enable safe_bitstream_reader | enable safe_bitstream_reader | ||||
| @@ -3651,7 +3649,7 @@ elif check_func dlopen -ldl; then | |||||
| ldl=-ldl | ldl=-ldl | ||||
| fi | fi | ||||
| if enabled network; then | |||||
| if ! disabled network; then | |||||
| check_type "sys/types.h sys/socket.h" socklen_t | check_type "sys/types.h sys/socket.h" socklen_t | ||||
| check_type netdb.h "struct addrinfo" | check_type netdb.h "struct addrinfo" | ||||
| check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE | check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE | ||||
| @@ -172,14 +172,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) | |||||
| ff_fmt_convert_init(&s->fmt_conv, avctx); | ff_fmt_convert_init(&s->fmt_conv, avctx); | ||||
| av_lfg_init(&s->dith_state, 0); | av_lfg_init(&s->dith_state, 0); | ||||
| /* set scale value for float to int16 conversion */ | |||||
| if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) { | |||||
| s->mul_bias = 1.0f; | |||||
| avctx->sample_fmt = AV_SAMPLE_FMT_FLT; | |||||
| } else { | |||||
| s->mul_bias = 32767.0f; | |||||
| avctx->sample_fmt = AV_SAMPLE_FMT_S16; | |||||
| } | |||||
| avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; | |||||
| /* allow downmixing to stereo or mono */ | /* allow downmixing to stereo or mono */ | ||||
| if (avctx->channels > 0 && avctx->request_channels > 0 && | if (avctx->channels > 0 && avctx->request_channels > 0 && | ||||
| @@ -1206,7 +1199,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) | |||||
| /* apply scaling to coefficients (headroom, dynrng) */ | /* apply scaling to coefficients (headroom, dynrng) */ | ||||
| for (ch = 1; ch <= s->channels; ch++) { | for (ch = 1; ch <= s->channels; ch++) { | ||||
| float gain = s->mul_bias / 4194304.0f; | |||||
| float gain = 1.0 / 4194304.0f; | |||||
| if (s->channel_mode == AC3_CHMODE_DUALMONO) { | if (s->channel_mode == AC3_CHMODE_DUALMONO) { | ||||
| gain *= s->dynamic_range[2 - ch]; | gain *= s->dynamic_range[2 - ch]; | ||||
| } else { | } else { | ||||
| @@ -1268,8 +1261,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, | |||||
| const uint8_t *buf = avpkt->data; | const uint8_t *buf = avpkt->data; | ||||
| int buf_size = avpkt->size; | int buf_size = avpkt->size; | ||||
| AC3DecodeContext *s = avctx->priv_data; | AC3DecodeContext *s = avctx->priv_data; | ||||
| float *out_samples_flt; | |||||
| int16_t *out_samples_s16; | |||||
| int blk, ch, err, ret; | int blk, ch, err, ret; | ||||
| const uint8_t *channel_map; | const uint8_t *channel_map; | ||||
| const float *output[AC3_MAX_CHANNELS]; | const float *output[AC3_MAX_CHANNELS]; | ||||
| @@ -1383,8 +1374,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, | |||||
| av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| out_samples_flt = (float *)s->frame.data[0]; | |||||
| out_samples_s16 = (int16_t *)s->frame.data[0]; | |||||
| /* decode the audio blocks */ | /* decode the audio blocks */ | ||||
| channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; | channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; | ||||
| @@ -1395,15 +1384,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, | |||||
| av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); | av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); | ||||
| err = 1; | err = 1; | ||||
| } | } | ||||
| if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) { | |||||
| s->fmt_conv.float_interleave(out_samples_flt, output, 256, | |||||
| s->out_channels); | |||||
| out_samples_flt += 256 * s->out_channels; | |||||
| } else { | |||||
| s->fmt_conv.float_to_int16_interleave(out_samples_s16, output, 256, | |||||
| s->out_channels); | |||||
| out_samples_s16 += 256 * s->out_channels; | |||||
| } | |||||
| for (ch = 0; ch < s->out_channels; ch++) | |||||
| memcpy(s->frame.data[ch] + blk * 1024, output[ch], 1024); | |||||
| } | } | ||||
| s->frame.decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0; | s->frame.decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0; | ||||
| @@ -1457,8 +1439,7 @@ AVCodec ff_ac3_decoder = { | |||||
| .decode = ac3_decode_frame, | .decode = ac3_decode_frame, | ||||
| .capabilities = CODEC_CAP_DR1, | .capabilities = CODEC_CAP_DR1, | ||||
| .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), | .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), | ||||
| .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, | |||||
| AV_SAMPLE_FMT_S16, | |||||
| .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, | |||||
| AV_SAMPLE_FMT_NONE }, | AV_SAMPLE_FMT_NONE }, | ||||
| .priv_class = &ac3_decoder_class, | .priv_class = &ac3_decoder_class, | ||||
| }; | }; | ||||
| @@ -1481,8 +1462,7 @@ AVCodec ff_eac3_decoder = { | |||||
| .decode = ac3_decode_frame, | .decode = ac3_decode_frame, | ||||
| .capabilities = CODEC_CAP_DR1, | .capabilities = CODEC_CAP_DR1, | ||||
| .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), | .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), | ||||
| .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, | |||||
| AV_SAMPLE_FMT_S16, | |||||
| .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, | |||||
| AV_SAMPLE_FMT_NONE }, | AV_SAMPLE_FMT_NONE }, | ||||
| .priv_class = &eac3_decoder_class, | .priv_class = &eac3_decoder_class, | ||||
| }; | }; | ||||
| @@ -201,7 +201,6 @@ typedef struct AC3DecodeContext { | |||||
| DSPContext dsp; ///< for optimization | DSPContext dsp; ///< for optimization | ||||
| AC3DSPContext ac3dsp; | AC3DSPContext ac3dsp; | ||||
| FmtConvertContext fmt_conv; ///< optimized conversion functions | FmtConvertContext fmt_conv; ///< optimized conversion functions | ||||
| float mul_bias; ///< scaling for float_to_int16 conversion | |||||
| ///@} | ///@} | ||||
| ///@name Aligned arrays | ///@name Aligned arrays | ||||
| @@ -756,6 +756,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx) | |||||
| MpegEncContext *s = &h->s; | MpegEncContext *s = &h->s; | ||||
| const int mb_xy = h->mb_xy; | const int mb_xy = h->mb_xy; | ||||
| int i, header; | int i, header; | ||||
| unsigned slice_id; | |||||
| header = get_bits(&s->gb, 8); | header = get_bits(&s->gb, 8); | ||||
| @@ -790,12 +791,12 @@ static int svq3_decode_slice_header(AVCodecContext *avctx) | |||||
| skip_bits_long(&s->gb, 0); | skip_bits_long(&s->gb, 0); | ||||
| } | } | ||||
| if ((i = svq3_get_ue_golomb(&s->gb)) >= 3U) { | |||||
| av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i); | |||||
| if ((slice_id = svq3_get_ue_golomb(&s->gb)) >= 3) { | |||||
| av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", slice_id); | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| h->slice_type = golomb_to_pict_type[i]; | |||||
| h->slice_type = golomb_to_pict_type[slice_id]; | |||||
| if ((header & 0x9F) == 2) { | if ((header & 0x9F) == 2) { | ||||
| i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); | i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1)); | ||||