summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-21 21:25:43 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-21 21:25:43 +0200
commit3e1a7ae44a97f20bbc9da0eba000663ef74e1890 (patch)
tree75bfd6ad30f1b24aa7d29c3a3081875c14b5dab5 /libavcodec
parent358d837dad4e2fbe010553990383d0ca4d5937cf (diff)
parent05fc9e40a4e4f808d457512420b887f458d216bc (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: swfdec: Add support for sample_rate_code 0 (5512 Hz) dct-test: factor out some common code and do whas was likely intended doc: library versions need to be bumped in version.h Revert "ffmpeg: get rid of useless AVInputStream.nb_streams." Remove some forgotten AVCodecContext.palctrl usage. lavc/utils: move avcodec_init() higher in the file. lavc: replace some deprecated FF_*_TYPE with AV_PICTURE_TYPE_* ac3dec: actually use drc_scale private option lavc: undeprecate AVPALETTE_SIZE and AVPALETTE_COUNT macros alsa: add missing header msmpeg4: remove leftover unused debug variable declaration Fix assert() calls that need updates after FF_COMMON_FRAME macro elimination. Fix av_dlog invocations with wrong or missing logging context. vf_yadif: add support to yuva420p vf_yadif: correct documentation on the parity parameter vf_yadif: copy buffer properties like aspect for second frame as well oma: support for encrypted files id3v2: add support for non-text and GEOB type tag frames des: add possibility to calculate DES-CBC-MAC with small buffer Conflicts: ffmpeg.c libavcodec/dct-test.c libavformat/mpegts.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ac3dec.c7
-rw-r--r--libavcodec/avcodec.h4
-rw-r--r--libavcodec/dct-test.c127
-rw-r--r--libavcodec/h261dec.c4
-rw-r--r--libavcodec/h264.c2
-rw-r--r--libavcodec/h264_direct.c4
-rw-r--r--libavcodec/mpeg12.c2
-rw-r--r--libavcodec/mpegvideo.c8
-rw-r--r--libavcodec/mpegvideo_enc.c10
-rw-r--r--libavcodec/msmpeg4.c4
-rw-r--r--libavcodec/options.c4
-rw-r--r--libavcodec/utils.c28
12 files changed, 92 insertions, 112 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 503db5e201..9d1611f226 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -176,6 +176,11 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
AC3DecodeContext *s = avctx->priv_data;
s->avctx = avctx;
+#if FF_API_DRC_SCALE
+ if (avctx->drc_scale)
+ s->drc_scale = avctx->drc_scale;
+#endif
+
ff_ac3_common_init();
ac3_tables_init();
ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
@@ -788,7 +793,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
do {
if(get_bits1(gbc)) {
s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)]-1.0) *
- s->avctx->drc_scale)+1.0;
+ s->drc_scale)+1.0;
} else if(blk == 0) {
s->dynamic_range[i] = 1.0f;
}
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f4f895537c..8e89e997d0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3149,6 +3149,8 @@ typedef struct AVPicture {
int linesize[4]; ///< number of bytes per line
} AVPicture;
+#define AVPALETTE_SIZE 1024
+#define AVPALETTE_COUNT 256
#if FF_API_PALETTE_CONTROL
/**
* AVPaletteControl
@@ -3158,8 +3160,6 @@ typedef struct AVPicture {
* @deprecated Use AVPacket to send palette changes instead.
* This is totally broken.
*/
-#define AVPALETTE_SIZE 1024
-#define AVPALETTE_COUNT 256
typedef struct AVPaletteControl {
/* Demuxer sets this to 1 to indicate the palette has changed;
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 9e1e99672b..2222cd5144 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -199,6 +199,55 @@ static inline void mmx_emms(void)
#endif
}
+static void init_block(DCTELEM block[64], int test, int is_idct, AVLFG *prng, int vals)
+{
+ int i, j;
+
+ memset(block, 0, 64 * sizeof(*block));
+
+ switch (test) {
+ case 0:
+ for (i = 0; i < 64; i++)
+ block[i] = (av_lfg_get(prng) % (2*vals)) -vals;
+ if (is_idct) {
+ ff_ref_fdct(block);
+ for (i = 0; i < 64; i++)
+ block[i] >>= 3;
+ }
+ break;
+ case 1:
+ j = av_lfg_get(prng) % 10 + 1;
+ for (i = 0; i < j; i++)
+ block[av_lfg_get(prng) % 64] = av_lfg_get(prng) % (2*vals) -vals;
+ break;
+ case 2:
+ block[ 0] = av_lfg_get(prng) % (16*vals) - (8*vals);
+ block[63] = (block[0] & 1) ^ 1;
+ break;
+ }
+}
+
+static void permute(DCTELEM dst[64], const DCTELEM src[64], int perm)
+{
+ int i;
+
+ if (perm == MMX_PERM) {
+ for (i = 0; i < 64; i++)
+ dst[idct_mmx_perm[i]] = src[i];
+ } else if (perm == MMX_SIMPLE_PERM) {
+ for (i = 0; i < 64; i++)
+ dst[idct_simple_mmx_perm[i]] = src[i];
+ } else if (perm == SSE2_PERM) {
+ for (i = 0; i < 64; i++)
+ dst[(i & 0x38) | idct_sse2_row_perm[i & 7]] = src[i];
+ } else if (perm == PARTTRANS_PERM) {
+ for (i = 0; i < 64; i++)
+ dst[(i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3)] = src[i];
+ } else {
+ for (i = 0; i < 64; i++)
+ dst[i] = src[i];
+ }
+}
static int dct_error(const struct algo *dct, int test, int is_idct, int speed, const int bits)
{
@@ -221,46 +270,8 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
for (i = 0; i < 64; i++)
sysErr[i] = 0;
for (it = 0; it < NB_ITS; it++) {
- for (i = 0; i < 64; i++)
- block1[i] = 0;
- switch (test) {
- case 0:
- for (i = 0; i < 64; i++)
- block1[i] = (av_lfg_get(&prng) % (2*vals)) -vals;
- if (is_idct) {
- ff_ref_fdct(block1);
- for (i = 0; i < 64; i++)
- block1[i] >>= 3;
- }
- break;
- case 1: {
- int num = av_lfg_get(&prng) % 10 + 1;
- for (i = 0; i < num; i++)
- block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % (2*vals) -vals;
- }
- break;
- case 2:
- block1[0] = av_lfg_get(&prng) % (16*vals) - (8*vals);
- block1[63] = (block1[0] & 1) ^ 1;
- break;
- }
-
- if (dct->format == MMX_PERM) {
- for (i = 0; i < 64; i++)
- block[idct_mmx_perm[i]] = block1[i];
- } else if (dct->format == MMX_SIMPLE_PERM) {
- for (i = 0; i < 64; i++)
- block[idct_simple_mmx_perm[i]] = block1[i];
- } else if (dct->format == SSE2_PERM) {
- for (i = 0; i < 64; i++)
- block[(i & 0x38) | idct_sse2_row_perm[i & 7]] = block1[i];
- } else if (dct->format == PARTTRANS_PERM) {
- for (i = 0; i < 64; i++)
- block[(i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3)] = block1[i];
- } else {
- for (i = 0; i < 64; i++)
- block[i] = block1[i];
- }
+ init_block(block1, test, is_idct, &prng, vals);
+ permute(block, block1, dct->format);
dct->func(block);
mmx_emms();
@@ -317,45 +328,15 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
return 0;
/* speed test */
- for (i = 0; i < 64; i++)
- block1[i] = 0;
-
- switch (test) {
- case 0:
- for (i = 0; i < 64; i++)
- block1[i] = av_lfg_get(&prng) % (2*vals) -vals;
- if (is_idct) {
- ff_ref_fdct(block1);
- for (i = 0; i < 64; i++)
- block1[i] >>= 3;
- }
- break;
- case 1:
- case 2:
- block1[0] = av_lfg_get(&prng) % (2*vals) -vals;
- block1[1] = av_lfg_get(&prng) % (2*vals) -vals;
- block1[2] = av_lfg_get(&prng) % (2*vals) -vals;
- block1[3] = av_lfg_get(&prng) % (2*vals) -vals;
- break;
- }
- if (dct->format == MMX_PERM) {
- for (i = 0; i < 64; i++)
- block[idct_mmx_perm[i]] = block1[i];
- } else if (dct->format == MMX_SIMPLE_PERM) {
- for (i = 0; i < 64; i++)
- block[idct_simple_mmx_perm[i]] = block1[i];
- } else {
- for (i = 0; i < 64; i++)
- block[i] = block1[i];
- }
+ init_block(block, test, is_idct, &prng, vals);
+ permute(block1, block, dct->format);
ti = gettime();
it1 = 0;
do {
for (it = 0; it < NB_ITS_SPEED; it++) {
- for (i = 0; i < 64; i++)
- block[i] = block1[i];
+ memcpy(block, block1, sizeof(block));
dct->func(block);
}
it1 += NB_ITS_SPEED;
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index a526bc1c60..96ebb24027 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -620,8 +620,8 @@ retry:
}
MPV_frame_end(s);
-assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
-assert(s->current_picture.pict_type == s->pict_type);
+assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
+assert(s->current_picture.f.pict_type == s->pict_type);
*pict= *(AVFrame*)s->current_picture_ptr;
ff_print_debug_info(s, pict);
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index d4858d02ef..b21b7fc71a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2774,7 +2774,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if (s0->first_field) {
assert(s0->current_picture_ptr);
assert(s0->current_picture_ptr->f.data[0]);
- assert(s0->current_picture_ptr->reference != DELAYED_PIC_REF);
+ assert(s0->current_picture_ptr->f.reference != DELAYED_PIC_REF);
/* figure out if we have a complementary field pair */
if (!FIELD_PICTURE || s->picture_structure == last_pic_structure) {
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index 691dcf9d57..ab9592bcea 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -172,7 +172,7 @@ static void pred_spatial_direct_motion(H264Context * const h, int *mb_type){
int mv[2];
int list;
- assert(h->ref_list[1][0].reference&3);
+ assert(h->ref_list[1][0].f.reference & 3);
await_reference_mb_row(h, &h->ref_list[1][0], s->mb_y + !!IS_INTERLACED(*mb_type));
@@ -416,7 +416,7 @@ static void pred_temp_direct_motion(H264Context * const h, int *mb_type){
unsigned int sub_mb_type;
int i8, i4;
- assert(h->ref_list[1][0].reference&3);
+ assert(h->ref_list[1][0].f.reference & 3);
await_reference_mb_row(h, &h->ref_list[1][0], s->mb_y + !!IS_INTERLACED(*mb_type));
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 9134becb01..647f4a22f6 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1176,7 +1176,7 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx, const AVCode
if (!ctx->mpeg_enc_ctx_allocated)
memcpy(s + 1, s1 + 1, sizeof(Mpeg1Context) - sizeof(MpegEncContext));
- if (!(s->pict_type == FF_B_TYPE || s->low_delay))
+ if (!(s->pict_type == AV_PICTURE_TYPE_B || s->low_delay))
s->picture_number++;
return 0;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e74d43adb8..da06bee28a 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -225,7 +225,7 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
int r;
if (s->avctx->hwaccel) {
- assert(!pic->hwaccel_picture_private);
+ assert(!pic->f.hwaccel_picture_private);
if (s->avctx->hwaccel->priv_data_size) {
pic->f.hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
if (!pic->f.hwaccel_picture_private) {
@@ -276,7 +276,7 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){
if(shared){
assert(pic->f.data[0]);
- assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED);
+ assert(pic->f.type == 0 || pic->f.type == FF_BUFFER_TYPE_SHARED);
pic->f.type = FF_BUFFER_TYPE_SHARED;
}else{
assert(!pic->f.data[0]);
@@ -539,7 +539,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src
s->last_pict_type= s1->pict_type;
if (s1->current_picture_ptr) s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f.quality;
- if(s1->pict_type!=FF_B_TYPE){
+ if (s1->pict_type != AV_PICTURE_TYPE_B) {
s->last_non_b_pict_type= s1->pict_type;
}
}
@@ -2662,6 +2662,6 @@ void ff_set_qscale(MpegEncContext * s, int qscale)
void MPV_report_decode_progress(MpegEncContext *s)
{
- if (s->pict_type != FF_B_TYPE && !s->partitioned_frame && !s->error_occurred)
+ if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->error_occurred)
ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0);
}
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 610e683493..8fcb934a17 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1093,8 +1093,8 @@ static int select_input_picture(MpegEncContext *s){
s->input_picture[0]->f.data[i] = NULL;
s->input_picture[0]->f.type = 0;
}else{
- assert( s->input_picture[0]->type==FF_BUFFER_TYPE_USER
- || s->input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL);
+ assert( s->input_picture[0]->f.type == FF_BUFFER_TYPE_USER
+ || s->input_picture[0]->f.type == FF_BUFFER_TYPE_INTERNAL);
s->avctx->release_buffer(s->avctx, (AVFrame*)s->input_picture[0]);
}
@@ -1220,8 +1220,8 @@ no_output_pic:
}else{
// input is not a shared pix -> reuse buffer for current_pix
- assert( s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER
- || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL);
+ assert( s->reordered_input_picture[0]->f.type == FF_BUFFER_TYPE_USER
+ || s->reordered_input_picture[0]->f.type == FF_BUFFER_TYPE_INTERNAL);
s->current_picture_ptr= s->reordered_input_picture[0];
for(i=0; i<4; i++){
@@ -2757,7 +2757,7 @@ static int estimate_qp(MpegEncContext *s, int dry_run){
/* must be called before writing the header */
static void set_frame_distances(MpegEncContext * s){
- assert(s->current_picture_ptr->pts != AV_NOPTS_VALUE);
+ assert(s->current_picture_ptr->f.pts != AV_NOPTS_VALUE);
s->time = s->current_picture_ptr->f.pts * s->avctx->time_base.num;
if(s->pict_type==AV_PICTURE_TYPE_B){
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 5ed03c4ddf..35ffb387a6 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -62,10 +62,6 @@ static uint32_t v2_dc_chroma_table[512][2];
/* vc1 externs */
extern const uint8_t wmv3_dc_scale_table[32];
-#ifdef DEBUG
-int frame_count = 0;
-#endif
-
#include "msmpeg4data.h"
#if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced
diff --git a/libavcodec/options.c b/libavcodec/options.c
index b78ffccdba..eb69904c10 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -448,7 +448,7 @@ static const AVOption options[]={
{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D},
#endif
#if FF_API_DRC_SCALE
-{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {.dbl = 1.0 }, 0.0, 1.0, A|D},
+{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {.dbl = 0.0 }, 0.0, 1.0, A|D},
#endif
#if FF_API_LAME_GLOBAL_OPTS
{"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BIT_RESERVOIR }, INT_MIN, INT_MAX, A|E, "flags2"},
@@ -544,7 +544,6 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_typ
s->pix_fmt= PIX_FMT_NONE;
s->sample_fmt= AV_SAMPLE_FMT_NONE;
- s->palctrl = NULL;
s->reget_buffer= avcodec_default_reget_buffer;
s->reordered_opaque= AV_NOPTS_VALUE;
}
@@ -623,7 +622,6 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
/* set values specific to opened codecs back to their default state */
dest->priv_data = NULL;
dest->codec = NULL;
- dest->palctrl = NULL;
dest->slice_offset = NULL;
dest->internal_buffer = NULL;
dest->hwaccel = NULL;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 068d7272f6..a7bf93db81 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -85,6 +85,20 @@ AVCodec *av_codec_next(AVCodec *c){
else return first_avcodec;
}
+#if !FF_API_AVCODEC_INIT
+static
+#endif
+void avcodec_init(void)
+{
+ static int initialized = 0;
+
+ if (initialized != 0)
+ return;
+ initialized = 1;
+
+ dsputil_static_init();
+}
+
void avcodec_register(AVCodec *codec)
{
AVCodec **p;
@@ -1144,20 +1158,6 @@ const char *avcodec_license(void)
return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}
-#if !FF_API_AVCODEC_INIT
-static
-#endif
-void avcodec_init(void)
-{
- static int initialized = 0;
-
- if (initialized != 0)
- return;
- initialized = 1;
-
- dsputil_static_init();
-}
-
void avcodec_flush_buffers(AVCodecContext *avctx)
{
if(HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)