1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * VC-1 and WMV3 decoder 3cabdff1aSopenharmony_ci * Copyright (c) 2006-2007 Konstantin Shishkov 4cabdff1aSopenharmony_ci * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer 5cabdff1aSopenharmony_ci * 6cabdff1aSopenharmony_ci * This file is part of FFmpeg. 7cabdff1aSopenharmony_ci * 8cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or 9cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public 10cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either 11cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 12cabdff1aSopenharmony_ci * 13cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful, 14cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 15cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16cabdff1aSopenharmony_ci * Lesser General Public License for more details. 17cabdff1aSopenharmony_ci * 18cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public 19cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software 20cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21cabdff1aSopenharmony_ci */ 22cabdff1aSopenharmony_ci 23cabdff1aSopenharmony_ci#ifndef AVCODEC_VC1_PRED_H 24cabdff1aSopenharmony_ci#define AVCODEC_VC1_PRED_H 25cabdff1aSopenharmony_ci 26cabdff1aSopenharmony_ci#include "vc1.h" 27cabdff1aSopenharmony_ci#include "vc1data.h" 28cabdff1aSopenharmony_ci 29cabdff1aSopenharmony_civoid ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, 30cabdff1aSopenharmony_ci int mv1, int r_x, int r_y, uint8_t* is_intra, 31cabdff1aSopenharmony_ci int pred_flag, int dir); 32cabdff1aSopenharmony_civoid ff_vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, 33cabdff1aSopenharmony_ci int mvn, int r_x, int r_y, int dir); 34cabdff1aSopenharmony_civoid ff_vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], 35cabdff1aSopenharmony_ci int direct, int mvtype); 36cabdff1aSopenharmony_civoid ff_vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dmv_y, 37cabdff1aSopenharmony_ci int mv1, int *pred_flag); 38cabdff1aSopenharmony_ci 39cabdff1aSopenharmony_cistatic av_always_inline int scale_mv(int value, int bfrac, int inv, int qs) 40cabdff1aSopenharmony_ci{ 41cabdff1aSopenharmony_ci int n = bfrac; 42cabdff1aSopenharmony_ci 43cabdff1aSopenharmony_ci#if B_FRACTION_DEN==256 44cabdff1aSopenharmony_ci if (inv) 45cabdff1aSopenharmony_ci n -= 256; 46cabdff1aSopenharmony_ci if (!qs) 47cabdff1aSopenharmony_ci return 2 * ((value * n + 255) >> 9); 48cabdff1aSopenharmony_ci return (value * n + 128) >> 8; 49cabdff1aSopenharmony_ci#else 50cabdff1aSopenharmony_ci if (inv) 51cabdff1aSopenharmony_ci n -= B_FRACTION_DEN; 52cabdff1aSopenharmony_ci if (!qs) 53cabdff1aSopenharmony_ci return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN)); 54cabdff1aSopenharmony_ci return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN; 55cabdff1aSopenharmony_ci#endif 56cabdff1aSopenharmony_ci} 57cabdff1aSopenharmony_ci 58cabdff1aSopenharmony_ci#endif /* AVCODEC_VC1_PRED_H */ 59