aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-21 22:56:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-21 22:56:07 +0200
commitc047afb80c7373c8533f5aeff6413015a814faaf (patch)
treeb1f31e060532f10412fb8a1d87582d61c1ee1e67 /libavcodec
parent2f06b56382ddd4ae1bbe09fd07f6e7658bfece08 (diff)
parent95510be8c35753da8f48062b28b65e7acdab965f (diff)
downloadffmpeg-c047afb80c7373c8533f5aeff6413015a814faaf.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: avcodec: remove AVCodecContext.dsp_mask avconv: fix a segfault when default encoder for a format doesn't exist. utvideo: general cosmetics aac: Handle HE-AACv2 when sniffing a channel order. movenc: Support high sample rates in isomedia formats by setting the sample rate field in stsd to 0. xxan: Remove write-only variable in xan_decode_frame_type0(). ivi_common: Initialize a variable at declaration in ff_ivi_decode_blocks(). Conflicts: ffmpeg.c libavcodec/utvideo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aacdec.c7
-rw-r--r--libavcodec/avcodec.h12
-rw-r--r--libavcodec/ivi_common.c6
-rw-r--r--libavcodec/pthread.c1
-rw-r--r--libavcodec/utvideo.c100
-rw-r--r--libavcodec/version.h3
-rw-r--r--libavcodec/x86/dsputil_mmx.c7
7 files changed, 71 insertions, 65 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index ba3a8f7f9e..bbbfce570b 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -410,6 +410,13 @@ static int output_configure(AACContext *ac,
if (ret < 0)
return ret;
}
+ if (ac->oc[1].m4ac.ps == 1 && channels == 2) {
+ if (layout == AV_CH_FRONT_CENTER) {
+ layout = AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT;
+ } else {
+ layout = 0;
+ }
+ }
memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
if (layout) avctx->channel_layout = layout;
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d905a019e0..c3a5192621 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2622,15 +2622,13 @@ typedef struct AVCodecContext {
#define FF_IDCT_SIMPLEALPHA 23
#define FF_IDCT_BINK 24
+#if FF_API_DSP_MASK
/**
- * dsp_mask could be add used to disable unwanted CPU features
- * CPU features (i.e. MMX, SSE. ...)
- *
- * With the FORCE flag you may instead enable given CPU features.
- * (Dangerous: Usable in case of misdetection, improper usage however will
- * result into program crash.)
+ * Unused.
+ * @deprecated use av_set_cpu_flags_mask() instead.
*/
- unsigned dsp_mask;
+ attribute_deprecated unsigned dsp_mask;
+#endif
/**
* bits per sample/pixel from the demuxer (needed for huffyuv).
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index 7d93f6be60..3f5e630762 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -333,7 +333,7 @@ int ff_ivi_dec_tile_data_size(GetBitContext *gb)
int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
{
int mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val,
- pos, is_intra, mc_type, mv_x, mv_y, col_mask;
+ pos, is_intra, mc_type = 0, mv_x, mv_y, col_mask;
uint8_t col_flags[8];
int32_t prev_dc, trvec[64];
uint32_t cbp, sym, lo, hi, quant, buf_offs, q;
@@ -373,9 +373,7 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
if (!is_intra) {
mv_x = mb->mv_x;
mv_y = mb->mv_y;
- if (!band->is_halfpel) {
- mc_type = 0; /* we have only fullpel vectors */
- } else {
+ if (band->is_halfpel) {
mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
mv_x >>= 1;
mv_y >>= 1; /* convert halfpel vectors into fullpel ones */
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 79abd26eb6..686994d51f 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -467,7 +467,6 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
dst->release_buffer = src->release_buffer;
dst->opaque = src->opaque;
- dst->dsp_mask = src->dsp_mask;
dst->debug = src->debug;
dst->debug_mv = src->debug_mv;
diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c
index da243e9c27..d8699c6b7a 100644
--- a/libavcodec/utvideo.c
+++ b/libavcodec/utvideo.c
@@ -175,9 +175,10 @@ static int decode_plane(UtvideoContext *c, int plane_no,
continue;
}
- memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size);
+ memcpy(c->slice_bits, src + slice_data_start + c->slices * 4,
+ slice_size);
memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits,
+ c->dsp.bswap_buf((uint32_t *) c->slice_bits, (uint32_t *) c->slice_bits,
(slice_data_end - slice_data_start + 3) >> 2);
init_get_bits(&gb, c->slice_bits, slice_size * 8);
@@ -185,7 +186,8 @@ static int decode_plane(UtvideoContext *c, int plane_no,
for (j = sstart; j < send; j++) {
for (i = 0; i < width * step; i += step) {
if (get_bits_left(&gb) <= 0) {
- av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n");
+ av_log(c->avctx, AV_LOG_ERROR,
+ "Slice decoding ran out of bits\n");
goto fail;
}
pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
@@ -202,8 +204,8 @@ static int decode_plane(UtvideoContext *c, int plane_no,
dest += stride;
}
if (get_bits_left(&gb) > 32)
- av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n",
- get_bits_left(&gb));
+ av_log(c->avctx, AV_LOG_WARNING,
+ "%d bits left after decoding slice\n", get_bits_left(&gb));
}
ff_free_vlc(&vlc);
@@ -216,7 +218,8 @@ fail:
static const int rgb_order[4] = { 1, 2, 0, 3 };
-static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
+static void restore_rgb_planes(uint8_t *src, int step, int stride, int width,
+ int height)
{
int i, j;
uint8_t r, g, b;
@@ -243,8 +246,9 @@ static void restore_median(uint8_t *src, int step, int stride,
const int cmask = ~rmode;
for (slice = 0; slice < slices; slice++) {
- slice_start = ((slice * height) / slices) & cmask;
- slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
+ slice_start = ((slice * height) / slices) & cmask;
+ slice_height = ((((slice + 1) * height) / slices) & cmask) -
+ slice_start;
bsrc = src + slice_start * stride;
@@ -253,29 +257,29 @@ static void restore_median(uint8_t *src, int step, int stride,
A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
- A = bsrc[i];
+ A = bsrc[i];
}
bsrc += stride;
if (slice_height == 1)
continue;
- // second line - first element has top predition, the rest uses median
- C = bsrc[-stride];
+ // second line - first element has top prediction, the rest uses median
+ C = bsrc[-stride];
bsrc[0] += C;
- A = bsrc[0];
+ A = bsrc[0];
for (i = step; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
bsrc += stride;
// the rest of lines use continuous median prediction
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
bsrc += stride;
}
@@ -293,67 +297,69 @@ static void restore_median_il(uint8_t *src, int step, int stride,
int A, B, C;
uint8_t *bsrc;
int slice_start, slice_height;
- const int cmask = ~(rmode ? 3 : 1);
+ const int cmask = ~(rmode ? 3 : 1);
const int stride2 = stride << 1;
for (slice = 0; slice < slices; slice++) {
slice_start = ((slice * height) / slices) & cmask;
- slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
+ slice_height = ((((slice + 1) * height) / slices) & cmask) -
+ slice_start;
slice_height >>= 1;
bsrc = src + slice_start * stride;
// first line - left neighbour prediction
bsrc[0] += 0x80;
- A = bsrc[0];
+ A = bsrc[0];
for (i = step; i < width * step; i += step) {
bsrc[i] += A;
- A = bsrc[i];
+ A = bsrc[i];
}
for (i = 0; i < width * step; i += step) {
bsrc[stride + i] += A;
- A = bsrc[stride + i];
+ A = bsrc[stride + i];
}
bsrc += stride2;
if (slice_height == 1)
continue;
- // second line - first element has top predition, the rest uses median
- C = bsrc[-stride2];
+ // second line - first element has top prediction, the rest uses median
+ C = bsrc[-stride2];
bsrc[0] += C;
- A = bsrc[0];
+ A = bsrc[0];
for (i = step; i < width * step; i += step) {
- B = bsrc[i - stride2];
+ B = bsrc[i - stride2];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[stride + i];
+ C = B;
+ A = bsrc[stride + i];
}
bsrc += stride2;
// the rest of lines use continuous median prediction
for (j = 2; j < slice_height; j++) {
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride2];
+ B = bsrc[i - stride2];
bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
+ C = B;
+ A = bsrc[i];
}
for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
+ B = bsrc[i - stride];
bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i + stride];
+ C = B;
+ A = bsrc[i + stride];
}
bsrc += stride2;
}
}
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+ AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -374,7 +380,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
return ret;
}
- /* parse plane structure to retrieve frame flags and validate slice offsets */
+ /* parse plane structure to get frame flags and validate slice offsets */
bytestream2_init(&gb, buf, buf_size);
for (i = 0; i < c->planes; i++) {
plane_start[i] = gb.buffer;
@@ -441,8 +447,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
break;
case PIX_FMT_YUV420P:
for (i = 0; i < 3; i++) {
- ret = decode_plane(c, i, c->pic.data[i], 1,
- c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i,
+ ret = decode_plane(c, i, c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height >> !!i,
plane_start[i], c->frame_pred == PRED_LEFT);
if (ret)
return ret;
@@ -462,8 +468,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
break;
case PIX_FMT_YUV422P:
for (i = 0; i < 3; i++) {
- ret = decode_plane(c, i, c->pic.data[i], 1,
- c->pic.linesize[i], avctx->width >> !!i, avctx->height,
+ ret = decode_plane(c, i, c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height,
plane_start[i], c->frame_pred == PRED_LEFT);
if (ret)
return ret;
@@ -500,7 +506,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
ff_dsputil_init(&c->dsp, avctx);
if (avctx->extradata_size < 16) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n",
+ av_log(avctx, AV_LOG_ERROR,
+ "Insufficient extradata size %d, should be at least 16\n",
avctx->extradata_size);
return AVERROR_INVALIDDATA;
}
@@ -508,7 +515,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
avctx->extradata[3], avctx->extradata[2],
avctx->extradata[1], avctx->extradata[0]);
- av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4));
+ av_log(avctx, AV_LOG_DEBUG, "Original format %X\n",
+ AV_RB32(avctx->extradata + 4));
c->frame_info_size = AV_RL32(avctx->extradata + 8);
c->flags = AV_RL32(avctx->extradata + 12);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1a549ba63c..6a9b1ad284 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -78,5 +78,8 @@
#ifndef FF_API_SUB_ID
#define FF_API_SUB_ID (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
+#ifndef FF_API_DSP_MASK
+#define FF_API_DSP_MASK (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
#endif /* AVCODEC_VERSION_H */
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index e17a8005a7..4c96d62525 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -3185,13 +3185,6 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
{
int mm_flags = av_get_cpu_flags();
- if (avctx->dsp_mask) {
- if (avctx->dsp_mask & AV_CPU_FLAG_FORCE)
- mm_flags |= avctx->dsp_mask & 0xffff;
- else
- mm_flags &= ~(avctx->dsp_mask & 0xffff);
- }
-
#if 0
av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
if (mm_flags & AV_CPU_FLAG_MMX)