av_cold int ff_dct_common_init(MpegEncContext *s)
{
ff_blockdsp_init(&s->bdsp, s->avctx);
- ff_dsputil_init(&s->dsp, s->avctx);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
ff_idctdsp_init(&s->idsp, s->avctx);
+ ff_me_cmp_init(&s->mecc, s->avctx);
ff_mpegvideodsp_init(&s->mdsp);
ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
+ if (HAVE_INTRINSICS_NEON)
+ ff_MPV_common_init_neon(s);
+
if (ARCH_ALPHA)
ff_MPV_common_init_axp(s);
if (ARCH_ARM)
int i;
er->avctx = s->avctx;
- er->dsp = &s->dsp;
+ er->mecc = &s->mecc;
er->mb_index2xy = s->mb_index2xy;
er->mb_num = s->mb_num;
ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0);
}
+
+static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx)
+{
+ if(*sx > *ex)
+ return clip_line(ex, ey, sx, sy, maxx);
+
+ if (*sx < 0) {
+ if (*ex < 0)
+ return 1;
+ *sy = *ey + (*sy - *ey) * (int64_t)*ex / (*ex - *sx);
+ *sx = 0;
+ }
+
+ if (*ex > maxx) {
+ if (*sx > maxx)
+ return 1;
+ *ey = *sy + (*ey - *sy) * (int64_t)(maxx - *sx) / (*ex - *sx);
+ *ex = maxx;
+ }
+ return 0;
+}
+
+
/**
* Draw a line from (ex, ey) -> (sx, sy).
* @param w width of the image
{
int x, y, fr, f;
+ if (clip_line(&sx, &sy, &ex, &ey, w - 1))
+ return;
+ if (clip_line(&sy, &sx, &ey, &ex, h - 1))
+ return;
+
sx = av_clip(sx, 0, w - 1);
sy = av_clip(sy, 0, h - 1);
ex = av_clip(ex, 0, w - 1);
* @param color color of the arrow
*/
static void draw_arrow(uint8_t *buf, int sx, int sy, int ex,
- int ey, int w, int h, int stride, int color)
+ int ey, int w, int h, int stride, int color, int tail, int direction)
{
int dx,dy;
+ if (direction) {
+ FFSWAP(int, sx, ex);
+ FFSWAP(int, sy, ey);
+ }
+
sx = av_clip(sx, -100, w + 100);
sy = av_clip(sy, -100, h + 100);
ex = av_clip(ex, -100, w + 100);
rx = ROUNDED_DIV(rx * 3 << 4, length);
ry = ROUNDED_DIV(ry * 3 << 4, length);
+ if (tail) {
+ rx = -rx;
+ ry = -ry;
+ }
+
draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color);
draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color);
}
int mx = (motion_val[direction][xy][0] >> shift) + sx;
int my = (motion_val[direction][xy][1] >> shift) + sy;
draw_arrow(ptr, sx, sy, mx, my, width,
- height, pict->linesize[0], 100);
+ height, pict->linesize[0], 100, 0, direction);
}
} else if (IS_16X8(mbtype_table[mb_index])) {
int i;
if (IS_INTERLACED(mbtype_table[mb_index]))
my *= 2;
- draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
- height, pict->linesize[0], 100);
+ draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
+ height, pict->linesize[0], 100, 0, direction);
}
} else if (IS_8X16(mbtype_table[mb_index])) {
int i;
my *= 2;
draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
- height, pict->linesize[0], 100);
+ height, pict->linesize[0], 100, 0, direction);
}
} else {
int sx= mb_x * 16 + 8;
int xy= (mb_x + mb_y * mv_stride) << mv_sample_log2;
int mx= (motion_val[direction][xy][0]>>shift) + sx;
int my= (motion_val[direction][xy][1]>>shift) + sy;
- draw_arrow(ptr, sx, sy, mx, my, width, height, pict->linesize[0], 100);
+ draw_arrow(ptr, sx, sy, mx, my, width, height, pict->linesize[0], 100, 0, direction);
}
}
}