mirror of https://git.ffmpeg.org/ffmpeg.git
Support lowres 3 when decoding MPEG video.
Patch by Anatoliy Nenashev, nenashev_as mail ru Originally committed as revision 21239 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
b5eab66e9f
commit
e1bb0364f8
|
@ -1416,6 +1416,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
|
|||
int motion_x, int motion_y)
|
||||
{
|
||||
const int lowres= s->avctx->lowres;
|
||||
const int op_index= FFMIN(lowres, 2);
|
||||
const int s_mask= (2<<lowres)-1;
|
||||
int emu=0;
|
||||
int sx, sy;
|
||||
|
@ -1440,11 +1441,11 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
|
|||
emu=1;
|
||||
}
|
||||
|
||||
sx <<= 2 - lowres;
|
||||
sy <<= 2 - lowres;
|
||||
sx= (sx << 2) >> lowres;
|
||||
sy= (sy << 2) >> lowres;
|
||||
if(field_select)
|
||||
src += s->linesize;
|
||||
pix_op[lowres](dest, src, stride, h, sx, sy);
|
||||
pix_op[op_index](dest, src, stride, h, sx, sy);
|
||||
return emu;
|
||||
}
|
||||
|
||||
|
@ -1458,6 +1459,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
|||
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
|
||||
int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, uvsx, uvsy;
|
||||
const int lowres= s->avctx->lowres;
|
||||
const int op_index= FFMIN(lowres, 2);
|
||||
const int block_s= 8>>lowres;
|
||||
const int s_mask= (2<<lowres)-1;
|
||||
const int h_edge_pos = s->h_edge_pos >> lowres;
|
||||
|
@ -1532,15 +1534,15 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
|||
ptr_cr+= s->uvlinesize;
|
||||
}
|
||||
|
||||
sx <<= 2 - lowres;
|
||||
sy <<= 2 - lowres;
|
||||
sx= (sx << 2) >> lowres;
|
||||
sy= (sy << 2) >> lowres;
|
||||
pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy);
|
||||
|
||||
if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
|
||||
uvsx <<= 2 - lowres;
|
||||
uvsy <<= 2 - lowres;
|
||||
pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
|
||||
pix_op[lowres](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
|
||||
uvsx= (uvsx << 2) >> lowres;
|
||||
uvsy= (uvsy << 2) >> lowres;
|
||||
pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
|
||||
pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
|
||||
}
|
||||
//FIXME h261 lowres loop filter
|
||||
}
|
||||
|
@ -1551,6 +1553,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
|
|||
h264_chroma_mc_func *pix_op,
|
||||
int mx, int my){
|
||||
const int lowres= s->avctx->lowres;
|
||||
const int op_index= FFMIN(lowres, 2);
|
||||
const int block_s= 8>>lowres;
|
||||
const int s_mask= (2<<lowres)-1;
|
||||
const int h_edge_pos = s->h_edge_pos >> (lowres+1);
|
||||
|
@ -1583,16 +1586,16 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
|
|||
emu=1;
|
||||
}
|
||||
}
|
||||
sx <<= 2 - lowres;
|
||||
sy <<= 2 - lowres;
|
||||
pix_op[lowres](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
|
||||
sx= (sx << 2) >> lowres;
|
||||
sy= (sy << 2) >> lowres;
|
||||
pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
|
||||
|
||||
ptr = ref_picture[2] + offset;
|
||||
if(emu){
|
||||
ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
|
||||
ptr= s->edge_emu_buffer;
|
||||
}
|
||||
pix_op[lowres](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
|
||||
pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue