1 /*
2 * H.26L/H.264/AVC/JVT/14496-10/... decoder
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
23
24 #undef MCFUNC
25
26 #if CHROMA_IDC == 1
27 # define MCFUNC(n) FUNC(n ## _420)
28 #elif CHROMA_IDC == 2
29 # define MCFUNC(n) FUNC(n ## _422)
30 #elif CHROMA_IDC == 3
31 # define MCFUNC(n) FUNC(n ## _444)
32 #endif
33
34 #undef mc_part
35 #define mc_part MCFUNC(mc_part)
36
40 uint8_t *dest_y, uint8_t *dest_cb,
41 uint8_t *dest_cr,
42 int x_offset, int y_offset,
49 int list0, int list1)
50 {
55 x_offset, y_offset, qpix_put, chroma_put,
56 weight_op[0], weight_op[1], weight_avg[0],
58 else
60 x_offset, y_offset, qpix_put, chroma_put, qpix_avg,
62 }
63
65 uint8_t *dest_y,
66 uint8_t *dest_cb, uint8_t *dest_cr,
73 {
74 const int mb_xy = sl->mb_xy;
75 const int mb_type =
h->cur_pic.mb_type[mb_xy];
76
78
83
85 mc_part(
h, sl, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,
86 qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],
87 weight_op, weight_avg,
90 mc_part(
h, sl, 0, 0, 8, 8 <<
PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 0,
91 qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
92 weight_op, weight_avg,
94 mc_part(
h, sl, 8, 0, 8, 8 <<
PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 4,
95 qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
96 weight_op, weight_avg,
99 mc_part(
h, sl, 0, 0, 16, 8 * sl->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
100 qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
101 &weight_op[1], &weight_avg[1],
103 mc_part(
h, sl, 4, 0, 16, 8 * sl->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
104 qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
105 &weight_op[1], &weight_avg[1],
107 } else {
109
111
112 for (
i = 0;
i < 4;
i++) {
113 const int sub_mb_type = sl->sub_mb_type[
i];
115 int x_offset = (
i & 1) << 2;
116 int y_offset = (
i & 2) << 1;
117
119 mc_part(
h, sl, n, 1, 8, 0, dest_y, dest_cb, dest_cr,
120 x_offset, y_offset,
121 qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
122 &weight_op[1], &weight_avg[1],
126 x_offset, y_offset,
127 qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
128 &weight_op[1], &weight_avg[1],
131 dest_y, dest_cb, dest_cr, x_offset, y_offset + 2,
132 qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
133 &weight_op[1], &weight_avg[1],
136 mc_part(
h, sl, n, 0, 8, 4 * sl->mb_linesize,
137 dest_y, dest_cb, dest_cr, x_offset, y_offset,
138 qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
139 &weight_op[2], &weight_avg[2],
141 mc_part(
h, sl, n + 1, 0, 8, 4 * sl->mb_linesize,
142 dest_y, dest_cb, dest_cr, x_offset + 2, y_offset,
143 qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
144 &weight_op[2], &weight_avg[2],
146 } else {
147 int j;
149 for (j = 0; j < 4; j++) {
150 int sub_x_offset = x_offset + 2 * (j & 1);
151 int sub_y_offset = y_offset + (j & 2);
153 dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,
154 qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
155 &weight_op[2], &weight_avg[2],
157 }
158 }
159 }
160 }
161
164 }
165