From e67b0f99520eb8154f5e703edea6d95bb1de711b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 7 Oct 2012 12:42:54 +0300 Subject: [PATCH 1/5] gxf: Include the right header for the avpriv_frame_rate_tab declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/gxf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/gxf.c b/libavformat/gxf.c index f2153297f7..04d75bd4f2 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "internal.h" #include "gxf.h" +#include "libavcodec/mpeg12data.h" struct gxf_stream_info { int64_t first_field; @@ -185,7 +186,6 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info * @return fps as AVRational, or 0 / 0 if unknown */ static AVRational fps_tag2avr(int32_t fps) { - extern const AVRational avpriv_frame_rate_tab[]; if (fps < 1 || fps > 9) fps = 9; return avpriv_frame_rate_tab[9 - fps]; // values have opposite order } From 62ae37decde7c15d4da95f1eb198789b8424d067 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 5 Oct 2012 19:29:18 +0200 Subject: [PATCH 2/5] timefilter: De-doxygenize normal code comments and drop silly ones --- libavdevice/timefilter.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavdevice/timefilter.c b/libavdevice/timefilter.c index 2e26b27976..8f52fc5d62 100644 --- a/libavdevice/timefilter.c +++ b/libavdevice/timefilter.c @@ -28,8 +28,8 @@ #include "timefilter.h" struct TimeFilter { - /// Delay Locked Loop data. These variables refer to mathematical - /// concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf + // Delay Locked Loop data. These variables refer to mathematical + // concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf double cycle_time; double feedback2_factor; double feedback3_factor; @@ -62,15 +62,12 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period) { self->count++; if (self->count == 1) { - /// init loop self->cycle_time = system_time; } else { double loop_error; self->cycle_time += self->clock_period * period; - /// calculate loop error loop_error = system_time - self->cycle_time; - /// update loop self->cycle_time += FFMAX(self->feedback2_factor, 1.0 / self->count) * loop_error; self->clock_period += self->feedback3_factor * loop_error / period; } From 5364327186fb90d67c860968a76bb0ec075308d4 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 6 Oct 2012 23:58:03 -0400 Subject: [PATCH 3/5] adpcmenc: ensure calls to adpcm_ima_compress_sample() are in the right order Should fix fate-acodec-adpcm-ima_wav with several compilers. --- libavcodec/adpcmenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 5c95ad7363..f81d7fde83 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -537,8 +537,9 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ADPCMChannelStatus *status = &c->status[ch]; const int16_t *smp = &samples_p[ch][1 + i * 8]; for (j = 0; j < 8; j += 2) { - *dst++ = adpcm_ima_compress_sample(status, smp[j ]) | - (adpcm_ima_compress_sample(status, smp[j + 1]) << 4); + uint8_t v = adpcm_ima_compress_sample(status, smp[j ]); + v |= adpcm_ima_compress_sample(status, smp[j + 1]) << 4; + *dst++ = v; } } } From 37f701f1c3967e7e2e3e6d67b4280bdcf13fdee1 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Sep 2012 01:04:15 -0400 Subject: [PATCH 4/5] avcodec: allow either planar or interleaved sample format when encoding mono When there is only 1 channel, the planar and interleaved formats of the same data type should be treated as identical. --- libavcodec/utils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a72c434d00..d1b9d0a3ee 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -792,9 +792,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if (av_codec_is_encoder(avctx->codec)) { int i; if (avctx->codec->sample_fmts) { - for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) + for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; + if (avctx->channels == 1 && + av_get_planar_sample_fmt(avctx->sample_fmt) == + av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { + avctx->sample_fmt = avctx->codec->sample_fmts[i]; + break; + } + } if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); ret = AVERROR(EINVAL); From 7b556be6735371d1040c7076547b8198d9fadd34 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Sep 2012 13:28:34 -0400 Subject: [PATCH 5/5] af_resample: avoid conversion of identical sample formats for 1 channel When there is only 1 channel, the planar and interleaved formats of the same data type should be treated as identical. --- libavfilter/af_resample.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_resample.c b/libavfilter/af_resample.c index c51f9d243b..58a9b2a99e 100644 --- a/libavfilter/af_resample.c +++ b/libavfilter/af_resample.c @@ -93,7 +93,11 @@ static int config_output(AVFilterLink *outlink) if (inlink->channel_layout == outlink->channel_layout && inlink->sample_rate == outlink->sample_rate && - inlink->format == outlink->format) + (inlink->format == outlink->format || + (av_get_channel_layout_nb_channels(inlink->channel_layout) == 1 && + av_get_channel_layout_nb_channels(outlink->channel_layout) == 1 && + av_get_planar_sample_fmt(inlink->format) == + av_get_planar_sample_fmt(outlink->format)))) return 0; if (!(s->avr = avresample_alloc_context())) @@ -226,6 +230,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) fail: avfilter_unref_buffer(buf); } else { + buf->format = outlink->format; ret = ff_filter_samples(outlink, buf); s->got_output = 1; }