fix motion compensation with (x+1/2,y+1/2) MVs
Originally committed as revision 2849 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
ca5b9f20b2
commit
c0a0170c16
@ -874,6 +874,13 @@ PIXOP2(put, op_put)
|
|||||||
#define avg2(a,b) ((a+b+1)>>1)
|
#define avg2(a,b) ((a+b+1)>>1)
|
||||||
#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
|
#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
|
||||||
|
|
||||||
|
static void put_no_rnd_pixels16_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
|
||||||
|
put_no_rnd_pixels16_l2(dst, a, b, stride, stride, stride, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void put_no_rnd_pixels8_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
|
||||||
|
put_no_rnd_pixels8_l2(dst, a, b, stride, stride, stride, h);
|
||||||
|
}
|
||||||
|
|
||||||
static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder)
|
static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder)
|
||||||
{
|
{
|
||||||
@ -3158,6 +3165,9 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
|
|||||||
dspfunc(avg, 3, 2);
|
dspfunc(avg, 3, 2);
|
||||||
#undef dspfunc
|
#undef dspfunc
|
||||||
|
|
||||||
|
c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
|
||||||
|
c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
|
||||||
|
|
||||||
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
|
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
|
||||||
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
|
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
|
||||||
c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
|
c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
|
||||||
|
|||||||
@ -204,6 +204,8 @@ typedef struct DSPContext {
|
|||||||
*/
|
*/
|
||||||
op_pixels_func avg_no_rnd_pixels_tab[2][4];
|
op_pixels_func avg_no_rnd_pixels_tab[2][4];
|
||||||
|
|
||||||
|
void (*put_no_rnd_pixels_l2[2])(uint8_t *block/*align width (8 or 16)*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thirdpel motion compensation with rounding (a+b+1)>>1.
|
* Thirdpel motion compensation with rounding (a+b+1)>>1.
|
||||||
* this is an array[12] of motion compensation funcions for the 9 thirdpel positions<br>
|
* this is an array[12] of motion compensation funcions for the 9 thirdpel positions<br>
|
||||||
|
|||||||
@ -2452,14 +2452,23 @@ av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* first, take care of copying a block from either the
|
/* first, take care of copying a block from either the
|
||||||
* previous or the golden frame */
|
* previous or the golden frame */
|
||||||
if (s->all_fragments[i].coding_method != MODE_INTRA) {
|
if (s->all_fragments[i].coding_method != MODE_INTRA) {
|
||||||
|
//Note, it is possible to implement all MC cases with put_no_rnd_pixels_l2 which would look more like the VP3 source but this would be slower as put_no_rnd_pixels_tab is better optimzed
|
||||||
s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](
|
if(motion_halfpel_index != 3){
|
||||||
output_plane + s->all_fragments[i].first_pixel,
|
s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](
|
||||||
motion_source,
|
output_plane + s->all_fragments[i].first_pixel,
|
||||||
stride, 8);
|
motion_source, stride, 8);
|
||||||
|
}else{
|
||||||
|
int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1
|
||||||
|
s->dsp.put_no_rnd_pixels_l2[1](
|
||||||
|
output_plane + s->all_fragments[i].first_pixel,
|
||||||
|
motion_source - d,
|
||||||
|
motion_source + stride + 1 + d,
|
||||||
|
stride, 8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dequantize the DCT coefficients */
|
/* dequantize the DCT coefficients */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user