Merge commit 'ecff5acb5a738fcb4f9e206a12070dac4bf259b3'

* commit 'ecff5acb5a738fcb4f9e206a12070dac4bf259b3':
  svq1dec: clip motion vectors to the frame size.

Conflicts:
	libavcodec/svq1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-04-17 15:52:10 +02:00
commit 0a946599f8
1 changed files with 14 additions and 15 deletions

View File

@ -321,7 +321,8 @@ static void svq1_skip_block(uint8_t *current, uint8_t *previous,
static int svq1_motion_inter_block(HpelDSPContext *hdsp, GetBitContext *bitbuf, static int svq1_motion_inter_block(HpelDSPContext *hdsp, GetBitContext *bitbuf,
uint8_t *current, uint8_t *previous, uint8_t *current, uint8_t *previous,
int pitch, svq1_pmv *motion, int x, int y) int pitch, svq1_pmv *motion, int x, int y,
int width, int height)
{ {
uint8_t *src; uint8_t *src;
uint8_t *dst; uint8_t *dst;
@ -350,10 +351,8 @@ static int svq1_motion_inter_block(HpelDSPContext *hdsp, GetBitContext *bitbuf,
motion[x / 8 + 2].y = motion[x / 8 + 2].y =
motion[x / 8 + 3].y = mv.y; motion[x / 8 + 3].y = mv.y;
if (y + (mv.y >> 1) < 0) mv.x = av_clip(mv.x, -2 * x, 2 * (width - x - 16));
mv.y = 0; mv.y = av_clip(mv.y, -2 * y, 2 * (height - y - 16));
if (x + (mv.x >> 1) < 0)
mv.x = 0;
src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1)) * pitch]; src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1)) * pitch];
dst = current; dst = current;
@ -365,7 +364,8 @@ static int svq1_motion_inter_block(HpelDSPContext *hdsp, GetBitContext *bitbuf,
static int svq1_motion_inter_4v_block(HpelDSPContext *hdsp, GetBitContext *bitbuf, static int svq1_motion_inter_4v_block(HpelDSPContext *hdsp, GetBitContext *bitbuf,
uint8_t *current, uint8_t *previous, uint8_t *current, uint8_t *previous,
int pitch, svq1_pmv *motion, int x, int y) int pitch, svq1_pmv *motion, int x, int y,
int width, int height)
{ {
uint8_t *src; uint8_t *src;
uint8_t *dst; uint8_t *dst;
@ -421,10 +421,8 @@ static int svq1_motion_inter_4v_block(HpelDSPContext *hdsp, GetBitContext *bitbu
int mvy = pmv[i]->y + (i >> 1) * 16; int mvy = pmv[i]->y + (i >> 1) * 16;
// FIXME: clipping or padding? // FIXME: clipping or padding?
if (y + (mvy >> 1) < 0) mvx = av_clip(mvx, -2 * x, 2 * (width - x - 8));
mvy = 0; mvy = av_clip(mvy, -2 * y, 2 * (height - y - 8));
if (x + (mvx >> 1) < 0)
mvx = 0;
src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1)) * pitch]; src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1)) * pitch];
dst = current; dst = current;
@ -444,7 +442,8 @@ static int svq1_motion_inter_4v_block(HpelDSPContext *hdsp, GetBitContext *bitbu
static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp, static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp,
GetBitContext *bitbuf, GetBitContext *bitbuf,
uint8_t *current, uint8_t *previous, uint8_t *current, uint8_t *previous,
int pitch, svq1_pmv *motion, int x, int y) int pitch, svq1_pmv *motion, int x, int y,
int width, int height)
{ {
uint32_t block_type; uint32_t block_type;
int result = 0; int result = 0;
@ -469,7 +468,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp,
case SVQ1_BLOCK_INTER: case SVQ1_BLOCK_INTER:
result = svq1_motion_inter_block(hdsp, bitbuf, current, previous, result = svq1_motion_inter_block(hdsp, bitbuf, current, previous,
pitch, motion, x, y); pitch, motion, x, y, width, height);
if (result != 0) { if (result != 0) {
av_dlog(avctx, "Error in svq1_motion_inter_block %i\n", result); av_dlog(avctx, "Error in svq1_motion_inter_block %i\n", result);
@ -480,7 +479,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp,
case SVQ1_BLOCK_INTER_4V: case SVQ1_BLOCK_INTER_4V:
result = svq1_motion_inter_4v_block(hdsp, bitbuf, current, previous, result = svq1_motion_inter_4v_block(hdsp, bitbuf, current, previous,
pitch, motion, x, y); pitch, motion, x, y, width, height);
if (result != 0) { if (result != 0) {
av_dlog(avctx, "Error in svq1_motion_inter_4v_block %i\n", result); av_dlog(avctx, "Error in svq1_motion_inter_4v_block %i\n", result);
@ -703,8 +702,8 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
result = svq1_decode_delta_block(avctx, &s->hdsp, result = svq1_decode_delta_block(avctx, &s->hdsp,
&s->gb, &current[x], &s->gb, &current[x],
previous, linesize, previous, linesize,
pmv, x, y); pmv, x, y, width, height);
if (result) { if (result != 0) {
av_dlog(avctx, av_dlog(avctx,
"Error in svq1_decode_delta_block %i\n", "Error in svq1_decode_delta_block %i\n",
result); result);