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