summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-17 00:35:06 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-17 00:35:06 +0100
commit8c1ebdcea2d3f84bd5c01ce3dce5e619c845bc0f (patch)
tree977c2d42de80b6c292ff0f9ad79f14762ba792f6 /libavcodec
parent7bdefc0f1281c2c18375197985fcd5109e711829 (diff)
parent204cb29b3c84a74cbcd059d353c70c8bdc567d98 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: shorten: Use separate pointers for the allocated memory for decoded samples. atrac3: Fix crash in tonal component decoding. ws_snd1: Fix wrong samples counts. movenc: Don't set a default sample duration when creating ismv rtp: Factorize the check for distinguishing RTCP packets from RTP golomb: avoid infinite loop on all-zero input (or end of buffer). bethsoftvid: synchronize video timestamps with audio sample rate bethsoftvid: add audio stream only after getting the first audio packet bethsoftvid: Set video packet duration instead of accumulating pts. bethsoftvid: set packet key frame flag for audio and I-frame video packets. bethsoftvid: fix read_packet() return codes. bethsoftvid: pass palette in side data instead of in a separate packet. sdp: Ignore RTCP packets when autodetecting RTP streams proresenc: initialise 'sign' variable mpegaudio: replace memcpy by SIMD code vc1: prevent using last_frame as a reference for I/P first frame. Conflicts: libavcodec/atrac3.c libavcodec/golomb.h libavcodec/shorten.c libavcodec/ws-snd1.c tests/ref/fate/bethsoft-vid Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/atrac3.c2
-rw-r--r--libavcodec/bethsoftvideo.c14
-rw-r--r--libavcodec/proresenc_kostya.c2
-rw-r--r--libavcodec/shorten.c3
-rw-r--r--libavcodec/vc1dec.c11
-rw-r--r--libavcodec/ws-snd1.c4
-rw-r--r--libavcodec/x86/mpegaudiodec_mmx.c21
7 files changed, 47 insertions, 10 deletions
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index e72df12d62..b297789747 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -402,7 +402,7 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent
for (k=0; k<coded_components; k++) {
sfIndx = get_bits(gb,6);
- if(component_count>=64)
+ if (component_count >= 64)
return AVERROR_INVALIDDATA;
pComponent[component_count].pos = j * 64 + (get_bits(gb,6));
max_coded_values = SAMPLES_PER_FRAME - pComponent[component_count].pos;
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
index d85783b109..538e42614a 100644
--- a/libavcodec/bethsoftvideo.c
+++ b/libavcodec/bethsoftvideo.c
@@ -73,14 +73,23 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
uint8_t * dst;
uint8_t * frame_end;
int remaining = avctx->width; // number of bytes remaining on a line
- const int wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
- int code;
+ int wrap_to_next_line;
+ int code, ret;
int yoffset;
if (avctx->reget_buffer(avctx, &vid->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
+ wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
+
+ if (avpkt->side_data_elems > 0 &&
+ avpkt->side_data[0].type == AV_PKT_DATA_PALETTE) {
+ bytestream2_init(&vid->g, avpkt->side_data[0].data,
+ avpkt->side_data[0].size);
+ if ((ret = set_palette(vid)) < 0)
+ return ret;
+ }
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
dst = vid->frame.data[0];
@@ -88,7 +97,6 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
switch(block_type = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
- int ret;
*data_size = 0;
if ((ret = set_palette(vid)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error reading palette\n");
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 293735515b..242537b001 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -265,6 +265,7 @@ static void encode_dcs(PutBitContext *pb, DCTELEM *blocks,
prev_dc = (blocks[0] - 0x4000) / scale;
encode_vlc_codeword(pb, FIRST_DC_CB, MAKE_CODE(prev_dc));
+ sign = 0;
codebook = 3;
blocks += 64;
@@ -409,6 +410,7 @@ static int estimate_dcs(int *error, DCTELEM *blocks, int blocks_per_slice,
prev_dc = (blocks[0] - 0x4000) / scale;
bits = estimate_vlc(FIRST_DC_CB, MAKE_CODE(prev_dc));
+ sign = 0;
codebook = 3;
blocks += 64;
*error += FFABS(blocks[0] - 0x4000) % scale;
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index ef58aaa6aa..fc3a35e82a 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -141,7 +141,8 @@ static int allocate_buffers(ShortenContext *s)
return AVERROR(ENOMEM);
s->offset[chan] = tmp_ptr;
- tmp_ptr = av_realloc(s->decoded_base[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
+ tmp_ptr = av_realloc(s->decoded_base[chan], (s->blocksize + s->nwrap) *
+ sizeof(s->decoded_base[0][0]));
if (!tmp_ptr)
return AVERROR(ENOMEM);
s->decoded_base[chan] = tmp_ptr;
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 05809d36b0..a10ec85f02 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -478,7 +478,10 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
int off, off_uv;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
- if (!v->field_mode && !v->s.last_picture.f.data[0])
+
+ if ((!v->field_mode ||
+ (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) &&
+ !v->s.last_picture.f.data[0])
return;
mx = s->mv[dir][0][0];
@@ -690,7 +693,9 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir)
int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
- if (!v->field_mode && !v->s.last_picture.f.data[0])
+ if ((!v->field_mode ||
+ (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) &&
+ !v->s.last_picture.f.data[0])
return;
mx = s->mv[dir][n][0];
@@ -946,6 +951,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
if (dominant)
chroma_ref_type = !v->cur_field_type;
}
+ if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_picture.f.data[0])
+ return;
s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx;
s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty;
uvmx = (tx + ((tx & 3) == 3)) >> 1;
diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c
index 2cb8bb44a6..8df19a8bc9 100644
--- a/libavcodec/ws-snd1.c
+++ b/libavcodec/ws-snd1.c
@@ -112,8 +112,8 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, void *data,
/* make sure we don't write past the output buffer */
switch (code) {
- case 0: smp = 4*(count+1); break;
- case 1: smp = 2*(count+1); break;
+ case 0: smp = 4 * (count + 1); break;
+ case 1: smp = 2 * (count + 1); break;
case 2: smp = (count & 0x20) ? 1 : count + 1; break;
default: smp = count + 1; break;
}
diff --git a/libavcodec/x86/mpegaudiodec_mmx.c b/libavcodec/x86/mpegaudiodec_mmx.c
index b85b8a5548..939b441277 100644
--- a/libavcodec/x86/mpegaudiodec_mmx.c
+++ b/libavcodec/x86/mpegaudiodec_mmx.c
@@ -106,7 +106,26 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out,
float sum;
/* copy to avoid wrap */
- memcpy(in + 512, in, 32 * sizeof(*in));
+ __asm__ volatile(
+ "movaps 0(%0), %%xmm0 \n\t" \
+ "movaps 16(%0), %%xmm1 \n\t" \
+ "movaps 32(%0), %%xmm2 \n\t" \
+ "movaps 48(%0), %%xmm3 \n\t" \
+ "movaps %%xmm0, 0(%1) \n\t" \
+ "movaps %%xmm1, 16(%1) \n\t" \
+ "movaps %%xmm2, 32(%1) \n\t" \
+ "movaps %%xmm3, 48(%1) \n\t" \
+ "movaps 64(%0), %%xmm0 \n\t" \
+ "movaps 80(%0), %%xmm1 \n\t" \
+ "movaps 96(%0), %%xmm2 \n\t" \
+ "movaps 112(%0), %%xmm3 \n\t" \
+ "movaps %%xmm0, 64(%1) \n\t" \
+ "movaps %%xmm1, 80(%1) \n\t" \
+ "movaps %%xmm2, 96(%1) \n\t" \
+ "movaps %%xmm3, 112(%1) \n\t"
+ ::"r"(in), "r"(in+512)
+ :"memory"
+ );
apply_window(in + 16, win , win + 512, suma, sumc, 16);
apply_window(in + 32, win + 48, win + 640, sumb, sumd, 16);