diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-23 14:23:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-23 14:33:33 +0200 |
commit | 104f42e69485557a7d603047e1d29c44bbd12562 (patch) | |
tree | f70179c1693b6fe212ac4090f49ea1ed843f92d4 | |
parent | c2271fa7f9a88afb374300c7320b57b870969926 (diff) | |
parent | 7b44061f4be1075eefbc2eec649f38dd0dbfcc82 (diff) | |
download | ffmpeg-104f42e69485557a7d603047e1d29c44bbd12562.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
doc/APIchanges: add an entry for codec descriptors.
vorbisenc: set AVCodecContext.bit_rate to 0
vorbisenc: fix quality parameter
FATE: add ALAC encoding tests
lpc: fix alignment of windowed samples for odd maximum LPC order
alacenc: use s16p sample format as input
alacenc: remove unneeded sample_fmt check
alacenc: fix max_frame_size calculation for the final frame
adpcm_swf: Use correct sample offsets when using trellis.
rtmp: support strict rtmp servers
mjpegdec: support AVRn interlaced
x86: remove FASTDIV inline asm
Conflicts:
doc/APIchanges
libavcodec/mjpegdec.c
libavcodec/vorbisenc.c
libavutil/x86/intmath.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/APIchanges | 17 | ||||
-rw-r--r-- | libavcodec/adpcmenc.c | 7 | ||||
-rw-r--r-- | libavcodec/alacenc.c | 32 | ||||
-rw-r--r-- | libavcodec/lpc.c | 15 | ||||
-rw-r--r-- | libavcodec/lpc.h | 1 | ||||
-rw-r--r-- | libavcodec/mjpegdec.c | 12 | ||||
-rw-r--r-- | libavcodec/vorbisenc.c | 3 | ||||
-rw-r--r-- | libavformat/rtmpproto.c | 11 | ||||
-rw-r--r-- | tests/Makefile | 1 | ||||
-rw-r--r-- | tests/fate/alac.mak | 15 |
10 files changed, 71 insertions, 43 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 67b120d02a..c9a046b395 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -77,22 +77,31 @@ API changes, most recent first: 2012-03-26 - a67d9cf - lavfi 2.66.100 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. -2012-08-08 - xxxxxxx - lavu 51.38 - dict.h +2012-08-18 - lavc 54.26 - avcodec.h + Add codec descriptors for accessing codec properties without having + to refer to a specific decoder or encoder. + + c223d79 - Add an AVCodecDescriptor struct and functions + avcodec_descriptor_get() and avcodec_descriptor_next(). + 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY. + 91e59fe - Add avcodec_descriptor_get_by_name(). + +2012-08-08 - 987170c - lavu 51.38 - dict.h Add av_dict_count(). -2012-08-xx - xxxxxxx - lavc 54.25 - avcodec.h +2012-08-07 - 104e10f - lavc 54.25 - avcodec.h Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*. To provide backwards compatibility, CodecID is now #defined as AVCodecID. Note that this can break user code that includes avcodec.h and uses the 'CodecID' identifier. Such code should either #undef CodecID or stop using the CodecID name. -2012-08-03 - xxxxxxx - lavu 51.37.1 - cpu.h +2012-08-03 - 239fdf1 - lavu 51.37.1 - cpu.h lsws 2.1.1 - swscale.h Rename AV_CPU_FLAG_MMX2 ---> AV_CPU_FLAG_MMXEXT. Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT. -2012-07-xx - xxxxxxx - lavf 54.13.0 - avformat.h +2012-07-29 - 681ed00 - lavf 54.13.0 - avformat.h Add AVFMT_FLAG_NOBUFFER for low latency use cases. 2012-07-10 - 5fade8a - lavu 51.37.0 diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 3af81cbc21..a3194abb3c 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -616,10 +616,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (avctx->trellis > 0) { FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error); - adpcm_compress_trellis(avctx, samples + 2, buf, &c->status[0], n); + adpcm_compress_trellis(avctx, samples + avctx->channels, buf, + &c->status[0], n); if (avctx->channels == 2) - adpcm_compress_trellis(avctx, samples + 3, buf + n, - &c->status[1], n); + adpcm_compress_trellis(avctx, samples + avctx->channels + 1, + buf + n, &c->status[1], n); for (i = 0; i < n; i++) { put_bits(&pb, 4, buf[i]); if (avctx->channels == 2) diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index 8b2b513cd7..79b6ba8dd8 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -78,17 +78,15 @@ typedef struct AlacEncodeContext { } AlacEncodeContext; -static void init_sample_buffers(AlacEncodeContext *s, - const int16_t *input_samples) +static void init_sample_buffers(AlacEncodeContext *s, int16_t **input_samples) { int ch, i; for (ch = 0; ch < s->avctx->channels; ch++) { - const int16_t *sptr = input_samples + ch; - for (i = 0; i < s->frame_size; i++) { - s->sample_buf[ch][i] = *sptr; - sptr += s->avctx->channels; - } + int32_t *bptr = s->sample_buf[ch]; + const int16_t *sptr = input_samples[ch]; + for (i = 0; i < s->frame_size; i++) + bptr[i] = sptr[i]; } } @@ -347,8 +345,7 @@ static void alac_entropy_coder(AlacEncodeContext *s) } } -static int write_frame(AlacEncodeContext *s, AVPacket *avpkt, - const int16_t *samples) +static int write_frame(AlacEncodeContext *s, AVPacket *avpkt, int16_t **samples) { int i, j; int prediction_type = 0; @@ -358,8 +355,10 @@ static int write_frame(AlacEncodeContext *s, AVPacket *avpkt, if (s->verbatim) { write_frame_header(s); - for (i = 0; i < s->frame_size * s->avctx->channels; i++) - put_sbits(pb, 16, *samples++); + /* samples are channel-interleaved in verbatim mode */ + for (i = 0; i < s->frame_size; i++) + for (j = 0; j < s->avctx->channels; j++) + put_sbits(pb, 16, samples[j][i]); } else { init_sample_buffers(s, samples); write_frame_header(s); @@ -426,11 +425,6 @@ static av_cold int alac_encode_init(AVCodecContext *avctx) avctx->frame_size = s->frame_size = DEFAULT_FRAME_SIZE; - if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) { - av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n"); - return -1; - } - /* TODO: Correctly implement multi-channel ALAC. It is similar to multi-channel AAC, in that it has a series of single-channel (SCE), channel-pair (CPE), and LFE elements. */ @@ -542,11 +536,11 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, { AlacEncodeContext *s = avctx->priv_data; int out_bytes, max_frame_size, ret; - const int16_t *samples = (const int16_t *)frame->data[0]; + int16_t **samples = (int16_t **)frame->extended_data; s->frame_size = frame->nb_samples; - if (avctx->frame_size < DEFAULT_FRAME_SIZE) + if (frame->nb_samples < DEFAULT_FRAME_SIZE) max_frame_size = get_max_frame_size(s->frame_size, avctx->channels, DEFAULT_SAMPLE_SIZE); else @@ -580,7 +574,7 @@ AVCodec ff_alac_encoder = { .encode2 = alac_encode_frame, .close = alac_encode_close, .capabilities = CODEC_CAP_SMALL_LAST_FRAME, - .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, + .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"), }; diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 3e5e3d63ad..ac8984a583 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -179,11 +179,9 @@ int ff_lpc_calc_coefs(LPCContext *s, } if (lpc_type == FF_LPC_TYPE_LEVINSON) { - double *windowed_samples = s->windowed_samples + max_order; + s->lpc_apply_welch_window(samples, blocksize, s->windowed_samples); - s->lpc_apply_welch_window(samples, blocksize, windowed_samples); - - s->lpc_compute_autocorr(windowed_samples, blocksize, max_order, autoc); + s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc); compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); @@ -252,10 +250,11 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, s->lpc_type = lpc_type; if (lpc_type == FF_LPC_TYPE_LEVINSON) { - s->windowed_samples = av_mallocz((blocksize + max_order + 2) * - sizeof(*s->windowed_samples)); - if (!s->windowed_samples) + s->windowed_buffer = av_mallocz((blocksize + 2 + FFALIGN(max_order, 4)) * + sizeof(*s->windowed_samples)); + if (!s->windowed_buffer) return AVERROR(ENOMEM); + s->windowed_samples = s->windowed_buffer + FFALIGN(max_order, 4); } else { s->windowed_samples = NULL; } @@ -271,5 +270,5 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, av_cold void ff_lpc_end(LPCContext *s) { - av_freep(&s->windowed_samples); + av_freep(&s->windowed_buffer); } diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h index c58e37c4bc..680e102713 100644 --- a/libavcodec/lpc.h +++ b/libavcodec/lpc.h @@ -51,6 +51,7 @@ typedef struct LPCContext { int blocksize; int max_order; enum FFLPCType lpc_type; + double *windowed_buffer; double *windowed_samples; /** diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 5fbda48d96..29d47b6fef 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1235,6 +1235,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, /* mjpeg-b can have padding bytes between sos and image data, skip them */ for (i = s->mjpb_skiptosod; i > 0; i--) skip_bits(&s->gb, 8); + next_field: for (i = 0; i < nb_components; i++) s->last_dc[i] = 1024; @@ -1271,11 +1272,14 @@ next_field: return ret; } } - if(s->interlaced && get_bits_left(&s->gb) > 32 && show_bits(&s->gb, 8) == 0xFF) { - GetBitContext bak= s->gb; + + if (s->interlaced && + get_bits_left(&s->gb) > 32 && + show_bits(&s->gb, 8) == 0xFF) { + GetBitContext bak = s->gb; align_get_bits(&bak); - if(show_bits(&bak, 16) == 0xFFD1) { - av_log(s->avctx, AV_LOG_DEBUG, "AVRn ingterlaced picture\n"); + if (show_bits(&bak, 16) == 0xFFD1) { + av_log(s->avctx, AV_LOG_DEBUG, "AVRn interlaced picture marker found\n"); s->gb = bak; skip_bits(&s->gb, 16); s->bottom_field ^= 1; diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c index b53fd371f2..b88791f274 100644 --- a/libavcodec/vorbisenc.c +++ b/libavcodec/vorbisenc.c @@ -1177,8 +1177,9 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext) if ((ret = create_vorbis_context(venc, avccontext)) < 0) goto error; + avccontext->bit_rate = 0; if (avccontext->flags & CODEC_FLAG_QSCALE) - venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA / 10.; + venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA; else venc->quality = 8; venc->quality *= venc->quality; diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index be2c716d93..65ad3886f5 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -549,7 +549,7 @@ static int gen_release_stream(URLContext *s, RTMPContext *rt) ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); - return rtmp_send_packet(rt, &pkt, 0); + return rtmp_send_packet(rt, &pkt, 1); } /** @@ -573,7 +573,7 @@ static int gen_fcpublish_stream(URLContext *s, RTMPContext *rt) ff_amf_write_null(&p); ff_amf_write_string(&p, rt->playpath); - return rtmp_send_packet(rt, &pkt, 0); + return rtmp_send_packet(rt, &pkt, 1); } /** @@ -1525,8 +1525,11 @@ static int handle_invoke_error(URLContext *s, RTMPPacket *pkt) if (!ff_amf_get_field_value(pkt->data + 9, data_end, "description", tmpstr, sizeof(tmpstr))) { - if (tracked_method && !strcmp(tracked_method, "_checkbw")) { - /* Ignore _checkbw errors. */ + if (tracked_method && (!strcmp(tracked_method, "_checkbw") || + !strcmp(tracked_method, "releaseStream") || + !strcmp(tracked_method, "FCSubscribe") || + !strcmp(tracked_method, "FCPublish"))) { + /* Gracefully ignore Adobe-specific historical artifact errors. */ level = AV_LOG_WARNING; ret = 0; } else diff --git a/tests/Makefile b/tests/Makefile index 5eef779d61..81ce3e14ee 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -38,6 +38,7 @@ include $(SRC_PATH)/tests/fate/vcodec.mak include $(SRC_PATH)/tests/fate/aac.mak include $(SRC_PATH)/tests/fate/ac3.mak include $(SRC_PATH)/tests/fate/adpcm.mak +include $(SRC_PATH)/tests/fate/alac.mak include $(SRC_PATH)/tests/fate/als.mak include $(SRC_PATH)/tests/fate/amrnb.mak include $(SRC_PATH)/tests/fate/amrwb.mak diff --git a/tests/fate/alac.mak b/tests/fate/alac.mak new file mode 100644 index 0000000000..b55b5949b6 --- /dev/null +++ b/tests/fate/alac.mak @@ -0,0 +1,15 @@ +FATE_ALAC += fate-alac-level-0 \ + fate-alac-level-1 \ + fate-alac-level-2 \ + fate-alac-lpc-orders \ + +fate-alac-level-%: OPTS = -compression_level $(@:fate-alac-level-%=%) +fate-alac-lpc-orders: OPTS = -min_prediction_order 1 -max_prediction_order 30 + +fate-alac-%: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav +fate-alac-%: CMD = enc_dec_pcm mov wav s16le $(REF) -c alac $(OPTS) +fate-alac-%: CMP = oneoff +fate-alac-%: FUZZ = 0 + +FATE_SAMPLES_AVCONV += $(FATE_ALAC) +fate-alac: $(FATE_ALAC) |