History

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

Michael Niedermayer committed 14 years ago

Commit 104f42e2 parents c2271fa 7b4406110 files · +71 −43Browse files

Unified · Split

10 files
  1. doc/APIchanges +13 −4
  2. libavcodec/adpcmenc.c +4 −3
  3. libavcodec/alacenc.c +13 −19
  4. libavcodec/lpc.c +7 −8
  5. libavcodec/lpc.h +1 −0
  6. libavcodec/mjpegdec.c +8 −4
  7. libavcodec/vorbisenc.c +2 −1
  8. libavformat/rtmpproto.c +7 −4
  9. tests/Makefile +1 −0
  10. tests/fate/alac.mak +15 −0
doc/APIchanges+13−4
@@ -77,22 +77,31 @@ API changes, most recent first: · 76 unmodified lines
7777 2012-03-26 - a67d9cf - lavfi 2.66.100
7878 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
7979
80−2012-08-08 - xxxxxxx - lavu 51.38 - dict.h
80+2012-08-18 - lavc 54.26 - avcodec.h
81+ Add codec descriptors for accessing codec properties without having
82+ to refer to a specific decoder or encoder.
83+
84+ c223d79 - Add an AVCodecDescriptor struct and functions
85+ avcodec_descriptor_get() and avcodec_descriptor_next().
86+ 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY.
87+ 91e59fe - Add avcodec_descriptor_get_by_name().
88+
89+2012-08-08 - 987170c - lavu 51.38 - dict.h
8190 Add av_dict_count().
8291
83−2012-08-xx - xxxxxxx - lavc 54.25 - avcodec.h
92+2012-08-07 - 104e10f - lavc 54.25 - avcodec.h
8493 Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*.
8594 To provide backwards compatibility, CodecID is now #defined as AVCodecID.
8695 Note that this can break user code that includes avcodec.h and uses the
8796 'CodecID' identifier. Such code should either #undef CodecID or stop using the
8897 CodecID name.
8998
90−2012-08-03 - xxxxxxx - lavu 51.37.1 - cpu.h
99+2012-08-03 - 239fdf1 - lavu 51.37.1 - cpu.h
91100 lsws 2.1.1 - swscale.h
92101 Rename AV_CPU_FLAG_MMX2 ---> AV_CPU_FLAG_MMXEXT.
93102 Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT.
94103
95−2012-07-xx - xxxxxxx - lavf 54.13.0 - avformat.h
104+2012-07-29 - 681ed00 - lavf 54.13.0 - avformat.h
96105 Add AVFMT_FLAG_NOBUFFER for low latency use cases.
97106
98107 2012-07-10 - 5fade8a - lavu 51.37.0
libavcodec/adpcmenc.c+4−3
@@ -616,10 +616,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 615 unmodified lines
616616
617617 if (avctx->trellis > 0) {
618618 FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
619− adpcm_compress_trellis(avctx, samples + 2, buf, &c->status[0], n);
619+ adpcm_compress_trellis(avctx, samples + avctx->channels, buf,
620+ &c->status[0], n);
620621 if (avctx->channels == 2)
621− adpcm_compress_trellis(avctx, samples + 3, buf + n,
622− &c->status[1], n);
622+ adpcm_compress_trellis(avctx, samples + avctx->channels + 1,
623+ buf + n, &c->status[1], n);
623624 for (i = 0; i < n; i++) {
624625 put_bits(&pb, 4, buf[i]);
625626 if (avctx->channels == 2)
libavcodec/alacenc.c+13−19
@@ -78,17 +78,15 @@ typedef struct AlacEncodeContext { · 77 unmodified lines
7878 } AlacEncodeContext;
7979
8080
81−static void init_sample_buffers(AlacEncodeContext *s,
82− const int16_t *input_samples)
81+static void init_sample_buffers(AlacEncodeContext *s, int16_t **input_samples)
8382 {
8483 int ch, i;
8584
8685 for (ch = 0; ch < s->avctx->channels; ch++) {
87− const int16_t *sptr = input_samples + ch;
88− for (i = 0; i < s->frame_size; i++) {
89− s->sample_buf[ch][i] = *sptr;
90− sptr += s->avctx->channels;
91− }
86+ int32_t *bptr = s->sample_buf[ch];
87+ const int16_t *sptr = input_samples[ch];
88+ for (i = 0; i < s->frame_size; i++)
89+ bptr[i] = sptr[i];
9290 }
9391 }
9492
@@ -347,8 +345,7 @@ static void alac_entropy_coder(AlacEncodeContext *s) · 252 unmodified lines
347345 }
348346 }
349347
350−static int write_frame(AlacEncodeContext *s, AVPacket *avpkt,
351− const int16_t *samples)
348+static int write_frame(AlacEncodeContext *s, AVPacket *avpkt, int16_t **samples)
352349 {
353350 int i, j;
354351 int prediction_type = 0;
@@ -358,8 +355,10 @@ static int write_frame(AlacEncodeContext *s, AVPacket *avpkt, · 3 unmodified lines
358355
359356 if (s->verbatim) {
360357 write_frame_header(s);
361− for (i = 0; i < s->frame_size * s->avctx->channels; i++)
362− put_sbits(pb, 16, *samples++);
358+ /* samples are channel-interleaved in verbatim mode */
359+ for (i = 0; i < s->frame_size; i++)
360+ for (j = 0; j < s->avctx->channels; j++)
361+ put_sbits(pb, 16, samples[j][i]);
363362 } else {
364363 init_sample_buffers(s, samples);
365364 write_frame_header(s);
@@ -426,11 +425,6 @@ static av_cold int alac_encode_init(AVCodecContext *avctx) · 60 unmodified lines
426425
427426 avctx->frame_size = s->frame_size = DEFAULT_FRAME_SIZE;
428427
429− if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
430− av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
431− return -1;
432− }
433−
434428 /* TODO: Correctly implement multi-channel ALAC.
435429 It is similar to multi-channel AAC, in that it has a series of
436430 single-channel (SCE), channel-pair (CPE), and LFE elements. */
@@ -542,11 +536,11 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 105 unmodified lines
542536 {
543537 AlacEncodeContext *s = avctx->priv_data;
544538 int out_bytes, max_frame_size, ret;
545− const int16_t *samples = (const int16_t *)frame->data[0];
539+ int16_t **samples = (int16_t **)frame->extended_data;
546540
547541 s->frame_size = frame->nb_samples;
548542
549− if (avctx->frame_size < DEFAULT_FRAME_SIZE)
543+ if (frame->nb_samples < DEFAULT_FRAME_SIZE)
550544 max_frame_size = get_max_frame_size(s->frame_size, avctx->channels,
551545 DEFAULT_SAMPLE_SIZE);
552546 else
@@ -580,7 +574,7 @@ AVCodec ff_alac_encoder = { · 27 unmodified lines
580574 .encode2 = alac_encode_frame,
581575 .close = alac_encode_close,
582576 .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
583− .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
577+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16P,
584578 AV_SAMPLE_FMT_NONE },
585579 .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
586580 };
libavcodec/lpc.c+7−8
@@ -179,11 +179,9 @@ int ff_lpc_calc_coefs(LPCContext *s, · 178 unmodified lines
179179 }
180180
181181 if (lpc_type == FF_LPC_TYPE_LEVINSON) {
182− double *windowed_samples = s->windowed_samples + max_order;
182+ s->lpc_apply_welch_window(samples, blocksize, s->windowed_samples);
183183
184− s->lpc_apply_welch_window(samples, blocksize, windowed_samples);
185−
186− s->lpc_compute_autocorr(windowed_samples, blocksize, max_order, autoc);
184+ s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc);
187185
188186 compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
189187
@@ -252,10 +250,11 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, · 62 unmodified lines
252250 s->lpc_type = lpc_type;
253251
254252 if (lpc_type == FF_LPC_TYPE_LEVINSON) {
255− s->windowed_samples = av_mallocz((blocksize + max_order + 2) *
256− sizeof(*s->windowed_samples));
257− if (!s->windowed_samples)
253+ s->windowed_buffer = av_mallocz((blocksize + 2 + FFALIGN(max_order, 4)) *
254+ sizeof(*s->windowed_samples));
255+ if (!s->windowed_buffer)
258256 return AVERROR(ENOMEM);
257+ s->windowed_samples = s->windowed_buffer + FFALIGN(max_order, 4);
259258 } else {
260259 s->windowed_samples = NULL;
261260 }
@@ -271,5 +270,5 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, · 9 unmodified lines
271270
272271 av_cold void ff_lpc_end(LPCContext *s)
273272 {
274− av_freep(&s->windowed_samples);
273+ av_freep(&s->windowed_buffer);
275274 }
libavcodec/lpc.h+1−0
@@ -51,6 +51,7 @@ typedef struct LPCContext { · 50 unmodified lines
5151 int blocksize;
5252 int max_order;
5353 enum FFLPCType lpc_type;
54+ double *windowed_buffer;
5455 double *windowed_samples;
5556
5657 /**
libavcodec/mjpegdec.c+8−4
@@ -1235,6 +1235,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, · 1234 unmodified lines
12351235 /* mjpeg-b can have padding bytes between sos and image data, skip them */
12361236 for (i = s->mjpb_skiptosod; i > 0; i--)
12371237 skip_bits(&s->gb, 8);
1238+
12381239 next_field:
12391240 for (i = 0; i < nb_components; i++)
12401241 s->last_dc[i] = 1024;
@@ -1271,11 +1272,14 @@ next_field: · 30 unmodified lines
12711272 return ret;
12721273 }
12731274 }
1274− if(s->interlaced && get_bits_left(&s->gb) > 32 && show_bits(&s->gb, 8) == 0xFF) {
1275− GetBitContext bak= s->gb;
1275+
1276+ if (s->interlaced &&
1277+ get_bits_left(&s->gb) > 32 &&
1278+ show_bits(&s->gb, 8) == 0xFF) {
1279+ GetBitContext bak = s->gb;
12761280 align_get_bits(&bak);
1277− if(show_bits(&bak, 16) == 0xFFD1) {
1278− av_log(s->avctx, AV_LOG_DEBUG, "AVRn ingterlaced picture\n");
1281+ if (show_bits(&bak, 16) == 0xFFD1) {
1282+ av_log(s->avctx, AV_LOG_DEBUG, "AVRn interlaced picture marker found\n");
12791283 s->gb = bak;
12801284 skip_bits(&s->gb, 16);
12811285 s->bottom_field ^= 1;
libavcodec/vorbisenc.c+2−1
@@ -1177,8 +1177,9 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext) · 1176 unmodified lines
11771177 if ((ret = create_vorbis_context(venc, avccontext)) < 0)
11781178 goto error;
11791179
1180+ avccontext->bit_rate = 0;
11801181 if (avccontext->flags & CODEC_FLAG_QSCALE)
1181− venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA / 10.;
1182+ venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA;
11821183 else
11831184 venc->quality = 8;
11841185 venc->quality *= venc->quality;
libavformat/rtmpproto.c+7−4
@@ -549,7 +549,7 @@ static int gen_release_stream(URLContext *s, RTMPContext *rt) · 548 unmodified lines
549549 ff_amf_write_null(&p);
550550 ff_amf_write_string(&p, rt->playpath);
551551
552− return rtmp_send_packet(rt, &pkt, 0);
552+ return rtmp_send_packet(rt, &pkt, 1);
553553 }
554554
555555 /**
@@ -573,7 +573,7 @@ static int gen_fcpublish_stream(URLContext *s, RTMPContext *rt) · 17 unmodified lines
573573 ff_amf_write_null(&p);
574574 ff_amf_write_string(&p, rt->playpath);
575575
576− return rtmp_send_packet(rt, &pkt, 0);
576+ return rtmp_send_packet(rt, &pkt, 1);
577577 }
578578
579579 /**
@@ -1525,8 +1525,11 @@ static int handle_invoke_error(URLContext *s, RTMPPacket *pkt) · 945 unmodified lines
15251525
15261526 if (!ff_amf_get_field_value(pkt->data + 9, data_end,
15271527 "description", tmpstr, sizeof(tmpstr))) {
1528− if (tracked_method && !strcmp(tracked_method, "_checkbw")) {
1529− /* Ignore _checkbw errors. */
1528+ if (tracked_method && (!strcmp(tracked_method, "_checkbw") ||
1529+ !strcmp(tracked_method, "releaseStream") ||
1530+ !strcmp(tracked_method, "FCSubscribe") ||
1531+ !strcmp(tracked_method, "FCPublish"))) {
1532+ /* Gracefully ignore Adobe-specific historical artifact errors. */
15301533 level = AV_LOG_WARNING;
15311534 ret = 0;
15321535 } else
tests/Makefile+1−0
@@ -38,6 +38,7 @@ include $(SRC_PATH)/tests/fate/vcodec.mak · 37 unmodified lines
3838 include $(SRC_PATH)/tests/fate/aac.mak
3939 include $(SRC_PATH)/tests/fate/ac3.mak
4040 include $(SRC_PATH)/tests/fate/adpcm.mak
41+include $(SRC_PATH)/tests/fate/alac.mak
4142 include $(SRC_PATH)/tests/fate/als.mak
4243 include $(SRC_PATH)/tests/fate/amrnb.mak
4344 include $(SRC_PATH)/tests/fate/amrwb.mak
tests/fate/alac.mak+15−0
@@ -0,0 +1,15 @@
1+FATE_ALAC += fate-alac-level-0 \
2+ fate-alac-level-1 \
3+ fate-alac-level-2 \
4+ fate-alac-lpc-orders \
5+
6+fate-alac-level-%: OPTS = -compression_level $(@:fate-alac-level-%=%)
7+fate-alac-lpc-orders: OPTS = -min_prediction_order 1 -max_prediction_order 30
8+
9+fate-alac-%: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
10+fate-alac-%: CMD = enc_dec_pcm mov wav s16le $(REF) -c alac $(OPTS)
11+fate-alac-%: CMP = oneoff
12+fate-alac-%: FUZZ = 0
13+
14+FATE_SAMPLES_AVCONV += $(FATE_ALAC)
15+fate-alac: $(FATE_ALAC)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t