mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
msmpeg4: Fix ff_msmpeg4_pred_dc() so it works with lowres>0
Fixes Ticket2532 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
46312fc2a9
commit
5dba888dd5
@ -175,13 +175,13 @@ int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block
|
|||||||
return pred;
|
return pred;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_dc(uint8_t *src, int stride, int scale)
|
static int get_dc(uint8_t *src, int stride, int scale, int block_size)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
int sum=0;
|
int sum=0;
|
||||||
for(y=0; y<8; y++){
|
for(y=0; y<block_size; y++){
|
||||||
int x;
|
int x;
|
||||||
for(x=0; x<8; x++){
|
for(x=0; x<block_size; x++){
|
||||||
sum+=src[x + y*stride];
|
sum+=src[x + y*stride];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,17 +276,18 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
|
|||||||
*dir_ptr = 0;
|
*dir_ptr = 0;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
int bs = 8 >> s->avctx->lowres;
|
||||||
if(n<4){
|
if(n<4){
|
||||||
wrap= s->linesize;
|
wrap= s->linesize;
|
||||||
dest= s->current_picture.f.data[0] + (((n >> 1) + 2*s->mb_y) * 8* wrap ) + ((n & 1) + 2*s->mb_x) * 8;
|
dest= s->current_picture.f.data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs;
|
||||||
}else{
|
}else{
|
||||||
wrap= s->uvlinesize;
|
wrap= s->uvlinesize;
|
||||||
dest= s->current_picture.f.data[n - 3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
|
dest= s->current_picture.f.data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs;
|
||||||
}
|
}
|
||||||
if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
|
if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
|
||||||
else a= get_dc(dest-8, wrap, scale*8);
|
else a= get_dc(dest-bs, wrap, scale*8>>(2*s->avctx->lowres), bs);
|
||||||
if(s->mb_y==0) c= (1024 + (scale>>1))/scale;
|
if(s->mb_y==0) c= (1024 + (scale>>1))/scale;
|
||||||
else c= get_dc(dest-8*wrap, wrap, scale*8);
|
else c= get_dc(dest-bs*wrap, wrap, scale*8>>(2*s->avctx->lowres), bs);
|
||||||
|
|
||||||
if (s->h263_aic_dir==0) {
|
if (s->h263_aic_dir==0) {
|
||||||
pred= a;
|
pred= a;
|
||||||
|
Loading…
Reference in New Issue
Block a user