Merge remote-tracking branch 'qatar/master'

* qatar/master:
  af_resample: avoid conversion of identical sample formats for 1 channel
  avcodec: allow either planar or interleaved sample format when encoding mono
  adpcmenc: ensure calls to adpcm_ima_compress_sample() are in the right order
  timefilter: De-doxygenize normal code comments and drop silly ones
  gxf: Include the right header for the avpriv_frame_rate_tab declaration

Conflicts:
	libavcodec/adpcmenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-08 13:11:11 +02:00
commit 43c157f4a4
5 changed files with 19 additions and 10 deletions

View File

@ -538,8 +538,8 @@ 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) {
uint8_t v = adpcm_ima_compress_sample(status, smp[j ]);
v |= (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;
}
}

View File

@ -947,9 +947,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);

View File

@ -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;
@ -69,15 +69,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;
}

View File

@ -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;
}

View File

@ -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;
@ -207,7 +208,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
}