/src/ffmpeg/libavcodec/ffv1_template.c
Line | Count | Source |
1 | | /* |
2 | | * FFV1 codec |
3 | | * |
4 | | * Copyright (c) 2003-2013 Michael Niedermayer <michaelni@gmx.at> |
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 | | static inline int RENAME(predict)(TYPE *src, TYPE *last) |
24 | 1.03G | { |
25 | 1.03G | const int LT = last[-1]; |
26 | 1.03G | const int T = last[0]; |
27 | 1.03G | const int L = src[-1]; |
28 | | |
29 | 1.03G | return mid_pred(L, L + T - LT, T); |
30 | 1.03G | } Line | Count | Source | 24 | 494M | { | 25 | 494M | const int LT = last[-1]; | 26 | 494M | const int T = last[0]; | 27 | 494M | const int L = src[-1]; | 28 | | | 29 | 494M | return mid_pred(L, L + T - LT, T); | 30 | 494M | } |
Line | Count | Source | 24 | 74.1M | { | 25 | 74.1M | const int LT = last[-1]; | 26 | 74.1M | const int T = last[0]; | 27 | 74.1M | const int L = src[-1]; | 28 | | | 29 | 74.1M | return mid_pred(L, L + T - LT, T); | 30 | 74.1M | } |
Line | Count | Source | 24 | 186M | { | 25 | 186M | const int LT = last[-1]; | 26 | 186M | const int T = last[0]; | 27 | 186M | const int L = src[-1]; | 28 | | | 29 | 186M | return mid_pred(L, L + T - LT, T); | 30 | 186M | } |
Line | Count | Source | 24 | 279M | { | 25 | 279M | const int LT = last[-1]; | 26 | 279M | const int T = last[0]; | 27 | 279M | const int L = src[-1]; | 28 | | | 29 | 279M | return mid_pred(L, L + T - LT, T); | 30 | 279M | } |
|
31 | | |
32 | | static inline int RENAME(get_context)(const int16_t quant_table[MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE], |
33 | | TYPE *src, TYPE *last, TYPE *last2) |
34 | 541M | { |
35 | 541M | const int LT = last[-1]; |
36 | 541M | const int T = last[0]; |
37 | 541M | const int RT = last[1]; |
38 | 541M | const int L = src[-1]; |
39 | | |
40 | 541M | if (quant_table[3][127] || quant_table[4][127]) { |
41 | 125M | const int TT = last2[0]; |
42 | 125M | const int LL = src[-2]; |
43 | 125M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + |
44 | 125M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + |
45 | 125M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK] + |
46 | 125M | quant_table[3][(LL - L) & MAX_QUANT_TABLE_MASK] + |
47 | 125M | quant_table[4][(TT - T) & MAX_QUANT_TABLE_MASK]; |
48 | 125M | } else |
49 | 416M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + |
50 | 416M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + |
51 | 416M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK]; |
52 | 541M | } Line | Count | Source | 34 | 67.3M | { | 35 | 67.3M | const int LT = last[-1]; | 36 | 67.3M | const int T = last[0]; | 37 | 67.3M | const int RT = last[1]; | 38 | 67.3M | const int L = src[-1]; | 39 | | | 40 | 67.3M | if (quant_table[3][127] || quant_table[4][127]) { | 41 | 4.82M | const int TT = last2[0]; | 42 | 4.82M | const int LL = src[-2]; | 43 | 4.82M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 44 | 4.82M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 45 | 4.82M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK] + | 46 | 4.82M | quant_table[3][(LL - L) & MAX_QUANT_TABLE_MASK] + | 47 | 4.82M | quant_table[4][(TT - T) & MAX_QUANT_TABLE_MASK]; | 48 | 4.82M | } else | 49 | 62.5M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 50 | 62.5M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 51 | 62.5M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK]; | 52 | 67.3M | } |
Line | Count | Source | 34 | 7.87M | { | 35 | 7.87M | const int LT = last[-1]; | 36 | 7.87M | const int T = last[0]; | 37 | 7.87M | const int RT = last[1]; | 38 | 7.87M | const int L = src[-1]; | 39 | | | 40 | 7.87M | if (quant_table[3][127] || quant_table[4][127]) { | 41 | 5.39M | const int TT = last2[0]; | 42 | 5.39M | const int LL = src[-2]; | 43 | 5.39M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 44 | 5.39M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 45 | 5.39M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK] + | 46 | 5.39M | quant_table[3][(LL - L) & MAX_QUANT_TABLE_MASK] + | 47 | 5.39M | quant_table[4][(TT - T) & MAX_QUANT_TABLE_MASK]; | 48 | 5.39M | } else | 49 | 2.48M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 50 | 2.48M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 51 | 2.48M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK]; | 52 | 7.87M | } |
Line | Count | Source | 34 | 186M | { | 35 | 186M | const int LT = last[-1]; | 36 | 186M | const int T = last[0]; | 37 | 186M | const int RT = last[1]; | 38 | 186M | const int L = src[-1]; | 39 | | | 40 | 186M | if (quant_table[3][127] || quant_table[4][127]) { | 41 | 40.2M | const int TT = last2[0]; | 42 | 40.2M | const int LL = src[-2]; | 43 | 40.2M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 44 | 40.2M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 45 | 40.2M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK] + | 46 | 40.2M | quant_table[3][(LL - L) & MAX_QUANT_TABLE_MASK] + | 47 | 40.2M | quant_table[4][(TT - T) & MAX_QUANT_TABLE_MASK]; | 48 | 40.2M | } else | 49 | 146M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 50 | 146M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 51 | 146M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK]; | 52 | 186M | } |
Line | Count | Source | 34 | 279M | { | 35 | 279M | const int LT = last[-1]; | 36 | 279M | const int T = last[0]; | 37 | 279M | const int RT = last[1]; | 38 | 279M | const int L = src[-1]; | 39 | | | 40 | 279M | if (quant_table[3][127] || quant_table[4][127]) { | 41 | 74.6M | const int TT = last2[0]; | 42 | 74.6M | const int LL = src[-2]; | 43 | 74.6M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 44 | 74.6M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 45 | 74.6M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK] + | 46 | 74.6M | quant_table[3][(LL - L) & MAX_QUANT_TABLE_MASK] + | 47 | 74.6M | quant_table[4][(TT - T) & MAX_QUANT_TABLE_MASK]; | 48 | 74.6M | } else | 49 | 204M | return quant_table[0][(L - LT) & MAX_QUANT_TABLE_MASK] + | 50 | 204M | quant_table[1][(LT - T) & MAX_QUANT_TABLE_MASK] + | 51 | 204M | quant_table[2][(T - RT) & MAX_QUANT_TABLE_MASK]; | 52 | 279M | } |
|