int main(int argc, char **argv) { AVCodecContext *ctx; int c; MECmpContext cctx, mmxctx; int flags[2] = { AV_CPU_FLAG_MMX, AV_CPU_FLAG_MMXEXT }; int flags_size = HAVE_MMXEXT ? 2 : 1; if (argc > 1) { help(); return 1; } printf("ffmpeg motion test\n"); ctx = avcodec_alloc_context3(NULL); ctx->flags |= CODEC_FLAG_BITEXACT; av_force_cpu_flags(0); memset(&cctx, 0, sizeof(cctx)); ff_me_cmp_init(&cctx, ctx); for (c = 0; c < flags_size; c++) { int x; av_force_cpu_flags(flags[c]); memset(&mmxctx, 0, sizeof(mmxctx)); ff_me_cmp_init(&mmxctx, ctx); for (x = 0; x < 2; x++) { printf("%s for %dx%d pixels\n", c ? "mmx2" : "mmx", x ? 8 : 16, x ? 8 : 16); test_motion("mmx", mmxctx.pix_abs[x][0], cctx.pix_abs[x][0]); test_motion("mmx_x2", mmxctx.pix_abs[x][1], cctx.pix_abs[x][1]); test_motion("mmx_y2", mmxctx.pix_abs[x][2], cctx.pix_abs[x][2]); test_motion("mmx_xy2", mmxctx.pix_abs[x][3], cctx.pix_abs[x][3]); } } av_free(ctx); return 0; }
static av_cold int dvvideo_encode_init(AVCodecContext *avctx) { DVVideoContext *s = avctx->priv_data; FDCTDSPContext fdsp; MECmpContext mecc; PixblockDSPContext pdsp; int ret; s->sys = avpriv_dv_codec_profile(avctx); if (!s->sys) { av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. " "Valid DV profiles are:\n", avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt)); ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } if (avctx->height > 576) { av_log(avctx, AV_LOG_ERROR, "DVCPRO HD encoding is not supported.\n"); return AVERROR_PATCHWELCOME; } ret = ff_dv_init_dynamic_tables(s, s->sys); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n"); return ret; } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); dv_vlc_map_tableinit(); memset(&fdsp,0, sizeof(fdsp)); memset(&mecc,0, sizeof(mecc)); memset(&pdsp,0, sizeof(pdsp)); ff_fdctdsp_init(&fdsp, avctx); ff_me_cmp_init(&mecc, avctx); ff_pixblockdsp_init(&pdsp, avctx); ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp); s->get_pixels = pdsp.get_pixels; s->ildct_cmp = mecc.ildct_cmp[5]; s->fdct[0] = fdsp.fdct; s->fdct[1] = fdsp.fdct248; return ff_dvvideo_init(avctx); }