/src/ffmpeg/libavcodec/h264_mb_template.c
Line | Count | Source |
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 | | |
22 | | #undef FUNC |
23 | | #undef PIXEL_SHIFT |
24 | | |
25 | | #if SIMPLE |
26 | 79.9M | # define FUNC(n) AV_JOIN(n ## _simple_, BITS) |
27 | 316M | # define PIXEL_SHIFT (BITS >> 4) |
28 | | #else |
29 | 135M | # define FUNC(n) n ## _complex |
30 | 547M | # define PIXEL_SHIFT h->pixel_shift |
31 | | #endif |
32 | | |
33 | | #undef CHROMA_IDC |
34 | 134M | #define CHROMA_IDC 1 |
35 | | #include "h264_mc_template.c" |
36 | | |
37 | | #undef CHROMA_IDC |
38 | 74.4M | #define CHROMA_IDC 2 |
39 | | #include "h264_mc_template.c" |
40 | | |
41 | | static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContext *sl) |
42 | 89.4M | { |
43 | 89.4M | const int mb_x = sl->mb_x; |
44 | 89.4M | const int mb_y = sl->mb_y; |
45 | 89.4M | const int mb_xy = sl->mb_xy; |
46 | 89.4M | const int mb_type = h->cur_pic.mb_type[mb_xy]; |
47 | 89.4M | uint8_t *dest_y, *dest_cb, *dest_cr; |
48 | 89.4M | int linesize, uvlinesize /*dct_offset*/; |
49 | 89.4M | int i, j; |
50 | 89.4M | const int *block_offset = &h->block_offset[0]; |
51 | 89.4M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); |
52 | 89.4M | void (*idct_add)(uint8_t *dst, int16_t *block, int stride); |
53 | 89.4M | const int block_h = 16 >> h->chroma_y_shift; |
54 | 89.4M | const int chroma422 = CHROMA422(h); |
55 | | |
56 | 89.4M | dest_y = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; |
57 | 89.4M | dest_cb = h->cur_pic.f->data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; |
58 | 89.4M | dest_cr = h->cur_pic.f->data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; |
59 | | |
60 | 89.4M | h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4); |
61 | 89.4M | h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); |
62 | | |
63 | 89.4M | h->list_counts[mb_xy] = sl->list_count; |
64 | | |
65 | 89.4M | if (!SIMPLE && MB_FIELD(sl)) { |
66 | 14.2M | linesize = sl->mb_linesize = sl->linesize * 2; |
67 | 14.2M | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2; |
68 | 14.2M | block_offset = &h->block_offset[48]; |
69 | 14.2M | if (mb_y & 1) { // FIXME move out of this function? |
70 | 3.54M | dest_y -= sl->linesize * 15; |
71 | 3.54M | dest_cb -= sl->uvlinesize * (block_h - 1); |
72 | 3.54M | dest_cr -= sl->uvlinesize * (block_h - 1); |
73 | 3.54M | } |
74 | 14.2M | if (FRAME_MBAFF(h)) { |
75 | 5.02M | int list; |
76 | 12.5M | for (list = 0; list < sl->list_count; list++) { |
77 | 7.51M | if (!USES_LIST(mb_type, list)) |
78 | 1.33M | continue; |
79 | 6.18M | if (IS_16X16(mb_type)) { |
80 | 4.65M | int8_t *ref = &sl->ref_cache[list][scan8[0]]; |
81 | 4.65M | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); |
82 | 4.65M | } else { |
83 | 7.64M | for (i = 0; i < 16; i += 4) { |
84 | 6.11M | int ref = sl->ref_cache[list][scan8[i]]; |
85 | 6.11M | if (ref >= 0) |
86 | 5.58M | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, |
87 | 5.58M | 8, (16 + ref) ^ (sl->mb_y & 1), 1); |
88 | 6.11M | } |
89 | 1.52M | } |
90 | 6.18M | } |
91 | 5.02M | } |
92 | 75.1M | } else { |
93 | 75.1M | linesize = sl->mb_linesize = sl->linesize; |
94 | 75.1M | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize; |
95 | | // dct_offset = s->linesize * 16; |
96 | 75.1M | } |
97 | | |
98 | 89.4M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { |
99 | 2.97k | const int bit_depth = h->ps.sps->bit_depth_luma; |
100 | 2.97k | if (PIXEL_SHIFT) { |
101 | 819 | int j; |
102 | 819 | GetBitContext gb; |
103 | 819 | init_get_bits(&gb, sl->intra_pcm_ptr, |
104 | 819 | ff_h264_mb_sizes[h->ps.sps->chroma_format_idc] * bit_depth); |
105 | | |
106 | 13.9k | for (i = 0; i < 16; i++) { |
107 | 13.1k | uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize); |
108 | 222k | for (j = 0; j < 16; j++) |
109 | 209k | tmp_y[j] = get_bits(&gb, bit_depth); |
110 | 13.1k | } |
111 | 819 | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { |
112 | 819 | if (!h->ps.sps->chroma_format_idc) { |
113 | 1.41k | for (i = 0; i < block_h; i++) { |
114 | 1.25k | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); |
115 | 1.25k | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); |
116 | 11.3k | for (j = 0; j < 8; j++) { |
117 | 10.0k | tmp_cb[j] = tmp_cr[j] = 1 << (bit_depth - 1); |
118 | 10.0k | } |
119 | 1.25k | } |
120 | 662 | } else { |
121 | 8.18k | for (i = 0; i < block_h; i++) { |
122 | 7.52k | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); |
123 | 67.6k | for (j = 0; j < 8; j++) |
124 | 60.1k | tmp_cb[j] = get_bits(&gb, bit_depth); |
125 | 7.52k | } |
126 | 8.18k | for (i = 0; i < block_h; i++) { |
127 | 7.52k | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); |
128 | 67.6k | for (j = 0; j < 8; j++) |
129 | 60.1k | tmp_cr[j] = get_bits(&gb, bit_depth); |
130 | 7.52k | } |
131 | 662 | } |
132 | 819 | } |
133 | 2.15k | } else { |
134 | 36.5k | for (i = 0; i < 16; i++) |
135 | 34.4k | memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16); |
136 | 2.15k | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { |
137 | 2.15k | if (!h->ps.sps->chroma_format_idc) { |
138 | 72 | for (i = 0; i < 8; i++) { |
139 | 64 | memset(dest_cb + i * uvlinesize, 1 << (bit_depth - 1), 8); |
140 | 64 | memset(dest_cr + i * uvlinesize, 1 << (bit_depth - 1), 8); |
141 | 64 | } |
142 | 2.14k | } else { |
143 | 2.14k | const uint8_t *src_cb = sl->intra_pcm_ptr + 256; |
144 | 2.14k | const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8; |
145 | 19.4k | for (i = 0; i < block_h; i++) { |
146 | 17.2k | memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8); |
147 | 17.2k | memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8); |
148 | 17.2k | } |
149 | 2.14k | } |
150 | 2.15k | } |
151 | 2.15k | } |
152 | 89.4M | } else { |
153 | 89.4M | if (IS_INTRA(mb_type)) { |
154 | 3.78M | if (sl->deblocking_filter) |
155 | 3.74M | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, |
156 | 3.74M | uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT); |
157 | | |
158 | 3.78M | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { |
159 | 3.78M | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize); |
160 | 3.78M | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize); |
161 | 3.78M | } |
162 | | |
163 | 3.78M | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, |
164 | 3.78M | transform_bypass, PIXEL_SHIFT, |
165 | 3.78M | block_offset, linesize, dest_y, 0); |
166 | | |
167 | 3.78M | if (sl->deblocking_filter) |
168 | 3.74M | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, |
169 | 3.74M | uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT); |
170 | 85.6M | } else { |
171 | 85.6M | if (chroma422) { |
172 | 28.2M | FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, |
173 | 28.2M | h->h264qpel.put_h264_qpel_pixels_tab, |
174 | 28.2M | h->h264chroma.put_h264_chroma_pixels_tab, |
175 | 28.2M | h->h264qpel.avg_h264_qpel_pixels_tab, |
176 | 28.2M | h->h264chroma.avg_h264_chroma_pixels_tab, |
177 | 28.2M | h->h264dsp.weight_pixels_tab, |
178 | 28.2M | h->h264dsp.biweight_pixels_tab); |
179 | 57.4M | } else { |
180 | 57.4M | FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, |
181 | 57.4M | h->h264qpel.put_h264_qpel_pixels_tab, |
182 | 57.4M | h->h264chroma.put_h264_chroma_pixels_tab, |
183 | 57.4M | h->h264qpel.avg_h264_qpel_pixels_tab, |
184 | 57.4M | h->h264chroma.avg_h264_chroma_pixels_tab, |
185 | 57.4M | h->h264dsp.weight_pixels_tab, |
186 | 57.4M | h->h264dsp.biweight_pixels_tab); |
187 | 57.4M | } |
188 | 85.6M | } |
189 | | |
190 | 89.4M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, |
191 | 89.4M | PIXEL_SHIFT, block_offset, linesize, dest_y, 0); |
192 | | |
193 | 89.4M | if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) && |
194 | 89.4M | (sl->cbp & 0x30)) { |
195 | 16.8M | uint8_t *dest[2] = { dest_cb, dest_cr }; |
196 | 16.8M | if (transform_bypass) { |
197 | 163k | if (IS_INTRA(mb_type) && h->ps.sps->profile_idc == 244 && |
198 | 38.7k | (sl->chroma_pred_mode == VERT_PRED8x8 || |
199 | 31.7k | sl->chroma_pred_mode == HOR_PRED8x8)) { |
200 | 22.8k | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], |
201 | 22.8k | block_offset + 16, |
202 | 22.8k | sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), |
203 | 22.8k | uvlinesize); |
204 | 22.8k | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], |
205 | 22.8k | block_offset + 32, |
206 | 22.8k | sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), |
207 | 22.8k | uvlinesize); |
208 | 140k | } else { |
209 | 140k | idct_add = h->h264dsp.add_pixels4_clear; |
210 | 420k | for (j = 1; j < 3; j++) { |
211 | 1.40M | for (i = j * 16; i < j * 16 + 4; i++) |
212 | 1.12M | if (sl->non_zero_count_cache[scan8[i]] || |
213 | 1.04M | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) |
214 | 113k | idct_add(dest[j - 1] + block_offset[i], |
215 | 113k | sl->mb + (i * 16 << PIXEL_SHIFT), |
216 | 113k | uvlinesize); |
217 | 280k | if (chroma422) { |
218 | 288k | for (i = j * 16 + 4; i < j * 16 + 8; i++) |
219 | 230k | if (sl->non_zero_count_cache[scan8[i + 4]] || |
220 | 210k | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) |
221 | 22.3k | idct_add(dest[j - 1] + block_offset[i + 4], |
222 | 22.3k | sl->mb + (i * 16 << PIXEL_SHIFT), |
223 | 22.3k | uvlinesize); |
224 | 57.7k | } |
225 | 280k | } |
226 | 140k | } |
227 | 16.6M | } else { |
228 | 16.6M | int qp[2]; |
229 | 16.6M | if (chroma422) { |
230 | 5.61M | qp[0] = sl->chroma_qp[0] + 3; |
231 | 5.61M | qp[1] = sl->chroma_qp[1] + 3; |
232 | 11.0M | } else { |
233 | 11.0M | qp[0] = sl->chroma_qp[0]; |
234 | 11.0M | qp[1] = sl->chroma_qp[1]; |
235 | 11.0M | } |
236 | 16.6M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) |
237 | 2.69M | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), |
238 | 2.69M | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); |
239 | 16.6M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) |
240 | 2.49M | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), |
241 | 2.49M | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); |
242 | 16.6M | h->h264dsp.idct_add8(dest, block_offset, |
243 | 16.6M | sl->mb, uvlinesize, |
244 | 16.6M | sl->non_zero_count_cache); |
245 | 16.6M | } |
246 | 16.8M | } |
247 | 89.4M | } |
248 | 89.4M | } h264_mb.c:hl_decode_mb_complex Line | Count | Source | 42 | 54.0M | { | 43 | 54.0M | const int mb_x = sl->mb_x; | 44 | 54.0M | const int mb_y = sl->mb_y; | 45 | 54.0M | const int mb_xy = sl->mb_xy; | 46 | 54.0M | const int mb_type = h->cur_pic.mb_type[mb_xy]; | 47 | 54.0M | uint8_t *dest_y, *dest_cb, *dest_cr; | 48 | 54.0M | int linesize, uvlinesize /*dct_offset*/; | 49 | 54.0M | int i, j; | 50 | 54.0M | const int *block_offset = &h->block_offset[0]; | 51 | 54.0M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); | 52 | 54.0M | void (*idct_add)(uint8_t *dst, int16_t *block, int stride); | 53 | 54.0M | const int block_h = 16 >> h->chroma_y_shift; | 54 | 54.0M | const int chroma422 = CHROMA422(h); | 55 | | | 56 | 54.0M | dest_y = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; | 57 | 54.0M | dest_cb = h->cur_pic.f->data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; | 58 | 54.0M | dest_cr = h->cur_pic.f->data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; | 59 | | | 60 | 54.0M | h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4); | 61 | 54.0M | h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); | 62 | | | 63 | 54.0M | h->list_counts[mb_xy] = sl->list_count; | 64 | | | 65 | 54.0M | if (!SIMPLE && MB_FIELD(sl)) { | 66 | 14.2M | linesize = sl->mb_linesize = sl->linesize * 2; | 67 | 14.2M | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2; | 68 | 14.2M | block_offset = &h->block_offset[48]; | 69 | 14.2M | if (mb_y & 1) { // FIXME move out of this function? | 70 | 3.54M | dest_y -= sl->linesize * 15; | 71 | 3.54M | dest_cb -= sl->uvlinesize * (block_h - 1); | 72 | 3.54M | dest_cr -= sl->uvlinesize * (block_h - 1); | 73 | 3.54M | } | 74 | 14.2M | if (FRAME_MBAFF(h)) { | 75 | 5.02M | int list; | 76 | 12.5M | for (list = 0; list < sl->list_count; list++) { | 77 | 7.51M | if (!USES_LIST(mb_type, list)) | 78 | 1.33M | continue; | 79 | 6.18M | if (IS_16X16(mb_type)) { | 80 | 4.65M | int8_t *ref = &sl->ref_cache[list][scan8[0]]; | 81 | 4.65M | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); | 82 | 4.65M | } else { | 83 | 7.64M | for (i = 0; i < 16; i += 4) { | 84 | 6.11M | int ref = sl->ref_cache[list][scan8[i]]; | 85 | 6.11M | if (ref >= 0) | 86 | 5.58M | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, | 87 | 5.58M | 8, (16 + ref) ^ (sl->mb_y & 1), 1); | 88 | 6.11M | } | 89 | 1.52M | } | 90 | 6.18M | } | 91 | 5.02M | } | 92 | 39.7M | } else { | 93 | 39.7M | linesize = sl->mb_linesize = sl->linesize; | 94 | 39.7M | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize; | 95 | | // dct_offset = s->linesize * 16; | 96 | 39.7M | } | 97 | | | 98 | 54.0M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { | 99 | 2.97k | const int bit_depth = h->ps.sps->bit_depth_luma; | 100 | 2.97k | if (PIXEL_SHIFT) { | 101 | 819 | int j; | 102 | 819 | GetBitContext gb; | 103 | 819 | init_get_bits(&gb, sl->intra_pcm_ptr, | 104 | 819 | ff_h264_mb_sizes[h->ps.sps->chroma_format_idc] * bit_depth); | 105 | | | 106 | 13.9k | for (i = 0; i < 16; i++) { | 107 | 13.1k | uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize); | 108 | 222k | for (j = 0; j < 16; j++) | 109 | 209k | tmp_y[j] = get_bits(&gb, bit_depth); | 110 | 13.1k | } | 111 | 819 | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 112 | 819 | if (!h->ps.sps->chroma_format_idc) { | 113 | 1.41k | for (i = 0; i < block_h; i++) { | 114 | 1.25k | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); | 115 | 1.25k | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); | 116 | 11.3k | for (j = 0; j < 8; j++) { | 117 | 10.0k | tmp_cb[j] = tmp_cr[j] = 1 << (bit_depth - 1); | 118 | 10.0k | } | 119 | 1.25k | } | 120 | 662 | } else { | 121 | 8.18k | for (i = 0; i < block_h; i++) { | 122 | 7.52k | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); | 123 | 67.6k | for (j = 0; j < 8; j++) | 124 | 60.1k | tmp_cb[j] = get_bits(&gb, bit_depth); | 125 | 7.52k | } | 126 | 8.18k | for (i = 0; i < block_h; i++) { | 127 | 7.52k | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); | 128 | 67.6k | for (j = 0; j < 8; j++) | 129 | 60.1k | tmp_cr[j] = get_bits(&gb, bit_depth); | 130 | 7.52k | } | 131 | 662 | } | 132 | 819 | } | 133 | 2.15k | } else { | 134 | 36.5k | for (i = 0; i < 16; i++) | 135 | 34.4k | memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16); | 136 | 2.15k | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 137 | 2.15k | if (!h->ps.sps->chroma_format_idc) { | 138 | 72 | for (i = 0; i < 8; i++) { | 139 | 64 | memset(dest_cb + i * uvlinesize, 1 << (bit_depth - 1), 8); | 140 | 64 | memset(dest_cr + i * uvlinesize, 1 << (bit_depth - 1), 8); | 141 | 64 | } | 142 | 2.14k | } else { | 143 | 2.14k | const uint8_t *src_cb = sl->intra_pcm_ptr + 256; | 144 | 2.14k | const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8; | 145 | 19.4k | for (i = 0; i < block_h; i++) { | 146 | 17.2k | memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8); | 147 | 17.2k | memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8); | 148 | 17.2k | } | 149 | 2.14k | } | 150 | 2.15k | } | 151 | 2.15k | } | 152 | 54.0M | } else { | 153 | 54.0M | if (IS_INTRA(mb_type)) { | 154 | 1.16M | if (sl->deblocking_filter) | 155 | 1.14M | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, | 156 | 1.14M | uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT); | 157 | | | 158 | 1.16M | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 159 | 1.16M | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize); | 160 | 1.16M | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize); | 161 | 1.16M | } | 162 | | | 163 | 1.16M | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, | 164 | 1.16M | transform_bypass, PIXEL_SHIFT, | 165 | 1.16M | block_offset, linesize, dest_y, 0); | 166 | | | 167 | 1.16M | if (sl->deblocking_filter) | 168 | 1.14M | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, | 169 | 1.14M | uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT); | 170 | 52.8M | } else { | 171 | 52.8M | if (chroma422) { | 172 | 21.9M | FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, | 173 | 21.9M | h->h264qpel.put_h264_qpel_pixels_tab, | 174 | 21.9M | h->h264chroma.put_h264_chroma_pixels_tab, | 175 | 21.9M | h->h264qpel.avg_h264_qpel_pixels_tab, | 176 | 21.9M | h->h264chroma.avg_h264_chroma_pixels_tab, | 177 | 21.9M | h->h264dsp.weight_pixels_tab, | 178 | 21.9M | h->h264dsp.biweight_pixels_tab); | 179 | 30.9M | } else { | 180 | 30.9M | FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, | 181 | 30.9M | h->h264qpel.put_h264_qpel_pixels_tab, | 182 | 30.9M | h->h264chroma.put_h264_chroma_pixels_tab, | 183 | 30.9M | h->h264qpel.avg_h264_qpel_pixels_tab, | 184 | 30.9M | h->h264chroma.avg_h264_chroma_pixels_tab, | 185 | 30.9M | h->h264dsp.weight_pixels_tab, | 186 | 30.9M | h->h264dsp.biweight_pixels_tab); | 187 | 30.9M | } | 188 | 52.8M | } | 189 | | | 190 | 54.0M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, | 191 | 54.0M | PIXEL_SHIFT, block_offset, linesize, dest_y, 0); | 192 | | | 193 | 54.0M | if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) && | 194 | 54.0M | (sl->cbp & 0x30)) { | 195 | 10.2M | uint8_t *dest[2] = { dest_cb, dest_cr }; | 196 | 10.2M | if (transform_bypass) { | 197 | 163k | if (IS_INTRA(mb_type) && h->ps.sps->profile_idc == 244 && | 198 | 38.7k | (sl->chroma_pred_mode == VERT_PRED8x8 || | 199 | 31.7k | sl->chroma_pred_mode == HOR_PRED8x8)) { | 200 | 22.8k | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], | 201 | 22.8k | block_offset + 16, | 202 | 22.8k | sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | 203 | 22.8k | uvlinesize); | 204 | 22.8k | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], | 205 | 22.8k | block_offset + 32, | 206 | 22.8k | sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | 207 | 22.8k | uvlinesize); | 208 | 140k | } else { | 209 | 140k | idct_add = h->h264dsp.add_pixels4_clear; | 210 | 420k | for (j = 1; j < 3; j++) { | 211 | 1.40M | for (i = j * 16; i < j * 16 + 4; i++) | 212 | 1.12M | if (sl->non_zero_count_cache[scan8[i]] || | 213 | 1.04M | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | 214 | 113k | idct_add(dest[j - 1] + block_offset[i], | 215 | 113k | sl->mb + (i * 16 << PIXEL_SHIFT), | 216 | 113k | uvlinesize); | 217 | 280k | if (chroma422) { | 218 | 288k | for (i = j * 16 + 4; i < j * 16 + 8; i++) | 219 | 230k | if (sl->non_zero_count_cache[scan8[i + 4]] || | 220 | 210k | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | 221 | 22.3k | idct_add(dest[j - 1] + block_offset[i + 4], | 222 | 22.3k | sl->mb + (i * 16 << PIXEL_SHIFT), | 223 | 22.3k | uvlinesize); | 224 | 57.7k | } | 225 | 280k | } | 226 | 140k | } | 227 | 10.0M | } else { | 228 | 10.0M | int qp[2]; | 229 | 10.0M | if (chroma422) { | 230 | 3.96M | qp[0] = sl->chroma_qp[0] + 3; | 231 | 3.96M | qp[1] = sl->chroma_qp[1] + 3; | 232 | 6.07M | } else { | 233 | 6.07M | qp[0] = sl->chroma_qp[0]; | 234 | 6.07M | qp[1] = sl->chroma_qp[1]; | 235 | 6.07M | } | 236 | 10.0M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) | 237 | 1.77M | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | 238 | 1.77M | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); | 239 | 10.0M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) | 240 | 1.67M | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | 241 | 1.67M | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); | 242 | 10.0M | h->h264dsp.idct_add8(dest, block_offset, | 243 | 10.0M | sl->mb, uvlinesize, | 244 | 10.0M | sl->non_zero_count_cache); | 245 | 10.0M | } | 246 | 10.2M | } | 247 | 54.0M | } | 248 | 54.0M | } |
h264_mb.c:hl_decode_mb_simple_16 Line | Count | Source | 42 | 10.0M | { | 43 | 10.0M | const int mb_x = sl->mb_x; | 44 | 10.0M | const int mb_y = sl->mb_y; | 45 | 10.0M | const int mb_xy = sl->mb_xy; | 46 | 10.0M | const int mb_type = h->cur_pic.mb_type[mb_xy]; | 47 | 10.0M | uint8_t *dest_y, *dest_cb, *dest_cr; | 48 | 10.0M | int linesize, uvlinesize /*dct_offset*/; | 49 | 10.0M | int i, j; | 50 | 10.0M | const int *block_offset = &h->block_offset[0]; | 51 | 10.0M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); | 52 | 10.0M | void (*idct_add)(uint8_t *dst, int16_t *block, int stride); | 53 | 10.0M | const int block_h = 16 >> h->chroma_y_shift; | 54 | 10.0M | const int chroma422 = CHROMA422(h); | 55 | | | 56 | 10.0M | dest_y = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; | 57 | 10.0M | dest_cb = h->cur_pic.f->data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; | 58 | 10.0M | dest_cr = h->cur_pic.f->data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; | 59 | | | 60 | 10.0M | h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4); | 61 | 10.0M | h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); | 62 | | | 63 | 10.0M | h->list_counts[mb_xy] = sl->list_count; | 64 | | | 65 | 10.0M | if (!SIMPLE && MB_FIELD(sl)) { | 66 | 0 | linesize = sl->mb_linesize = sl->linesize * 2; | 67 | 0 | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2; | 68 | 0 | block_offset = &h->block_offset[48]; | 69 | 0 | if (mb_y & 1) { // FIXME move out of this function? | 70 | 0 | dest_y -= sl->linesize * 15; | 71 | 0 | dest_cb -= sl->uvlinesize * (block_h - 1); | 72 | 0 | dest_cr -= sl->uvlinesize * (block_h - 1); | 73 | 0 | } | 74 | 0 | if (FRAME_MBAFF(h)) { | 75 | 0 | int list; | 76 | 0 | for (list = 0; list < sl->list_count; list++) { | 77 | 0 | if (!USES_LIST(mb_type, list)) | 78 | 0 | continue; | 79 | 0 | if (IS_16X16(mb_type)) { | 80 | 0 | int8_t *ref = &sl->ref_cache[list][scan8[0]]; | 81 | 0 | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); | 82 | 0 | } else { | 83 | 0 | for (i = 0; i < 16; i += 4) { | 84 | 0 | int ref = sl->ref_cache[list][scan8[i]]; | 85 | 0 | if (ref >= 0) | 86 | 0 | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, | 87 | 0 | 8, (16 + ref) ^ (sl->mb_y & 1), 1); | 88 | 0 | } | 89 | 0 | } | 90 | 0 | } | 91 | 0 | } | 92 | 10.0M | } else { | 93 | 10.0M | linesize = sl->mb_linesize = sl->linesize; | 94 | 10.0M | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize; | 95 | | // dct_offset = s->linesize * 16; | 96 | 10.0M | } | 97 | | | 98 | 10.0M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { | 99 | 0 | const int bit_depth = h->ps.sps->bit_depth_luma; | 100 | 0 | if (PIXEL_SHIFT) { | 101 | 0 | int j; | 102 | 0 | GetBitContext gb; | 103 | 0 | init_get_bits(&gb, sl->intra_pcm_ptr, | 104 | 0 | ff_h264_mb_sizes[h->ps.sps->chroma_format_idc] * bit_depth); | 105 | |
| 106 | 0 | for (i = 0; i < 16; i++) { | 107 | 0 | uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize); | 108 | 0 | for (j = 0; j < 16; j++) | 109 | 0 | tmp_y[j] = get_bits(&gb, bit_depth); | 110 | 0 | } | 111 | 0 | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 112 | 0 | if (!h->ps.sps->chroma_format_idc) { | 113 | 0 | for (i = 0; i < block_h; i++) { | 114 | 0 | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); | 115 | 0 | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); | 116 | 0 | for (j = 0; j < 8; j++) { | 117 | 0 | tmp_cb[j] = tmp_cr[j] = 1 << (bit_depth - 1); | 118 | 0 | } | 119 | 0 | } | 120 | 0 | } else { | 121 | 0 | for (i = 0; i < block_h; i++) { | 122 | 0 | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); | 123 | 0 | for (j = 0; j < 8; j++) | 124 | 0 | tmp_cb[j] = get_bits(&gb, bit_depth); | 125 | 0 | } | 126 | 0 | for (i = 0; i < block_h; i++) { | 127 | 0 | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); | 128 | 0 | for (j = 0; j < 8; j++) | 129 | 0 | tmp_cr[j] = get_bits(&gb, bit_depth); | 130 | 0 | } | 131 | 0 | } | 132 | 0 | } | 133 | 0 | } else { | 134 | 0 | for (i = 0; i < 16; i++) | 135 | 0 | memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16); | 136 | 0 | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 137 | 0 | if (!h->ps.sps->chroma_format_idc) { | 138 | 0 | for (i = 0; i < 8; i++) { | 139 | 0 | memset(dest_cb + i * uvlinesize, 1 << (bit_depth - 1), 8); | 140 | 0 | memset(dest_cr + i * uvlinesize, 1 << (bit_depth - 1), 8); | 141 | 0 | } | 142 | 0 | } else { | 143 | 0 | const uint8_t *src_cb = sl->intra_pcm_ptr + 256; | 144 | 0 | const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8; | 145 | 0 | for (i = 0; i < block_h; i++) { | 146 | 0 | memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8); | 147 | 0 | memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8); | 148 | 0 | } | 149 | 0 | } | 150 | 0 | } | 151 | 0 | } | 152 | 10.0M | } else { | 153 | 10.0M | if (IS_INTRA(mb_type)) { | 154 | 708k | if (sl->deblocking_filter) | 155 | 705k | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, | 156 | 705k | uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT); | 157 | | | 158 | 708k | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 159 | 708k | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize); | 160 | 708k | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize); | 161 | 708k | } | 162 | | | 163 | 708k | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, | 164 | 708k | transform_bypass, PIXEL_SHIFT, | 165 | 708k | block_offset, linesize, dest_y, 0); | 166 | | | 167 | 708k | if (sl->deblocking_filter) | 168 | 705k | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, | 169 | 705k | uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT); | 170 | 9.34M | } else { | 171 | 9.34M | if (chroma422) { | 172 | 3.07M | FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, | 173 | 3.07M | h->h264qpel.put_h264_qpel_pixels_tab, | 174 | 3.07M | h->h264chroma.put_h264_chroma_pixels_tab, | 175 | 3.07M | h->h264qpel.avg_h264_qpel_pixels_tab, | 176 | 3.07M | h->h264chroma.avg_h264_chroma_pixels_tab, | 177 | 3.07M | h->h264dsp.weight_pixels_tab, | 178 | 3.07M | h->h264dsp.biweight_pixels_tab); | 179 | 6.26M | } else { | 180 | 6.26M | FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, | 181 | 6.26M | h->h264qpel.put_h264_qpel_pixels_tab, | 182 | 6.26M | h->h264chroma.put_h264_chroma_pixels_tab, | 183 | 6.26M | h->h264qpel.avg_h264_qpel_pixels_tab, | 184 | 6.26M | h->h264chroma.avg_h264_chroma_pixels_tab, | 185 | 6.26M | h->h264dsp.weight_pixels_tab, | 186 | 6.26M | h->h264dsp.biweight_pixels_tab); | 187 | 6.26M | } | 188 | 9.34M | } | 189 | | | 190 | 10.0M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, | 191 | 10.0M | PIXEL_SHIFT, block_offset, linesize, dest_y, 0); | 192 | | | 193 | 10.0M | if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) && | 194 | 10.0M | (sl->cbp & 0x30)) { | 195 | 1.96M | uint8_t *dest[2] = { dest_cb, dest_cr }; | 196 | 1.96M | if (transform_bypass) { | 197 | 0 | if (IS_INTRA(mb_type) && h->ps.sps->profile_idc == 244 && | 198 | 0 | (sl->chroma_pred_mode == VERT_PRED8x8 || | 199 | 0 | sl->chroma_pred_mode == HOR_PRED8x8)) { | 200 | 0 | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], | 201 | 0 | block_offset + 16, | 202 | 0 | sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | 203 | 0 | uvlinesize); | 204 | 0 | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], | 205 | 0 | block_offset + 32, | 206 | 0 | sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | 207 | 0 | uvlinesize); | 208 | 0 | } else { | 209 | 0 | idct_add = h->h264dsp.add_pixels4_clear; | 210 | 0 | for (j = 1; j < 3; j++) { | 211 | 0 | for (i = j * 16; i < j * 16 + 4; i++) | 212 | 0 | if (sl->non_zero_count_cache[scan8[i]] || | 213 | 0 | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | 214 | 0 | idct_add(dest[j - 1] + block_offset[i], | 215 | 0 | sl->mb + (i * 16 << PIXEL_SHIFT), | 216 | 0 | uvlinesize); | 217 | 0 | if (chroma422) { | 218 | 0 | for (i = j * 16 + 4; i < j * 16 + 8; i++) | 219 | 0 | if (sl->non_zero_count_cache[scan8[i + 4]] || | 220 | 0 | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | 221 | 0 | idct_add(dest[j - 1] + block_offset[i + 4], | 222 | 0 | sl->mb + (i * 16 << PIXEL_SHIFT), | 223 | 0 | uvlinesize); | 224 | 0 | } | 225 | 0 | } | 226 | 0 | } | 227 | 1.96M | } else { | 228 | 1.96M | int qp[2]; | 229 | 1.96M | if (chroma422) { | 230 | 800k | qp[0] = sl->chroma_qp[0] + 3; | 231 | 800k | qp[1] = sl->chroma_qp[1] + 3; | 232 | 1.16M | } else { | 233 | 1.16M | qp[0] = sl->chroma_qp[0]; | 234 | 1.16M | qp[1] = sl->chroma_qp[1]; | 235 | 1.16M | } | 236 | 1.96M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) | 237 | 369k | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | 238 | 369k | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); | 239 | 1.96M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) | 240 | 366k | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | 241 | 366k | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); | 242 | 1.96M | h->h264dsp.idct_add8(dest, block_offset, | 243 | 1.96M | sl->mb, uvlinesize, | 244 | 1.96M | sl->non_zero_count_cache); | 245 | 1.96M | } | 246 | 1.96M | } | 247 | 10.0M | } | 248 | 10.0M | } |
h264_mb.c:hl_decode_mb_simple_8 Line | Count | Source | 42 | 25.3M | { | 43 | 25.3M | const int mb_x = sl->mb_x; | 44 | 25.3M | const int mb_y = sl->mb_y; | 45 | 25.3M | const int mb_xy = sl->mb_xy; | 46 | 25.3M | const int mb_type = h->cur_pic.mb_type[mb_xy]; | 47 | 25.3M | uint8_t *dest_y, *dest_cb, *dest_cr; | 48 | 25.3M | int linesize, uvlinesize /*dct_offset*/; | 49 | 25.3M | int i, j; | 50 | 25.3M | const int *block_offset = &h->block_offset[0]; | 51 | 25.3M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); | 52 | 25.3M | void (*idct_add)(uint8_t *dst, int16_t *block, int stride); | 53 | 25.3M | const int block_h = 16 >> h->chroma_y_shift; | 54 | 25.3M | const int chroma422 = CHROMA422(h); | 55 | | | 56 | 25.3M | dest_y = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; | 57 | 25.3M | dest_cb = h->cur_pic.f->data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; | 58 | 25.3M | dest_cr = h->cur_pic.f->data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h; | 59 | | | 60 | 25.3M | h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), sl->linesize, 4); | 61 | 25.3M | h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); | 62 | | | 63 | 25.3M | h->list_counts[mb_xy] = sl->list_count; | 64 | | | 65 | 25.3M | if (!SIMPLE && MB_FIELD(sl)) { | 66 | 0 | linesize = sl->mb_linesize = sl->linesize * 2; | 67 | 0 | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2; | 68 | 0 | block_offset = &h->block_offset[48]; | 69 | 0 | if (mb_y & 1) { // FIXME move out of this function? | 70 | 0 | dest_y -= sl->linesize * 15; | 71 | 0 | dest_cb -= sl->uvlinesize * (block_h - 1); | 72 | 0 | dest_cr -= sl->uvlinesize * (block_h - 1); | 73 | 0 | } | 74 | 0 | if (FRAME_MBAFF(h)) { | 75 | 0 | int list; | 76 | 0 | for (list = 0; list < sl->list_count; list++) { | 77 | 0 | if (!USES_LIST(mb_type, list)) | 78 | 0 | continue; | 79 | 0 | if (IS_16X16(mb_type)) { | 80 | 0 | int8_t *ref = &sl->ref_cache[list][scan8[0]]; | 81 | 0 | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); | 82 | 0 | } else { | 83 | 0 | for (i = 0; i < 16; i += 4) { | 84 | 0 | int ref = sl->ref_cache[list][scan8[i]]; | 85 | 0 | if (ref >= 0) | 86 | 0 | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, | 87 | 0 | 8, (16 + ref) ^ (sl->mb_y & 1), 1); | 88 | 0 | } | 89 | 0 | } | 90 | 0 | } | 91 | 0 | } | 92 | 25.3M | } else { | 93 | 25.3M | linesize = sl->mb_linesize = sl->linesize; | 94 | 25.3M | uvlinesize = sl->mb_uvlinesize = sl->uvlinesize; | 95 | | // dct_offset = s->linesize * 16; | 96 | 25.3M | } | 97 | | | 98 | 25.3M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { | 99 | 0 | const int bit_depth = h->ps.sps->bit_depth_luma; | 100 | 0 | if (PIXEL_SHIFT) { | 101 | 0 | int j; | 102 | 0 | GetBitContext gb; | 103 | 0 | init_get_bits(&gb, sl->intra_pcm_ptr, | 104 | 0 | ff_h264_mb_sizes[h->ps.sps->chroma_format_idc] * bit_depth); | 105 | |
| 106 | 0 | for (i = 0; i < 16; i++) { | 107 | 0 | uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize); | 108 | 0 | for (j = 0; j < 16; j++) | 109 | 0 | tmp_y[j] = get_bits(&gb, bit_depth); | 110 | 0 | } | 111 | 0 | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 112 | 0 | if (!h->ps.sps->chroma_format_idc) { | 113 | 0 | for (i = 0; i < block_h; i++) { | 114 | 0 | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); | 115 | 0 | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); | 116 | 0 | for (j = 0; j < 8; j++) { | 117 | 0 | tmp_cb[j] = tmp_cr[j] = 1 << (bit_depth - 1); | 118 | 0 | } | 119 | 0 | } | 120 | 0 | } else { | 121 | 0 | for (i = 0; i < block_h; i++) { | 122 | 0 | uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); | 123 | 0 | for (j = 0; j < 8; j++) | 124 | 0 | tmp_cb[j] = get_bits(&gb, bit_depth); | 125 | 0 | } | 126 | 0 | for (i = 0; i < block_h; i++) { | 127 | 0 | uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); | 128 | 0 | for (j = 0; j < 8; j++) | 129 | 0 | tmp_cr[j] = get_bits(&gb, bit_depth); | 130 | 0 | } | 131 | 0 | } | 132 | 0 | } | 133 | 0 | } else { | 134 | 0 | for (i = 0; i < 16; i++) | 135 | 0 | memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16); | 136 | 0 | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 137 | 0 | if (!h->ps.sps->chroma_format_idc) { | 138 | 0 | for (i = 0; i < 8; i++) { | 139 | 0 | memset(dest_cb + i * uvlinesize, 1 << (bit_depth - 1), 8); | 140 | 0 | memset(dest_cr + i * uvlinesize, 1 << (bit_depth - 1), 8); | 141 | 0 | } | 142 | 0 | } else { | 143 | 0 | const uint8_t *src_cb = sl->intra_pcm_ptr + 256; | 144 | 0 | const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8; | 145 | 0 | for (i = 0; i < block_h; i++) { | 146 | 0 | memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8); | 147 | 0 | memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8); | 148 | 0 | } | 149 | 0 | } | 150 | 0 | } | 151 | 0 | } | 152 | 25.3M | } else { | 153 | 25.3M | if (IS_INTRA(mb_type)) { | 154 | 1.90M | if (sl->deblocking_filter) | 155 | 1.90M | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, | 156 | 1.90M | uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT); | 157 | | | 158 | 1.90M | if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) { | 159 | 1.90M | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize); | 160 | 1.90M | h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize); | 161 | 1.90M | } | 162 | | | 163 | 1.90M | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, | 164 | 1.90M | transform_bypass, PIXEL_SHIFT, | 165 | 1.90M | block_offset, linesize, dest_y, 0); | 166 | | | 167 | 1.90M | if (sl->deblocking_filter) | 168 | 1.90M | xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, | 169 | 1.90M | uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT); | 170 | 23.4M | } else { | 171 | 23.4M | if (chroma422) { | 172 | 3.24M | FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, | 173 | 3.24M | h->h264qpel.put_h264_qpel_pixels_tab, | 174 | 3.24M | h->h264chroma.put_h264_chroma_pixels_tab, | 175 | 3.24M | h->h264qpel.avg_h264_qpel_pixels_tab, | 176 | 3.24M | h->h264chroma.avg_h264_chroma_pixels_tab, | 177 | 3.24M | h->h264dsp.weight_pixels_tab, | 178 | 3.24M | h->h264dsp.biweight_pixels_tab); | 179 | 20.2M | } else { | 180 | 20.2M | FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, | 181 | 20.2M | h->h264qpel.put_h264_qpel_pixels_tab, | 182 | 20.2M | h->h264chroma.put_h264_chroma_pixels_tab, | 183 | 20.2M | h->h264qpel.avg_h264_qpel_pixels_tab, | 184 | 20.2M | h->h264chroma.avg_h264_chroma_pixels_tab, | 185 | 20.2M | h->h264dsp.weight_pixels_tab, | 186 | 20.2M | h->h264dsp.biweight_pixels_tab); | 187 | 20.2M | } | 188 | 23.4M | } | 189 | | | 190 | 25.3M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, | 191 | 25.3M | PIXEL_SHIFT, block_offset, linesize, dest_y, 0); | 192 | | | 193 | 25.3M | if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) && | 194 | 25.3M | (sl->cbp & 0x30)) { | 195 | 4.66M | uint8_t *dest[2] = { dest_cb, dest_cr }; | 196 | 4.66M | if (transform_bypass) { | 197 | 0 | if (IS_INTRA(mb_type) && h->ps.sps->profile_idc == 244 && | 198 | 0 | (sl->chroma_pred_mode == VERT_PRED8x8 || | 199 | 0 | sl->chroma_pred_mode == HOR_PRED8x8)) { | 200 | 0 | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], | 201 | 0 | block_offset + 16, | 202 | 0 | sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | 203 | 0 | uvlinesize); | 204 | 0 | h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], | 205 | 0 | block_offset + 32, | 206 | 0 | sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | 207 | 0 | uvlinesize); | 208 | 0 | } else { | 209 | 0 | idct_add = h->h264dsp.add_pixels4_clear; | 210 | 0 | for (j = 1; j < 3; j++) { | 211 | 0 | for (i = j * 16; i < j * 16 + 4; i++) | 212 | 0 | if (sl->non_zero_count_cache[scan8[i]] || | 213 | 0 | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | 214 | 0 | idct_add(dest[j - 1] + block_offset[i], | 215 | 0 | sl->mb + (i * 16 << PIXEL_SHIFT), | 216 | 0 | uvlinesize); | 217 | 0 | if (chroma422) { | 218 | 0 | for (i = j * 16 + 4; i < j * 16 + 8; i++) | 219 | 0 | if (sl->non_zero_count_cache[scan8[i + 4]] || | 220 | 0 | dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) | 221 | 0 | idct_add(dest[j - 1] + block_offset[i + 4], | 222 | 0 | sl->mb + (i * 16 << PIXEL_SHIFT), | 223 | 0 | uvlinesize); | 224 | 0 | } | 225 | 0 | } | 226 | 0 | } | 227 | 4.66M | } else { | 228 | 4.66M | int qp[2]; | 229 | 4.66M | if (chroma422) { | 230 | 846k | qp[0] = sl->chroma_qp[0] + 3; | 231 | 846k | qp[1] = sl->chroma_qp[1] + 3; | 232 | 3.82M | } else { | 233 | 3.82M | qp[0] = sl->chroma_qp[0]; | 234 | 3.82M | qp[1] = sl->chroma_qp[1]; | 235 | 3.82M | } | 236 | 4.66M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) | 237 | 542k | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), | 238 | 542k | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); | 239 | 4.66M | if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) | 240 | 454k | h->h264dsp.chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), | 241 | 454k | h->ps.pps->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); | 242 | 4.66M | h->h264dsp.idct_add8(dest, block_offset, | 243 | 4.66M | sl->mb, uvlinesize, | 244 | 4.66M | sl->non_zero_count_cache); | 245 | 4.66M | } | 246 | 4.66M | } | 247 | 25.3M | } | 248 | 25.3M | } |
|
249 | | |
250 | | #if !SIMPLE || BITS == 8 |
251 | | |
252 | | #undef CHROMA_IDC |
253 | 19.0M | #define CHROMA_IDC 3 |
254 | | #include "h264_mc_template.c" |
255 | | |
256 | | static av_noinline void FUNC(hl_decode_mb_444)(const H264Context *h, H264SliceContext *sl) |
257 | 8.21M | { |
258 | 8.21M | const int mb_x = sl->mb_x; |
259 | 8.21M | const int mb_y = sl->mb_y; |
260 | 8.21M | const int mb_xy = sl->mb_xy; |
261 | 8.21M | const int mb_type = h->cur_pic.mb_type[mb_xy]; |
262 | 8.21M | uint8_t *dest[3]; |
263 | 8.21M | int linesize; |
264 | 8.21M | int i, j, p; |
265 | 8.21M | const int *block_offset = &h->block_offset[0]; |
266 | 8.21M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); |
267 | 8.21M | const int plane_count = (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) ? 3 : 1; |
268 | | |
269 | 32.8M | for (p = 0; p < plane_count; p++) { |
270 | 24.6M | dest[p] = h->cur_pic.f->data[p] + |
271 | 24.6M | ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; |
272 | 24.6M | h->vdsp.prefetch(dest[p] + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), |
273 | 24.6M | sl->linesize, 4); |
274 | 24.6M | } |
275 | | |
276 | 8.21M | h->list_counts[mb_xy] = sl->list_count; |
277 | | |
278 | 8.21M | if (!SIMPLE && MB_FIELD(sl)) { |
279 | 766k | linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize * 2; |
280 | 766k | block_offset = &h->block_offset[48]; |
281 | 766k | if (mb_y & 1) // FIXME move out of this function? |
282 | 1.81M | for (p = 0; p < 3; p++) |
283 | 1.36M | dest[p] -= sl->linesize * 15; |
284 | 766k | if (FRAME_MBAFF(h)) { |
285 | 465k | int list; |
286 | 954k | for (list = 0; list < sl->list_count; list++) { |
287 | 489k | if (!USES_LIST(mb_type, list)) |
288 | 42.4k | continue; |
289 | 446k | if (IS_16X16(mb_type)) { |
290 | 360k | int8_t *ref = &sl->ref_cache[list][scan8[0]]; |
291 | 360k | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); |
292 | 360k | } else { |
293 | 429k | for (i = 0; i < 16; i += 4) { |
294 | 343k | int ref = sl->ref_cache[list][scan8[i]]; |
295 | 343k | if (ref >= 0) |
296 | 326k | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, |
297 | 326k | 8, (16 + ref) ^ (sl->mb_y & 1), 1); |
298 | 343k | } |
299 | 85.8k | } |
300 | 446k | } |
301 | 465k | } |
302 | 7.44M | } else { |
303 | 7.44M | linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize; |
304 | 7.44M | } |
305 | | |
306 | 8.21M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { |
307 | 1.24k | if (PIXEL_SHIFT) { |
308 | 1.14k | const int bit_depth = h->ps.sps->bit_depth_luma; |
309 | 1.14k | GetBitContext gb; |
310 | 1.14k | init_get_bits(&gb, sl->intra_pcm_ptr, 768 * bit_depth); |
311 | | |
312 | 4.57k | for (p = 0; p < plane_count; p++) |
313 | 58.3k | for (i = 0; i < 16; i++) { |
314 | 54.9k | uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize); |
315 | 933k | for (j = 0; j < 16; j++) |
316 | 878k | tmp[j] = get_bits(&gb, bit_depth); |
317 | 54.9k | } |
318 | 1.14k | } else { |
319 | 420 | for (p = 0; p < plane_count; p++) |
320 | 5.35k | for (i = 0; i < 16; i++) |
321 | 5.04k | memcpy(dest[p] + i * linesize, |
322 | 5.04k | sl->intra_pcm_ptr + p * 256 + i * 16, 16); |
323 | 105 | } |
324 | 8.21M | } else { |
325 | 8.21M | if (IS_INTRA(mb_type)) { |
326 | 316k | if (sl->deblocking_filter) |
327 | 315k | xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, |
328 | 315k | linesize, 1, 1, SIMPLE, PIXEL_SHIFT); |
329 | | |
330 | 1.26M | for (p = 0; p < plane_count; p++) |
331 | 948k | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, |
332 | 948k | transform_bypass, PIXEL_SHIFT, |
333 | 948k | block_offset, linesize, dest[p], p); |
334 | | |
335 | 316k | if (sl->deblocking_filter) |
336 | 315k | xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, |
337 | 315k | linesize, 0, 1, SIMPLE, PIXEL_SHIFT); |
338 | 7.89M | } else { |
339 | 7.89M | FUNC(hl_motion_444)(h, sl, dest[0], dest[1], dest[2], |
340 | 7.89M | h->h264qpel.put_h264_qpel_pixels_tab, |
341 | 7.89M | h->h264chroma.put_h264_chroma_pixels_tab, |
342 | 7.89M | h->h264qpel.avg_h264_qpel_pixels_tab, |
343 | 7.89M | h->h264chroma.avg_h264_chroma_pixels_tab, |
344 | 7.89M | h->h264dsp.weight_pixels_tab, |
345 | 7.89M | h->h264dsp.biweight_pixels_tab); |
346 | 7.89M | } |
347 | | |
348 | 32.8M | for (p = 0; p < plane_count; p++) |
349 | 24.6M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, |
350 | 24.6M | PIXEL_SHIFT, block_offset, linesize, |
351 | 24.6M | dest[p], p); |
352 | 8.21M | } |
353 | 8.21M | } h264_mb.c:hl_decode_mb_444_complex Line | Count | Source | 257 | 7.19M | { | 258 | 7.19M | const int mb_x = sl->mb_x; | 259 | 7.19M | const int mb_y = sl->mb_y; | 260 | 7.19M | const int mb_xy = sl->mb_xy; | 261 | 7.19M | const int mb_type = h->cur_pic.mb_type[mb_xy]; | 262 | 7.19M | uint8_t *dest[3]; | 263 | 7.19M | int linesize; | 264 | 7.19M | int i, j, p; | 265 | 7.19M | const int *block_offset = &h->block_offset[0]; | 266 | 7.19M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); | 267 | 7.19M | const int plane_count = (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) ? 3 : 1; | 268 | | | 269 | 28.7M | for (p = 0; p < plane_count; p++) { | 270 | 21.5M | dest[p] = h->cur_pic.f->data[p] + | 271 | 21.5M | ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; | 272 | 21.5M | h->vdsp.prefetch(dest[p] + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), | 273 | 21.5M | sl->linesize, 4); | 274 | 21.5M | } | 275 | | | 276 | 7.19M | h->list_counts[mb_xy] = sl->list_count; | 277 | | | 278 | 7.19M | if (!SIMPLE && MB_FIELD(sl)) { | 279 | 766k | linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize * 2; | 280 | 766k | block_offset = &h->block_offset[48]; | 281 | 766k | if (mb_y & 1) // FIXME move out of this function? | 282 | 1.81M | for (p = 0; p < 3; p++) | 283 | 1.36M | dest[p] -= sl->linesize * 15; | 284 | 766k | if (FRAME_MBAFF(h)) { | 285 | 465k | int list; | 286 | 954k | for (list = 0; list < sl->list_count; list++) { | 287 | 489k | if (!USES_LIST(mb_type, list)) | 288 | 42.4k | continue; | 289 | 446k | if (IS_16X16(mb_type)) { | 290 | 360k | int8_t *ref = &sl->ref_cache[list][scan8[0]]; | 291 | 360k | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); | 292 | 360k | } else { | 293 | 429k | for (i = 0; i < 16; i += 4) { | 294 | 343k | int ref = sl->ref_cache[list][scan8[i]]; | 295 | 343k | if (ref >= 0) | 296 | 326k | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, | 297 | 326k | 8, (16 + ref) ^ (sl->mb_y & 1), 1); | 298 | 343k | } | 299 | 85.8k | } | 300 | 446k | } | 301 | 465k | } | 302 | 6.42M | } else { | 303 | 6.42M | linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize; | 304 | 6.42M | } | 305 | | | 306 | 7.19M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { | 307 | 1.24k | if (PIXEL_SHIFT) { | 308 | 1.14k | const int bit_depth = h->ps.sps->bit_depth_luma; | 309 | 1.14k | GetBitContext gb; | 310 | 1.14k | init_get_bits(&gb, sl->intra_pcm_ptr, 768 * bit_depth); | 311 | | | 312 | 4.57k | for (p = 0; p < plane_count; p++) | 313 | 58.3k | for (i = 0; i < 16; i++) { | 314 | 54.9k | uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize); | 315 | 933k | for (j = 0; j < 16; j++) | 316 | 878k | tmp[j] = get_bits(&gb, bit_depth); | 317 | 54.9k | } | 318 | 1.14k | } else { | 319 | 420 | for (p = 0; p < plane_count; p++) | 320 | 5.35k | for (i = 0; i < 16; i++) | 321 | 5.04k | memcpy(dest[p] + i * linesize, | 322 | 5.04k | sl->intra_pcm_ptr + p * 256 + i * 16, 16); | 323 | 105 | } | 324 | 7.18M | } else { | 325 | 7.18M | if (IS_INTRA(mb_type)) { | 326 | 271k | if (sl->deblocking_filter) | 327 | 271k | xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, | 328 | 271k | linesize, 1, 1, SIMPLE, PIXEL_SHIFT); | 329 | | | 330 | 1.08M | for (p = 0; p < plane_count; p++) | 331 | 815k | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, | 332 | 815k | transform_bypass, PIXEL_SHIFT, | 333 | 815k | block_offset, linesize, dest[p], p); | 334 | | | 335 | 271k | if (sl->deblocking_filter) | 336 | 271k | xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, | 337 | 271k | linesize, 0, 1, SIMPLE, PIXEL_SHIFT); | 338 | 6.91M | } else { | 339 | 6.91M | FUNC(hl_motion_444)(h, sl, dest[0], dest[1], dest[2], | 340 | 6.91M | h->h264qpel.put_h264_qpel_pixels_tab, | 341 | 6.91M | h->h264chroma.put_h264_chroma_pixels_tab, | 342 | 6.91M | h->h264qpel.avg_h264_qpel_pixels_tab, | 343 | 6.91M | h->h264chroma.avg_h264_chroma_pixels_tab, | 344 | 6.91M | h->h264dsp.weight_pixels_tab, | 345 | 6.91M | h->h264dsp.biweight_pixels_tab); | 346 | 6.91M | } | 347 | | | 348 | 28.7M | for (p = 0; p < plane_count; p++) | 349 | 21.5M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, | 350 | 21.5M | PIXEL_SHIFT, block_offset, linesize, | 351 | 21.5M | dest[p], p); | 352 | 7.18M | } | 353 | 7.19M | } |
h264_mb.c:hl_decode_mb_444_simple_8 Line | Count | Source | 257 | 1.02M | { | 258 | 1.02M | const int mb_x = sl->mb_x; | 259 | 1.02M | const int mb_y = sl->mb_y; | 260 | 1.02M | const int mb_xy = sl->mb_xy; | 261 | 1.02M | const int mb_type = h->cur_pic.mb_type[mb_xy]; | 262 | 1.02M | uint8_t *dest[3]; | 263 | 1.02M | int linesize; | 264 | 1.02M | int i, j, p; | 265 | 1.02M | const int *block_offset = &h->block_offset[0]; | 266 | 1.02M | const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->ps.sps->transform_bypass); | 267 | 1.02M | const int plane_count = (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) ? 3 : 1; | 268 | | | 269 | 4.10M | for (p = 0; p < plane_count; p++) { | 270 | 3.07M | dest[p] = h->cur_pic.f->data[p] + | 271 | 3.07M | ((mb_x << PIXEL_SHIFT) + mb_y * sl->linesize) * 16; | 272 | 3.07M | h->vdsp.prefetch(dest[p] + (sl->mb_x & 3) * 4 * sl->linesize + (64 << PIXEL_SHIFT), | 273 | 3.07M | sl->linesize, 4); | 274 | 3.07M | } | 275 | | | 276 | 1.02M | h->list_counts[mb_xy] = sl->list_count; | 277 | | | 278 | 1.02M | if (!SIMPLE && MB_FIELD(sl)) { | 279 | 0 | linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize * 2; | 280 | 0 | block_offset = &h->block_offset[48]; | 281 | 0 | if (mb_y & 1) // FIXME move out of this function? | 282 | 0 | for (p = 0; p < 3; p++) | 283 | 0 | dest[p] -= sl->linesize * 15; | 284 | 0 | if (FRAME_MBAFF(h)) { | 285 | 0 | int list; | 286 | 0 | for (list = 0; list < sl->list_count; list++) { | 287 | 0 | if (!USES_LIST(mb_type, list)) | 288 | 0 | continue; | 289 | 0 | if (IS_16X16(mb_type)) { | 290 | 0 | int8_t *ref = &sl->ref_cache[list][scan8[0]]; | 291 | 0 | fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1); | 292 | 0 | } else { | 293 | 0 | for (i = 0; i < 16; i += 4) { | 294 | 0 | int ref = sl->ref_cache[list][scan8[i]]; | 295 | 0 | if (ref >= 0) | 296 | 0 | fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, | 297 | 0 | 8, (16 + ref) ^ (sl->mb_y & 1), 1); | 298 | 0 | } | 299 | 0 | } | 300 | 0 | } | 301 | 0 | } | 302 | 1.02M | } else { | 303 | 1.02M | linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize; | 304 | 1.02M | } | 305 | | | 306 | 1.02M | if (!SIMPLE && IS_INTRA_PCM(mb_type)) { | 307 | 0 | if (PIXEL_SHIFT) { | 308 | 0 | const int bit_depth = h->ps.sps->bit_depth_luma; | 309 | 0 | GetBitContext gb; | 310 | 0 | init_get_bits(&gb, sl->intra_pcm_ptr, 768 * bit_depth); | 311 | |
| 312 | 0 | for (p = 0; p < plane_count; p++) | 313 | 0 | for (i = 0; i < 16; i++) { | 314 | 0 | uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize); | 315 | 0 | for (j = 0; j < 16; j++) | 316 | 0 | tmp[j] = get_bits(&gb, bit_depth); | 317 | 0 | } | 318 | 0 | } else { | 319 | 0 | for (p = 0; p < plane_count; p++) | 320 | 0 | for (i = 0; i < 16; i++) | 321 | 0 | memcpy(dest[p] + i * linesize, | 322 | 0 | sl->intra_pcm_ptr + p * 256 + i * 16, 16); | 323 | 0 | } | 324 | 1.02M | } else { | 325 | 1.02M | if (IS_INTRA(mb_type)) { | 326 | 44.3k | if (sl->deblocking_filter) | 327 | 44.0k | xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, | 328 | 44.0k | linesize, 1, 1, SIMPLE, PIXEL_SHIFT); | 329 | | | 330 | 177k | for (p = 0; p < plane_count; p++) | 331 | 133k | hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE, | 332 | 133k | transform_bypass, PIXEL_SHIFT, | 333 | 133k | block_offset, linesize, dest[p], p); | 334 | | | 335 | 44.3k | if (sl->deblocking_filter) | 336 | 44.0k | xchg_mb_border(h, sl, dest[0], dest[1], dest[2], linesize, | 337 | 44.0k | linesize, 0, 1, SIMPLE, PIXEL_SHIFT); | 338 | 980k | } else { | 339 | 980k | FUNC(hl_motion_444)(h, sl, dest[0], dest[1], dest[2], | 340 | 980k | h->h264qpel.put_h264_qpel_pixels_tab, | 341 | 980k | h->h264chroma.put_h264_chroma_pixels_tab, | 342 | 980k | h->h264qpel.avg_h264_qpel_pixels_tab, | 343 | 980k | h->h264chroma.avg_h264_chroma_pixels_tab, | 344 | 980k | h->h264dsp.weight_pixels_tab, | 345 | 980k | h->h264dsp.biweight_pixels_tab); | 346 | 980k | } | 347 | | | 348 | 4.10M | for (p = 0; p < plane_count; p++) | 349 | 3.07M | hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass, | 350 | 3.07M | PIXEL_SHIFT, block_offset, linesize, | 351 | 3.07M | dest[p], p); | 352 | 1.02M | } | 353 | 1.02M | } |
|
354 | | |
355 | | #endif |