/src/libde265/libde265/intrapred.h
Line | Count | Source |
1 | | /* |
2 | | * H.265 video codec. |
3 | | * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de> |
4 | | * |
5 | | * This file is part of libde265. |
6 | | * |
7 | | * libde265 is free software: you can redistribute it and/or modify |
8 | | * it under the terms of the GNU Lesser General Public License as |
9 | | * published by the Free Software Foundation, either version 3 of |
10 | | * the License, or (at your option) any later version. |
11 | | * |
12 | | * libde265 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 |
15 | | * GNU Lesser General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Lesser General Public License |
18 | | * along with libde265. If not, see <http://www.gnu.org/licenses/>. |
19 | | */ |
20 | | |
21 | | #ifndef DE265_INTRAPRED_H |
22 | | #define DE265_INTRAPRED_H |
23 | | |
24 | | #include "libde265/decctx.h" |
25 | | |
26 | | extern const int intraPredAngle_table[1+34]; |
27 | | |
28 | | |
29 | | /* Fill the three intra-pred-mode candidates into candModeList. |
30 | | Block position is (x,y) and you also have to give the PUidx for this |
31 | | block (which is (x>>Log2MinPUSize) + (y>>Log2MinPUSize)*PicWidthInMinPUs). |
32 | | availableA/B is the output of check_CTB_available(). |
33 | | */ |
34 | | void fillIntraPredModeCandidates(enum IntraPredMode candModeList[3], |
35 | | int x,int y, int PUidx, |
36 | | bool availableA, // left |
37 | | bool availableB, // top |
38 | | const de265_image* img); |
39 | | |
40 | | |
41 | | inline void fillIntraPredModeCandidates(enum IntraPredMode candModeList[3], int x,int y, |
42 | | bool availableA, // left |
43 | | bool availableB, // top |
44 | | const de265_image* img) |
45 | 0 | { |
46 | 0 | int PUidx = img->get_sps().getPUIndexRS(x,y); |
47 | 0 | fillIntraPredModeCandidates(candModeList, x,y, PUidx, availableA,availableB, img); |
48 | 0 | } |
49 | | |
50 | | void fillIntraPredModeCandidates(enum IntraPredMode candModeList[3], |
51 | | enum IntraPredMode candIntraPredModeA, |
52 | | enum IntraPredMode candIntraPredModeB); |
53 | | |
54 | | |
55 | | /* Return value >= 0 -> use mpm_idx(return value) |
56 | | else -> use rem_intra(-return value-1) |
57 | | |
58 | | This function may modify the candModeList ! |
59 | | */ |
60 | | int find_intra_pred_mode(enum IntraPredMode mode, |
61 | | enum IntraPredMode candModeList[3]); |
62 | | |
63 | | void list_chroma_pred_candidates(enum IntraPredMode chroma_mode[5], |
64 | | enum IntraPredMode luma_mode); |
65 | | |
66 | | int get_intra_scan_idx(int log2TrafoSize, enum IntraPredMode intraPredMode, int cIdx, |
67 | | const seq_parameter_set* sps); |
68 | | |
69 | | int get_intra_scan_idx_luma (int log2TrafoSize, enum IntraPredMode intraPredMode); // DEPRECATED |
70 | | int get_intra_scan_idx_chroma(int log2TrafoSize, enum IntraPredMode intraPredMode); // DEPRECATED |
71 | | |
72 | | enum IntraPredMode lumaPredMode_to_chromaPredMode(enum IntraPredMode luma, |
73 | | enum IntraChromaPredMode chroma); |
74 | | |
75 | | /* |
76 | | void decode_intra_block(decoder_context* ctx, |
77 | | thread_context* tctx, |
78 | | int cIdx, |
79 | | int xB0,int yB0, // position of TU in frame (chroma adapted) |
80 | | int x0,int y0, // position of CU in frame (chroma adapted) |
81 | | int log2TrafoSize, int trafoDepth, |
82 | | enum IntraPredMode intraPredMode, |
83 | | bool transform_skip_flag); |
84 | | */ |
85 | | |
86 | | //void fill_border_samples(decoder_context* ctx, int xB,int yB, |
87 | | // int nT, int cIdx, uint8_t* out_border); |
88 | | |
89 | | void decode_intra_prediction(de265_image* img, |
90 | | int xB0,int yB0, |
91 | | enum IntraPredMode intraPredMode, |
92 | | int nT, int cIdx); |
93 | | |
94 | | // TODO: remove this |
95 | | template <class pixel_t> void decode_intra_prediction(de265_image* img, |
96 | | int xB0,int yB0, |
97 | | enum IntraPredMode intraPredMode, |
98 | | pixel_t* dst, int nT, int cIdx); |
99 | | |
100 | | |
101 | | |
102 | | |
103 | | // --- internal use only --- |
104 | | |
105 | | // Actually, the largest TB block can only be 32, but in some intra-pred-mode algorithms |
106 | | // (e.g. min-residual), we may call intra prediction on the maximum CTB size (64). |
107 | | static const int MAX_INTRA_PRED_BLOCK_SIZE = 64; |
108 | | |
109 | | |
110 | | template <class pixel_t> |
111 | | class intra_border_computer |
112 | | { |
113 | | public: |
114 | | pixel_t* out_border; |
115 | | |
116 | | const de265_image* img; |
117 | | int nT; |
118 | | int cIdx; |
119 | | |
120 | | int xB,yB; |
121 | | |
122 | | const seq_parameter_set* sps; |
123 | | const pic_parameter_set* pps; |
124 | | |
125 | | uint8_t available_data[4*MAX_INTRA_PRED_BLOCK_SIZE + 1]; |
126 | | uint8_t* available; |
127 | | |
128 | | int SubWidth; |
129 | | int SubHeight; |
130 | | |
131 | | bool availableLeft; // is CTB at left side available? |
132 | | bool availableTop; // is CTB at top side available? |
133 | | bool availableTopRight; // is CTB at top-right side available? |
134 | | bool availableTopLeft; // if CTB at top-left pixel available? |
135 | | |
136 | | int nBottom; |
137 | | int nRight; |
138 | | int nAvail; |
139 | | pixel_t firstValue; |
140 | | |
141 | | void init(pixel_t* _out_border, |
142 | 74.5M | const de265_image* _img, int _nT, int _cIdx, int _xB, int _yB) { |
143 | 74.5M | img=_img; nT=_nT; cIdx=_cIdx; |
144 | 74.5M | out_border=_out_border; xB=_xB; yB=_yB; |
145 | | |
146 | 74.5M | assert(nT <= MAX_INTRA_PRED_BLOCK_SIZE); |
147 | | |
148 | 74.5M | availableLeft=true; |
149 | 74.5M | availableTop=true; |
150 | 74.5M | availableTopRight=true; |
151 | 74.5M | availableTopLeft=true; |
152 | 74.5M | } intra_border_computer<unsigned short>::init(unsigned short*, de265_image const*, int, int, int, int) Line | Count | Source | 142 | 17.5M | const de265_image* _img, int _nT, int _cIdx, int _xB, int _yB) { | 143 | 17.5M | img=_img; nT=_nT; cIdx=_cIdx; | 144 | 17.5M | out_border=_out_border; xB=_xB; yB=_yB; | 145 | | | 146 | 17.5M | assert(nT <= MAX_INTRA_PRED_BLOCK_SIZE); | 147 | | | 148 | 17.5M | availableLeft=true; | 149 | 17.5M | availableTop=true; | 150 | 17.5M | availableTopRight=true; | 151 | 17.5M | availableTopLeft=true; | 152 | 17.5M | } |
intra_border_computer<unsigned char>::init(unsigned char*, de265_image const*, int, int, int, int) Line | Count | Source | 142 | 57.0M | const de265_image* _img, int _nT, int _cIdx, int _xB, int _yB) { | 143 | 57.0M | img=_img; nT=_nT; cIdx=_cIdx; | 144 | 57.0M | out_border=_out_border; xB=_xB; yB=_yB; | 145 | | | 146 | 57.0M | assert(nT <= MAX_INTRA_PRED_BLOCK_SIZE); | 147 | | | 148 | 57.0M | availableLeft=true; | 149 | 57.0M | availableTop=true; | 150 | 57.0M | availableTopRight=true; | 151 | 57.0M | availableTopLeft=true; | 152 | 57.0M | } |
|
153 | | void preproc(); |
154 | | void fill_from_image(); |
155 | | |
156 | | void reference_sample_substitution(); |
157 | | }; |
158 | | |
159 | | |
160 | | #ifdef DE265_LOG_TRACE |
161 | | template <class pixel_t> |
162 | | void print_border(pixel_t* data, uint8_t* available, int nT) |
163 | | { |
164 | | for (int i=-2*nT ; i<=2*nT ; i++) { |
165 | | if (i==0 || i==1 || i==-nT || i==nT+1) { |
166 | | logtrace(LogIntraPred,"|"); |
167 | | } else { |
168 | | logtrace(LogIntraPred," "); |
169 | | } |
170 | | |
171 | | if (available==nullptr || available[i]) { |
172 | | logtrace(LogIntraPred,"%02x",data[i]); |
173 | | } |
174 | | else { |
175 | | logtrace(LogIntraPred,"--"); |
176 | | } |
177 | | } |
178 | | } |
179 | | #else |
180 | | #define print_border(data, available, nT) |
181 | | #endif |
182 | | |
183 | | |
184 | | // (8.4.4.2.3) |
185 | | template <class pixel_t> |
186 | | void intra_prediction_sample_filtering(const seq_parameter_set& sps, |
187 | | pixel_t* p, |
188 | | int nT, int cIdx, |
189 | | enum IntraPredMode intraPredMode) |
190 | 41.1M | { |
191 | 41.1M | int filterFlag; |
192 | | |
193 | | //printf("filtering, mode: %d\n",intraPredMode); |
194 | | |
195 | 41.1M | if (intraPredMode==INTRA_DC || nT==4) { |
196 | 35.5M | filterFlag = 0; |
197 | 35.5M | } else { |
198 | 5.58M | int minDistVerHor = std::min( std::abs((int)intraPredMode-26), |
199 | 5.58M | std::abs((int)intraPredMode-10) ); |
200 | | |
201 | | //printf("mindist: %d\n",minDistVerHor); |
202 | | |
203 | 5.58M | switch (nT) { |
204 | 4.13M | case 8: filterFlag = (minDistVerHor>7) ? 1 : 0; break; |
205 | 926k | case 16: filterFlag = (minDistVerHor>1) ? 1 : 0; break; |
206 | 534k | case 32: filterFlag = (minDistVerHor>0) ? 1 : 0; break; |
207 | | // there is no official 64x64 TB block, but we call this for some intra-pred mode algorithms |
208 | | // on the whole CB (2Nx2N mode for the whole CTB) |
209 | 0 | case 64: filterFlag = 0; break; |
210 | 0 | default: filterFlag = -1; assert(false); break; // should never happen |
211 | 5.58M | } |
212 | 5.58M | } |
213 | | |
214 | | |
215 | 41.1M | if (filterFlag) { |
216 | 2.47M | int biIntFlag = (sps.strong_intra_smoothing_enable_flag && |
217 | 1.64M | cIdx==0 && |
218 | 1.50M | nT==32 && |
219 | 276k | std::abs(p[0]+p[ 64]-2*p[ 32]) < (1<<(sps.bit_depth_luma-5)) && |
220 | 104k | std::abs(p[0]+p[-64]-2*p[-32]) < (1<<(sps.bit_depth_luma-5))) |
221 | 2.47M | ? 1 : 0; |
222 | | |
223 | 2.47M | pixel_t pF_mem[4*32+1]; |
224 | 2.47M | pixel_t* pF = &pF_mem[2*32]; |
225 | | |
226 | 2.47M | if (biIntFlag) { |
227 | 61.2k | pF[-2*nT] = p[-2*nT]; |
228 | 61.2k | pF[ 2*nT] = p[ 2*nT]; |
229 | 61.2k | pF[ 0] = p[ 0]; |
230 | | |
231 | 3.91M | for (int i=1;i<=63;i++) { |
232 | 3.85M | pF[-i] = p[0] + ((i*(p[-64]-p[0])+32)>>6); |
233 | 3.85M | pF[ i] = p[0] + ((i*(p[ 64]-p[0])+32)>>6); |
234 | 3.85M | } |
235 | 2.41M | } else { |
236 | 2.41M | pF[-2*nT] = p[-2*nT]; |
237 | 2.41M | pF[ 2*nT] = p[ 2*nT]; |
238 | | |
239 | 135M | for (int i=-(2*nT-1) ; i<=2*nT-1 ; i++) |
240 | 133M | { |
241 | 133M | pF[i] = (p[i+1] + 2*p[i] + p[i-1] + 2) >> 2; |
242 | 133M | } |
243 | 2.41M | } |
244 | | |
245 | | |
246 | | // copy back to original array |
247 | | |
248 | 2.47M | memcpy(p-2*nT, pF-2*nT, (4*nT+1) * sizeof(pixel_t)); |
249 | 2.47M | } |
250 | 38.6M | else { |
251 | | // do nothing ? |
252 | 38.6M | } |
253 | | |
254 | | |
255 | 41.1M | logtrace(LogIntraPred,"post filtering: "); |
256 | 41.1M | print_border(p,nullptr,nT); |
257 | 41.1M | logtrace(LogIntraPred,"\n"); |
258 | 41.1M | } void intra_prediction_sample_filtering<unsigned short>(seq_parameter_set const&, unsigned short*, int, int, IntraPredMode) Line | Count | Source | 190 | 7.70M | { | 191 | 7.70M | int filterFlag; | 192 | | | 193 | | //printf("filtering, mode: %d\n",intraPredMode); | 194 | | | 195 | 7.70M | if (intraPredMode==INTRA_DC || nT==4) { | 196 | 6.24M | filterFlag = 0; | 197 | 6.24M | } else { | 198 | 1.46M | int minDistVerHor = std::min( std::abs((int)intraPredMode-26), | 199 | 1.46M | std::abs((int)intraPredMode-10) ); | 200 | | | 201 | | //printf("mindist: %d\n",minDistVerHor); | 202 | | | 203 | 1.46M | switch (nT) { | 204 | 1.22M | case 8: filterFlag = (minDistVerHor>7) ? 1 : 0; break; | 205 | 106k | case 16: filterFlag = (minDistVerHor>1) ? 1 : 0; break; | 206 | 128k | case 32: filterFlag = (minDistVerHor>0) ? 1 : 0; break; | 207 | | // there is no official 64x64 TB block, but we call this for some intra-pred mode algorithms | 208 | | // on the whole CB (2Nx2N mode for the whole CTB) | 209 | 0 | case 64: filterFlag = 0; break; | 210 | 0 | default: filterFlag = -1; assert(false); break; // should never happen | 211 | 1.46M | } | 212 | 1.46M | } | 213 | | | 214 | | | 215 | 7.70M | if (filterFlag) { | 216 | 643k | int biIntFlag = (sps.strong_intra_smoothing_enable_flag && | 217 | 185k | cIdx==0 && | 218 | 160k | nT==32 && | 219 | 9.45k | std::abs(p[0]+p[ 64]-2*p[ 32]) < (1<<(sps.bit_depth_luma-5)) && | 220 | 7.86k | std::abs(p[0]+p[-64]-2*p[-32]) < (1<<(sps.bit_depth_luma-5))) | 221 | 643k | ? 1 : 0; | 222 | | | 223 | 643k | pixel_t pF_mem[4*32+1]; | 224 | 643k | pixel_t* pF = &pF_mem[2*32]; | 225 | | | 226 | 643k | if (biIntFlag) { | 227 | 6.06k | pF[-2*nT] = p[-2*nT]; | 228 | 6.06k | pF[ 2*nT] = p[ 2*nT]; | 229 | 6.06k | pF[ 0] = p[ 0]; | 230 | | | 231 | 388k | for (int i=1;i<=63;i++) { | 232 | 381k | pF[-i] = p[0] + ((i*(p[-64]-p[0])+32)>>6); | 233 | 381k | pF[ i] = p[0] + ((i*(p[ 64]-p[0])+32)>>6); | 234 | 381k | } | 235 | 637k | } else { | 236 | 637k | pF[-2*nT] = p[-2*nT]; | 237 | 637k | pF[ 2*nT] = p[ 2*nT]; | 238 | | | 239 | 33.2M | for (int i=-(2*nT-1) ; i<=2*nT-1 ; i++) | 240 | 32.5M | { | 241 | 32.5M | pF[i] = (p[i+1] + 2*p[i] + p[i-1] + 2) >> 2; | 242 | 32.5M | } | 243 | 637k | } | 244 | | | 245 | | | 246 | | // copy back to original array | 247 | | | 248 | 643k | memcpy(p-2*nT, pF-2*nT, (4*nT+1) * sizeof(pixel_t)); | 249 | 643k | } | 250 | 7.06M | else { | 251 | | // do nothing ? | 252 | 7.06M | } | 253 | | | 254 | | | 255 | 7.70M | logtrace(LogIntraPred,"post filtering: "); | 256 | 7.70M | print_border(p,nullptr,nT); | 257 | 7.70M | logtrace(LogIntraPred,"\n"); | 258 | 7.70M | } |
void intra_prediction_sample_filtering<unsigned char>(seq_parameter_set const&, unsigned char*, int, int, IntraPredMode) Line | Count | Source | 190 | 33.4M | { | 191 | 33.4M | int filterFlag; | 192 | | | 193 | | //printf("filtering, mode: %d\n",intraPredMode); | 194 | | | 195 | 33.4M | if (intraPredMode==INTRA_DC || nT==4) { | 196 | 29.3M | filterFlag = 0; | 197 | 29.3M | } else { | 198 | 4.12M | int minDistVerHor = std::min( std::abs((int)intraPredMode-26), | 199 | 4.12M | std::abs((int)intraPredMode-10) ); | 200 | | | 201 | | //printf("mindist: %d\n",minDistVerHor); | 202 | | | 203 | 4.12M | switch (nT) { | 204 | 2.90M | case 8: filterFlag = (minDistVerHor>7) ? 1 : 0; break; | 205 | 819k | case 16: filterFlag = (minDistVerHor>1) ? 1 : 0; break; | 206 | 405k | case 32: filterFlag = (minDistVerHor>0) ? 1 : 0; break; | 207 | | // there is no official 64x64 TB block, but we call this for some intra-pred mode algorithms | 208 | | // on the whole CB (2Nx2N mode for the whole CTB) | 209 | 0 | case 64: filterFlag = 0; break; | 210 | 0 | default: filterFlag = -1; assert(false); break; // should never happen | 211 | 4.12M | } | 212 | 4.12M | } | 213 | | | 214 | | | 215 | 33.4M | if (filterFlag) { | 216 | 1.83M | int biIntFlag = (sps.strong_intra_smoothing_enable_flag && | 217 | 1.46M | cIdx==0 && | 218 | 1.34M | nT==32 && | 219 | 267k | std::abs(p[0]+p[ 64]-2*p[ 32]) < (1<<(sps.bit_depth_luma-5)) && | 220 | 96.7k | std::abs(p[0]+p[-64]-2*p[-32]) < (1<<(sps.bit_depth_luma-5))) | 221 | 1.83M | ? 1 : 0; | 222 | | | 223 | 1.83M | pixel_t pF_mem[4*32+1]; | 224 | 1.83M | pixel_t* pF = &pF_mem[2*32]; | 225 | | | 226 | 1.83M | if (biIntFlag) { | 227 | 55.1k | pF[-2*nT] = p[-2*nT]; | 228 | 55.1k | pF[ 2*nT] = p[ 2*nT]; | 229 | 55.1k | pF[ 0] = p[ 0]; | 230 | | | 231 | 3.53M | for (int i=1;i<=63;i++) { | 232 | 3.47M | pF[-i] = p[0] + ((i*(p[-64]-p[0])+32)>>6); | 233 | 3.47M | pF[ i] = p[0] + ((i*(p[ 64]-p[0])+32)>>6); | 234 | 3.47M | } | 235 | 1.78M | } else { | 236 | 1.78M | pF[-2*nT] = p[-2*nT]; | 237 | 1.78M | pF[ 2*nT] = p[ 2*nT]; | 238 | | | 239 | 102M | for (int i=-(2*nT-1) ; i<=2*nT-1 ; i++) | 240 | 100M | { | 241 | 100M | pF[i] = (p[i+1] + 2*p[i] + p[i-1] + 2) >> 2; | 242 | 100M | } | 243 | 1.78M | } | 244 | | | 245 | | | 246 | | // copy back to original array | 247 | | | 248 | 1.83M | memcpy(p-2*nT, pF-2*nT, (4*nT+1) * sizeof(pixel_t)); | 249 | 1.83M | } | 250 | 31.6M | else { | 251 | | // do nothing ? | 252 | 31.6M | } | 253 | | | 254 | | | 255 | 33.4M | logtrace(LogIntraPred,"post filtering: "); | 256 | 33.4M | print_border(p,nullptr,nT); | 257 | 33.4M | logtrace(LogIntraPred,"\n"); | 258 | 33.4M | } |
|
259 | | |
260 | | |
261 | | template <class pixel_t> |
262 | | void intra_prediction_planar(pixel_t* dst, int dstStride, |
263 | | int nT,int cIdx, |
264 | | pixel_t* border) |
265 | 4.37M | { |
266 | 4.37M | int Log2_nT = Log2(nT); |
267 | | |
268 | 26.5M | for (int y=0;y<nT;y++) |
269 | 193M | for (int x=0;x<nT;x++) |
270 | 171M | { |
271 | 171M | dst[x+y*dstStride] = ((nT-1-x)*border[-1-y] + (x+1)*border[ 1+nT] + |
272 | 171M | (nT-1-y)*border[ 1+x] + (y+1)*border[-1-nT] + nT) >> (Log2_nT+1); |
273 | 171M | } |
274 | | |
275 | | |
276 | 4.37M | logtrace(LogIntraPred,"result of planar prediction\n"); |
277 | | |
278 | 26.5M | for (int y=0;y<nT;y++) |
279 | 22.1M | { |
280 | 193M | for (int x=0;x<nT;x++) |
281 | 171M | logtrace(LogIntraPred,"%02x ", dst[x+y*dstStride]); |
282 | | |
283 | 22.1M | logtrace(LogIntraPred,"\n"); |
284 | 22.1M | } |
285 | 4.37M | } Unexecuted instantiation: void intra_prediction_planar<unsigned char>(unsigned char*, int, int, int, unsigned char*) void intra_prediction_planar<unsigned short>(unsigned short*, int, int, int, unsigned short*) Line | Count | Source | 265 | 4.37M | { | 266 | 4.37M | int Log2_nT = Log2(nT); | 267 | | | 268 | 26.5M | for (int y=0;y<nT;y++) | 269 | 193M | for (int x=0;x<nT;x++) | 270 | 171M | { | 271 | 171M | dst[x+y*dstStride] = ((nT-1-x)*border[-1-y] + (x+1)*border[ 1+nT] + | 272 | 171M | (nT-1-y)*border[ 1+x] + (y+1)*border[-1-nT] + nT) >> (Log2_nT+1); | 273 | 171M | } | 274 | | | 275 | | | 276 | 4.37M | logtrace(LogIntraPred,"result of planar prediction\n"); | 277 | | | 278 | 26.5M | for (int y=0;y<nT;y++) | 279 | 22.1M | { | 280 | 193M | for (int x=0;x<nT;x++) | 281 | 171M | logtrace(LogIntraPred,"%02x ", dst[x+y*dstStride]); | 282 | | | 283 | 22.1M | logtrace(LogIntraPred,"\n"); | 284 | 22.1M | } | 285 | 4.37M | } |
|
286 | | |
287 | | |
288 | | template <class pixel_t> |
289 | | void intra_prediction_DC(pixel_t* dst, int dstStride, |
290 | | int nT,int cIdx, |
291 | | pixel_t* border) |
292 | 2.18M | { |
293 | 2.18M | int Log2_nT = Log2(nT); |
294 | | |
295 | 2.18M | int dcVal = 0; |
296 | 13.6M | for (int i=0;i<nT;i++) |
297 | 11.4M | { |
298 | 11.4M | dcVal += border[ i+1]; |
299 | 11.4M | dcVal += border[-i-1]; |
300 | 11.4M | } |
301 | | |
302 | 2.18M | dcVal += nT; |
303 | 2.18M | dcVal >>= Log2_nT+1; |
304 | | |
305 | 2.18M | if (cIdx==0 && nT<32) { |
306 | 855k | dst[0] = (border[-1] + 2*dcVal + border[1] +2) >> 2; |
307 | | |
308 | 4.25M | for (int x=1;x<nT;x++) { dst[x] = (border[ x+1] + 3*dcVal+2)>>2; } |
309 | 4.25M | for (int y=1;y<nT;y++) { dst[y*dstStride] = (border[-y-1] + 3*dcVal+2)>>2; } |
310 | 4.25M | for (int y=1;y<nT;y++) |
311 | 20.7M | for (int x=1;x<nT;x++) |
312 | 17.3M | { |
313 | 17.3M | dst[x+y*dstStride] = dcVal; |
314 | 17.3M | } |
315 | 1.32M | } else { |
316 | 8.54M | for (int y=0;y<nT;y++) |
317 | 75.1M | for (int x=0;x<nT;x++) |
318 | 67.9M | { |
319 | 67.9M | dst[x+y*dstStride] = dcVal; |
320 | 67.9M | } |
321 | 1.32M | } |
322 | 2.18M | } Unexecuted instantiation: void intra_prediction_DC<unsigned char>(unsigned char*, int, int, int, unsigned char*) void intra_prediction_DC<unsigned short>(unsigned short*, int, int, int, unsigned short*) Line | Count | Source | 292 | 2.18M | { | 293 | 2.18M | int Log2_nT = Log2(nT); | 294 | | | 295 | 2.18M | int dcVal = 0; | 296 | 13.6M | for (int i=0;i<nT;i++) | 297 | 11.4M | { | 298 | 11.4M | dcVal += border[ i+1]; | 299 | 11.4M | dcVal += border[-i-1]; | 300 | 11.4M | } | 301 | | | 302 | 2.18M | dcVal += nT; | 303 | 2.18M | dcVal >>= Log2_nT+1; | 304 | | | 305 | 2.18M | if (cIdx==0 && nT<32) { | 306 | 855k | dst[0] = (border[-1] + 2*dcVal + border[1] +2) >> 2; | 307 | | | 308 | 4.25M | for (int x=1;x<nT;x++) { dst[x] = (border[ x+1] + 3*dcVal+2)>>2; } | 309 | 4.25M | for (int y=1;y<nT;y++) { dst[y*dstStride] = (border[-y-1] + 3*dcVal+2)>>2; } | 310 | 4.25M | for (int y=1;y<nT;y++) | 311 | 20.7M | for (int x=1;x<nT;x++) | 312 | 17.3M | { | 313 | 17.3M | dst[x+y*dstStride] = dcVal; | 314 | 17.3M | } | 315 | 1.32M | } else { | 316 | 8.54M | for (int y=0;y<nT;y++) | 317 | 75.1M | for (int x=0;x<nT;x++) | 318 | 67.9M | { | 319 | 67.9M | dst[x+y*dstStride] = dcVal; | 320 | 67.9M | } | 321 | 1.32M | } | 322 | 2.18M | } |
|
323 | | |
324 | | |
325 | | extern const int intraPredAngle_table[1+34]; |
326 | | extern const int invAngle_table[25-10]; |
327 | | |
328 | | |
329 | | // (8.4.4.2.6) |
330 | | template <class pixel_t> |
331 | | void intra_prediction_angular(pixel_t* dst, int dstStride, |
332 | | int bit_depth, bool disableIntraBoundaryFilter, |
333 | | int xB0,int yB0, |
334 | | enum IntraPredMode intraPredMode, |
335 | | int nT,int cIdx, |
336 | | pixel_t* border) |
337 | 10.9M | { |
338 | 10.9M | pixel_t ref_mem[4*MAX_INTRA_PRED_BLOCK_SIZE+1]; // TODO: what is the required range here ? |
339 | 10.9M | pixel_t* ref=&ref_mem[2*MAX_INTRA_PRED_BLOCK_SIZE]; |
340 | | |
341 | 10.9M | assert(intraPredMode<35); |
342 | 10.9M | assert(intraPredMode>=2); |
343 | | |
344 | 10.9M | int intraPredAngle = intraPredAngle_table[intraPredMode]; |
345 | | |
346 | 10.9M | if (intraPredMode >= 18) { |
347 | | |
348 | 40.3M | for (int x=0;x<=nT;x++) |
349 | 34.6M | { ref[x] = border[x]; } |
350 | | |
351 | 5.72M | if (intraPredAngle<0) { |
352 | 1.64M | int invAngle = invAngle_table[intraPredMode-11]; |
353 | | |
354 | 1.64M | if ((nT*intraPredAngle)>>5 < -1) { |
355 | 5.32M | for (int x=(nT*intraPredAngle)>>5; x<=-1; x++) { |
356 | 4.17M | ref[x] = border[0-((x*invAngle+128)>>8)]; |
357 | 4.17M | } |
358 | 1.15M | } |
359 | 4.07M | } else { |
360 | 24.6M | for (int x=nT+1; x<=2*nT;x++) { |
361 | 20.5M | ref[x] = border[x]; |
362 | 20.5M | } |
363 | 4.07M | } |
364 | | |
365 | 34.6M | for (int y=0;y<nT;y++) |
366 | 241M | for (int x=0;x<nT;x++) |
367 | 212M | { |
368 | 212M | int iIdx = ((y+1)*intraPredAngle)>>5; |
369 | 212M | int iFact= ((y+1)*intraPredAngle)&31; |
370 | | |
371 | 212M | if (iFact != 0) { |
372 | 111M | dst[x+y*dstStride] = ((32-iFact)*ref[x+iIdx+1] + iFact*ref[x+iIdx+2] + 16)>>5; |
373 | 111M | } else { |
374 | 100M | dst[x+y*dstStride] = ref[x+iIdx+1]; |
375 | 100M | } |
376 | 212M | } |
377 | | |
378 | 5.72M | if (intraPredMode==26 && cIdx==0 && nT<32 && !disableIntraBoundaryFilter) { |
379 | 3.80M | for (int y=0;y<nT;y++) { |
380 | 3.17M | dst[0+y*dstStride] = Clip_BitDepth(border[1] + ((border[-1-y] - border[0])>>1), bit_depth); |
381 | 3.17M | } |
382 | 631k | } |
383 | 5.72M | } |
384 | 5.23M | else { // intraPredAngle < 18 |
385 | | |
386 | 36.4M | for (int x=0;x<=nT;x++) |
387 | 31.2M | { ref[x] = border[-x]; } // DIFF (neg) |
388 | | |
389 | 5.23M | if (intraPredAngle<0) { |
390 | 1.27M | int invAngle = invAngle_table[intraPredMode-11]; |
391 | | |
392 | 1.27M | if ((nT*intraPredAngle)>>5 < -1) { |
393 | 4.16M | for (int x=(nT*intraPredAngle)>>5; x<=-1; x++) { |
394 | 3.23M | ref[x] = border[((x*invAngle+128)>>8)]; // DIFF (neg) |
395 | 3.23M | } |
396 | 931k | } |
397 | 3.96M | } else { |
398 | 23.3M | for (int x=nT+1; x<=2*nT;x++) { |
399 | 19.3M | ref[x] = border[-x]; // DIFF (neg) |
400 | 19.3M | } |
401 | 3.96M | } |
402 | | |
403 | 31.2M | for (int y=0;y<nT;y++) |
404 | 212M | for (int x=0;x<nT;x++) |
405 | 186M | { |
406 | 186M | int iIdx = ((x+1)*intraPredAngle)>>5; // DIFF (x<->y) |
407 | 186M | int iFact= ((x+1)*intraPredAngle)&31; // DIFF (x<->y) |
408 | | |
409 | 186M | if (iFact != 0) { |
410 | 108M | dst[x+y*dstStride] = ((32-iFact)*ref[y+iIdx+1] + iFact*ref[y+iIdx+2] + 16)>>5; // DIFF (x<->y) |
411 | 108M | } else { |
412 | 78.5M | dst[x+y*dstStride] = ref[y+iIdx+1]; // DIFF (x<->y) |
413 | 78.5M | } |
414 | 186M | } |
415 | | |
416 | 5.23M | if (intraPredMode==10 && cIdx==0 && nT<32 && !disableIntraBoundaryFilter) { // DIFF 26->10 |
417 | 721k | for (int x=0;x<nT;x++) { // DIFF (x<->y) |
418 | 600k | dst[x] = Clip_BitDepth(border[-1] + ((border[1+x] - border[0])>>1), bit_depth); // DIFF (x<->y && neg) |
419 | 600k | } |
420 | 120k | } |
421 | 5.23M | } |
422 | | |
423 | | |
424 | 10.9M | logtrace(LogIntraPred,"result of angular intra prediction (mode=%d):\n",intraPredMode); |
425 | | |
426 | 65.8M | for (int y=0;y<nT;y++) |
427 | 54.9M | { |
428 | 453M | for (int x=0;x<nT;x++) |
429 | 399M | logtrace(LogIntraPred,"%02x ", dst[x+y*dstStride]); |
430 | | |
431 | 54.9M | logtrace(LogIntraPred,"\n"); |
432 | 54.9M | } |
433 | 10.9M | } Unexecuted instantiation: void intra_prediction_angular<unsigned char>(unsigned char*, int, int, bool, int, int, IntraPredMode, int, int, unsigned char*) void intra_prediction_angular<unsigned short>(unsigned short*, int, int, bool, int, int, IntraPredMode, int, int, unsigned short*) Line | Count | Source | 337 | 10.9M | { | 338 | 10.9M | pixel_t ref_mem[4*MAX_INTRA_PRED_BLOCK_SIZE+1]; // TODO: what is the required range here ? | 339 | 10.9M | pixel_t* ref=&ref_mem[2*MAX_INTRA_PRED_BLOCK_SIZE]; | 340 | | | 341 | 10.9M | assert(intraPredMode<35); | 342 | 10.9M | assert(intraPredMode>=2); | 343 | | | 344 | 10.9M | int intraPredAngle = intraPredAngle_table[intraPredMode]; | 345 | | | 346 | 10.9M | if (intraPredMode >= 18) { | 347 | | | 348 | 40.3M | for (int x=0;x<=nT;x++) | 349 | 34.6M | { ref[x] = border[x]; } | 350 | | | 351 | 5.72M | if (intraPredAngle<0) { | 352 | 1.64M | int invAngle = invAngle_table[intraPredMode-11]; | 353 | | | 354 | 1.64M | if ((nT*intraPredAngle)>>5 < -1) { | 355 | 5.32M | for (int x=(nT*intraPredAngle)>>5; x<=-1; x++) { | 356 | 4.17M | ref[x] = border[0-((x*invAngle+128)>>8)]; | 357 | 4.17M | } | 358 | 1.15M | } | 359 | 4.07M | } else { | 360 | 24.6M | for (int x=nT+1; x<=2*nT;x++) { | 361 | 20.5M | ref[x] = border[x]; | 362 | 20.5M | } | 363 | 4.07M | } | 364 | | | 365 | 34.6M | for (int y=0;y<nT;y++) | 366 | 241M | for (int x=0;x<nT;x++) | 367 | 212M | { | 368 | 212M | int iIdx = ((y+1)*intraPredAngle)>>5; | 369 | 212M | int iFact= ((y+1)*intraPredAngle)&31; | 370 | | | 371 | 212M | if (iFact != 0) { | 372 | 111M | dst[x+y*dstStride] = ((32-iFact)*ref[x+iIdx+1] + iFact*ref[x+iIdx+2] + 16)>>5; | 373 | 111M | } else { | 374 | 100M | dst[x+y*dstStride] = ref[x+iIdx+1]; | 375 | 100M | } | 376 | 212M | } | 377 | | | 378 | 5.72M | if (intraPredMode==26 && cIdx==0 && nT<32 && !disableIntraBoundaryFilter) { | 379 | 3.80M | for (int y=0;y<nT;y++) { | 380 | 3.17M | dst[0+y*dstStride] = Clip_BitDepth(border[1] + ((border[-1-y] - border[0])>>1), bit_depth); | 381 | 3.17M | } | 382 | 631k | } | 383 | 5.72M | } | 384 | 5.23M | else { // intraPredAngle < 18 | 385 | | | 386 | 36.4M | for (int x=0;x<=nT;x++) | 387 | 31.2M | { ref[x] = border[-x]; } // DIFF (neg) | 388 | | | 389 | 5.23M | if (intraPredAngle<0) { | 390 | 1.27M | int invAngle = invAngle_table[intraPredMode-11]; | 391 | | | 392 | 1.27M | if ((nT*intraPredAngle)>>5 < -1) { | 393 | 4.16M | for (int x=(nT*intraPredAngle)>>5; x<=-1; x++) { | 394 | 3.23M | ref[x] = border[((x*invAngle+128)>>8)]; // DIFF (neg) | 395 | 3.23M | } | 396 | 931k | } | 397 | 3.96M | } else { | 398 | 23.3M | for (int x=nT+1; x<=2*nT;x++) { | 399 | 19.3M | ref[x] = border[-x]; // DIFF (neg) | 400 | 19.3M | } | 401 | 3.96M | } | 402 | | | 403 | 31.2M | for (int y=0;y<nT;y++) | 404 | 212M | for (int x=0;x<nT;x++) | 405 | 186M | { | 406 | 186M | int iIdx = ((x+1)*intraPredAngle)>>5; // DIFF (x<->y) | 407 | 186M | int iFact= ((x+1)*intraPredAngle)&31; // DIFF (x<->y) | 408 | | | 409 | 186M | if (iFact != 0) { | 410 | 108M | dst[x+y*dstStride] = ((32-iFact)*ref[y+iIdx+1] + iFact*ref[y+iIdx+2] + 16)>>5; // DIFF (x<->y) | 411 | 108M | } else { | 412 | 78.5M | dst[x+y*dstStride] = ref[y+iIdx+1]; // DIFF (x<->y) | 413 | 78.5M | } | 414 | 186M | } | 415 | | | 416 | 5.23M | if (intraPredMode==10 && cIdx==0 && nT<32 && !disableIntraBoundaryFilter) { // DIFF 26->10 | 417 | 721k | for (int x=0;x<nT;x++) { // DIFF (x<->y) | 418 | 600k | dst[x] = Clip_BitDepth(border[-1] + ((border[1+x] - border[0])>>1), bit_depth); // DIFF (x<->y && neg) | 419 | 600k | } | 420 | 120k | } | 421 | 5.23M | } | 422 | | | 423 | | | 424 | 10.9M | logtrace(LogIntraPred,"result of angular intra prediction (mode=%d):\n",intraPredMode); | 425 | | | 426 | 65.8M | for (int y=0;y<nT;y++) | 427 | 54.9M | { | 428 | 453M | for (int x=0;x<nT;x++) | 429 | 399M | logtrace(LogIntraPred,"%02x ", dst[x+y*dstStride]); | 430 | | | 431 | 54.9M | logtrace(LogIntraPred,"\n"); | 432 | 54.9M | } | 433 | 10.9M | } |
|
434 | | |
435 | | |
436 | | template <class pixel_t> |
437 | | void intra_border_computer<pixel_t>::preproc() |
438 | 74.5M | { |
439 | 74.5M | sps = &img->get_sps(); |
440 | 74.5M | pps = &img->get_pps(); |
441 | | |
442 | 74.5M | SubWidth = (cIdx==0) ? 1 : sps->SubWidthC; |
443 | 74.5M | SubHeight = (cIdx==0) ? 1 : sps->SubHeightC; |
444 | | |
445 | | // --- check for CTB boundaries --- |
446 | | |
447 | 74.5M | int xBLuma = xB * SubWidth; |
448 | 74.5M | int yBLuma = yB * SubHeight; |
449 | | |
450 | 74.5M | int log2CtbSize = sps->Log2CtbSizeY; |
451 | 74.5M | int picWidthInCtbs = sps->PicWidthInCtbsY; |
452 | | |
453 | | |
454 | | //printf("xB/yB: %d %d\n",xB,yB); |
455 | | |
456 | | // are we at left image border |
457 | | |
458 | 74.5M | if (xBLuma == 0) { |
459 | 624k | availableLeft = false; |
460 | 624k | availableTopLeft = false; |
461 | 624k | xBLuma = 0; // fake value, available flags are already set to false |
462 | 624k | } |
463 | | |
464 | | |
465 | | // are we at top image border |
466 | | |
467 | 74.5M | if (yBLuma == 0) { |
468 | 1.47M | availableTop = false; |
469 | 1.47M | availableTopLeft = false; |
470 | 1.47M | availableTopRight = false; |
471 | 1.47M | yBLuma = 0; // fake value, available flags are already set to false |
472 | 1.47M | } |
473 | | |
474 | 74.5M | if (xBLuma+nT*SubWidth >= sps->pic_width_in_luma_samples) { |
475 | 709k | availableTopRight=false; |
476 | 709k | } |
477 | | |
478 | | // check for tile and slice boundaries |
479 | | |
480 | 74.5M | int xCurrCtb = xBLuma >> log2CtbSize; |
481 | 74.5M | int yCurrCtb = yBLuma >> log2CtbSize; |
482 | 74.5M | int xLeftCtb = (xBLuma-1) >> log2CtbSize; |
483 | 74.5M | int xRightCtb = (xBLuma+nT*SubWidth) >> log2CtbSize; |
484 | 74.5M | int yTopCtb = (yBLuma-1) >> log2CtbSize; |
485 | | |
486 | 74.5M | int currCTBSlice = img->get_SliceAddrRS(xCurrCtb,yCurrCtb); |
487 | 74.5M | int leftCTBSlice = availableLeft ? img->get_SliceAddrRS(xLeftCtb, yCurrCtb) : -1; |
488 | 74.5M | int topCTBSlice = availableTop ? img->get_SliceAddrRS(xCurrCtb, yTopCtb) : -1; |
489 | 74.5M | int toprightCTBSlice = availableTopRight ? img->get_SliceAddrRS(xRightCtb, yTopCtb) : -1; |
490 | 74.5M | int topleftCTBSlice = availableTopLeft ? img->get_SliceAddrRS(xLeftCtb, yTopCtb) : -1; |
491 | | |
492 | | /* |
493 | | printf("size: %d\n",pps->scan->TileIdRS.size()); |
494 | | printf("curr: %d left: %d top: %d\n", |
495 | | xCurrCtb+yCurrCtb*picWidthInCtbs, |
496 | | availableLeft ? xLeftCtb+yCurrCtb*picWidthInCtbs : 9999, |
497 | | availableTop ? xCurrCtb+yTopCtb*picWidthInCtbs : 9999); |
498 | | */ |
499 | 74.5M | uint32_t currCTBTileID = pps->scan->TileIdRS[xCurrCtb+yCurrCtb*picWidthInCtbs]; |
500 | 74.5M | uint32_t leftCTBTileID = availableLeft ? pps->scan->TileIdRS[xLeftCtb+yCurrCtb*picWidthInCtbs] : UINT32_MAX; |
501 | 74.5M | uint32_t topCTBTileID = availableTop ? pps->scan->TileIdRS[xCurrCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; |
502 | 74.5M | uint32_t topleftCTBTileID = availableTopLeft ? pps->scan->TileIdRS[xLeftCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; |
503 | 74.5M | uint32_t toprightCTBTileID= availableTopRight? pps->scan->TileIdRS[xRightCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; |
504 | | |
505 | 74.5M | if (leftCTBSlice != currCTBSlice || leftCTBTileID != currCTBTileID ) availableLeft = false; |
506 | 74.5M | if (topCTBSlice != currCTBSlice || topCTBTileID != currCTBTileID ) availableTop = false; |
507 | 74.5M | if (topleftCTBSlice !=currCTBSlice||topleftCTBTileID!=currCTBTileID ) availableTopLeft = false; |
508 | 74.5M | if (toprightCTBSlice!=currCTBSlice||toprightCTBTileID!=currCTBTileID) availableTopRight= false; |
509 | | |
510 | | |
511 | | // number of pixels that are in the valid image area to the right and to the bottom |
512 | | |
513 | 74.5M | nBottom = sps->pic_height_in_luma_samples - yB*SubHeight; |
514 | 74.5M | nBottom=(nBottom+SubHeight-1)/SubHeight; |
515 | 74.5M | if (nBottom>2*nT) nBottom=2*nT; |
516 | | |
517 | 74.5M | nRight = sps->pic_width_in_luma_samples - xB*SubWidth; |
518 | 74.5M | nRight =(nRight +SubWidth-1)/SubWidth; |
519 | 74.5M | if (nRight >2*nT) nRight=2*nT; |
520 | | |
521 | 74.5M | nAvail=0; |
522 | | |
523 | 74.5M | available = &available_data[2*MAX_INTRA_PRED_BLOCK_SIZE]; |
524 | | |
525 | 74.5M | memset(available-2*nT, 0, 4*nT+1); |
526 | 74.5M | } intra_border_computer<unsigned short>::preproc() Line | Count | Source | 438 | 17.5M | { | 439 | 17.5M | sps = &img->get_sps(); | 440 | 17.5M | pps = &img->get_pps(); | 441 | | | 442 | 17.5M | SubWidth = (cIdx==0) ? 1 : sps->SubWidthC; | 443 | 17.5M | SubHeight = (cIdx==0) ? 1 : sps->SubHeightC; | 444 | | | 445 | | // --- check for CTB boundaries --- | 446 | | | 447 | 17.5M | int xBLuma = xB * SubWidth; | 448 | 17.5M | int yBLuma = yB * SubHeight; | 449 | | | 450 | 17.5M | int log2CtbSize = sps->Log2CtbSizeY; | 451 | 17.5M | int picWidthInCtbs = sps->PicWidthInCtbsY; | 452 | | | 453 | | | 454 | | //printf("xB/yB: %d %d\n",xB,yB); | 455 | | | 456 | | // are we at left image border | 457 | | | 458 | 17.5M | if (xBLuma == 0) { | 459 | 171k | availableLeft = false; | 460 | 171k | availableTopLeft = false; | 461 | 171k | xBLuma = 0; // fake value, available flags are already set to false | 462 | 171k | } | 463 | | | 464 | | | 465 | | // are we at top image border | 466 | | | 467 | 17.5M | if (yBLuma == 0) { | 468 | 469k | availableTop = false; | 469 | 469k | availableTopLeft = false; | 470 | 469k | availableTopRight = false; | 471 | 469k | yBLuma = 0; // fake value, available flags are already set to false | 472 | 469k | } | 473 | | | 474 | 17.5M | if (xBLuma+nT*SubWidth >= sps->pic_width_in_luma_samples) { | 475 | 205k | availableTopRight=false; | 476 | 205k | } | 477 | | | 478 | | // check for tile and slice boundaries | 479 | | | 480 | 17.5M | int xCurrCtb = xBLuma >> log2CtbSize; | 481 | 17.5M | int yCurrCtb = yBLuma >> log2CtbSize; | 482 | 17.5M | int xLeftCtb = (xBLuma-1) >> log2CtbSize; | 483 | 17.5M | int xRightCtb = (xBLuma+nT*SubWidth) >> log2CtbSize; | 484 | 17.5M | int yTopCtb = (yBLuma-1) >> log2CtbSize; | 485 | | | 486 | 17.5M | int currCTBSlice = img->get_SliceAddrRS(xCurrCtb,yCurrCtb); | 487 | 17.5M | int leftCTBSlice = availableLeft ? img->get_SliceAddrRS(xLeftCtb, yCurrCtb) : -1; | 488 | 17.5M | int topCTBSlice = availableTop ? img->get_SliceAddrRS(xCurrCtb, yTopCtb) : -1; | 489 | 17.5M | int toprightCTBSlice = availableTopRight ? img->get_SliceAddrRS(xRightCtb, yTopCtb) : -1; | 490 | 17.5M | int topleftCTBSlice = availableTopLeft ? img->get_SliceAddrRS(xLeftCtb, yTopCtb) : -1; | 491 | | | 492 | | /* | 493 | | printf("size: %d\n",pps->scan->TileIdRS.size()); | 494 | | printf("curr: %d left: %d top: %d\n", | 495 | | xCurrCtb+yCurrCtb*picWidthInCtbs, | 496 | | availableLeft ? xLeftCtb+yCurrCtb*picWidthInCtbs : 9999, | 497 | | availableTop ? xCurrCtb+yTopCtb*picWidthInCtbs : 9999); | 498 | | */ | 499 | 17.5M | uint32_t currCTBTileID = pps->scan->TileIdRS[xCurrCtb+yCurrCtb*picWidthInCtbs]; | 500 | 17.5M | uint32_t leftCTBTileID = availableLeft ? pps->scan->TileIdRS[xLeftCtb+yCurrCtb*picWidthInCtbs] : UINT32_MAX; | 501 | 17.5M | uint32_t topCTBTileID = availableTop ? pps->scan->TileIdRS[xCurrCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; | 502 | 17.5M | uint32_t topleftCTBTileID = availableTopLeft ? pps->scan->TileIdRS[xLeftCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; | 503 | 17.5M | uint32_t toprightCTBTileID= availableTopRight? pps->scan->TileIdRS[xRightCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; | 504 | | | 505 | 17.5M | if (leftCTBSlice != currCTBSlice || leftCTBTileID != currCTBTileID ) availableLeft = false; | 506 | 17.5M | if (topCTBSlice != currCTBSlice || topCTBTileID != currCTBTileID ) availableTop = false; | 507 | 17.5M | if (topleftCTBSlice !=currCTBSlice||topleftCTBTileID!=currCTBTileID ) availableTopLeft = false; | 508 | 17.5M | if (toprightCTBSlice!=currCTBSlice||toprightCTBTileID!=currCTBTileID) availableTopRight= false; | 509 | | | 510 | | | 511 | | // number of pixels that are in the valid image area to the right and to the bottom | 512 | | | 513 | 17.5M | nBottom = sps->pic_height_in_luma_samples - yB*SubHeight; | 514 | 17.5M | nBottom=(nBottom+SubHeight-1)/SubHeight; | 515 | 17.5M | if (nBottom>2*nT) nBottom=2*nT; | 516 | | | 517 | 17.5M | nRight = sps->pic_width_in_luma_samples - xB*SubWidth; | 518 | 17.5M | nRight =(nRight +SubWidth-1)/SubWidth; | 519 | 17.5M | if (nRight >2*nT) nRight=2*nT; | 520 | | | 521 | 17.5M | nAvail=0; | 522 | | | 523 | 17.5M | available = &available_data[2*MAX_INTRA_PRED_BLOCK_SIZE]; | 524 | | | 525 | 17.5M | memset(available-2*nT, 0, 4*nT+1); | 526 | 17.5M | } |
intra_border_computer<unsigned char>::preproc() Line | Count | Source | 438 | 57.0M | { | 439 | 57.0M | sps = &img->get_sps(); | 440 | 57.0M | pps = &img->get_pps(); | 441 | | | 442 | 57.0M | SubWidth = (cIdx==0) ? 1 : sps->SubWidthC; | 443 | 57.0M | SubHeight = (cIdx==0) ? 1 : sps->SubHeightC; | 444 | | | 445 | | // --- check for CTB boundaries --- | 446 | | | 447 | 57.0M | int xBLuma = xB * SubWidth; | 448 | 57.0M | int yBLuma = yB * SubHeight; | 449 | | | 450 | 57.0M | int log2CtbSize = sps->Log2CtbSizeY; | 451 | 57.0M | int picWidthInCtbs = sps->PicWidthInCtbsY; | 452 | | | 453 | | | 454 | | //printf("xB/yB: %d %d\n",xB,yB); | 455 | | | 456 | | // are we at left image border | 457 | | | 458 | 57.0M | if (xBLuma == 0) { | 459 | 452k | availableLeft = false; | 460 | 452k | availableTopLeft = false; | 461 | 452k | xBLuma = 0; // fake value, available flags are already set to false | 462 | 452k | } | 463 | | | 464 | | | 465 | | // are we at top image border | 466 | | | 467 | 57.0M | if (yBLuma == 0) { | 468 | 1.00M | availableTop = false; | 469 | 1.00M | availableTopLeft = false; | 470 | 1.00M | availableTopRight = false; | 471 | 1.00M | yBLuma = 0; // fake value, available flags are already set to false | 472 | 1.00M | } | 473 | | | 474 | 57.0M | if (xBLuma+nT*SubWidth >= sps->pic_width_in_luma_samples) { | 475 | 503k | availableTopRight=false; | 476 | 503k | } | 477 | | | 478 | | // check for tile and slice boundaries | 479 | | | 480 | 57.0M | int xCurrCtb = xBLuma >> log2CtbSize; | 481 | 57.0M | int yCurrCtb = yBLuma >> log2CtbSize; | 482 | 57.0M | int xLeftCtb = (xBLuma-1) >> log2CtbSize; | 483 | 57.0M | int xRightCtb = (xBLuma+nT*SubWidth) >> log2CtbSize; | 484 | 57.0M | int yTopCtb = (yBLuma-1) >> log2CtbSize; | 485 | | | 486 | 57.0M | int currCTBSlice = img->get_SliceAddrRS(xCurrCtb,yCurrCtb); | 487 | 57.0M | int leftCTBSlice = availableLeft ? img->get_SliceAddrRS(xLeftCtb, yCurrCtb) : -1; | 488 | 57.0M | int topCTBSlice = availableTop ? img->get_SliceAddrRS(xCurrCtb, yTopCtb) : -1; | 489 | 57.0M | int toprightCTBSlice = availableTopRight ? img->get_SliceAddrRS(xRightCtb, yTopCtb) : -1; | 490 | 57.0M | int topleftCTBSlice = availableTopLeft ? img->get_SliceAddrRS(xLeftCtb, yTopCtb) : -1; | 491 | | | 492 | | /* | 493 | | printf("size: %d\n",pps->scan->TileIdRS.size()); | 494 | | printf("curr: %d left: %d top: %d\n", | 495 | | xCurrCtb+yCurrCtb*picWidthInCtbs, | 496 | | availableLeft ? xLeftCtb+yCurrCtb*picWidthInCtbs : 9999, | 497 | | availableTop ? xCurrCtb+yTopCtb*picWidthInCtbs : 9999); | 498 | | */ | 499 | 57.0M | uint32_t currCTBTileID = pps->scan->TileIdRS[xCurrCtb+yCurrCtb*picWidthInCtbs]; | 500 | 57.0M | uint32_t leftCTBTileID = availableLeft ? pps->scan->TileIdRS[xLeftCtb+yCurrCtb*picWidthInCtbs] : UINT32_MAX; | 501 | 57.0M | uint32_t topCTBTileID = availableTop ? pps->scan->TileIdRS[xCurrCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; | 502 | 57.0M | uint32_t topleftCTBTileID = availableTopLeft ? pps->scan->TileIdRS[xLeftCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; | 503 | 57.0M | uint32_t toprightCTBTileID= availableTopRight? pps->scan->TileIdRS[xRightCtb+yTopCtb*picWidthInCtbs] : UINT32_MAX; | 504 | | | 505 | 57.0M | if (leftCTBSlice != currCTBSlice || leftCTBTileID != currCTBTileID ) availableLeft = false; | 506 | 57.0M | if (topCTBSlice != currCTBSlice || topCTBTileID != currCTBTileID ) availableTop = false; | 507 | 57.0M | if (topleftCTBSlice !=currCTBSlice||topleftCTBTileID!=currCTBTileID ) availableTopLeft = false; | 508 | 57.0M | if (toprightCTBSlice!=currCTBSlice||toprightCTBTileID!=currCTBTileID) availableTopRight= false; | 509 | | | 510 | | | 511 | | // number of pixels that are in the valid image area to the right and to the bottom | 512 | | | 513 | 57.0M | nBottom = sps->pic_height_in_luma_samples - yB*SubHeight; | 514 | 57.0M | nBottom=(nBottom+SubHeight-1)/SubHeight; | 515 | 57.0M | if (nBottom>2*nT) nBottom=2*nT; | 516 | | | 517 | 57.0M | nRight = sps->pic_width_in_luma_samples - xB*SubWidth; | 518 | 57.0M | nRight =(nRight +SubWidth-1)/SubWidth; | 519 | 57.0M | if (nRight >2*nT) nRight=2*nT; | 520 | | | 521 | 57.0M | nAvail=0; | 522 | | | 523 | 57.0M | available = &available_data[2*MAX_INTRA_PRED_BLOCK_SIZE]; | 524 | | | 525 | 57.0M | memset(available-2*nT, 0, 4*nT+1); | 526 | 57.0M | } |
|
527 | | |
528 | | |
529 | | template <class pixel_t> |
530 | | void intra_border_computer<pixel_t>::fill_from_image() |
531 | 74.2M | { |
532 | 74.2M | assert(nT<=32); |
533 | | |
534 | 74.2M | pixel_t* image; |
535 | 74.2M | ptrdiff_t stride; |
536 | 74.2M | image = (pixel_t*)img->get_image_plane(cIdx); |
537 | 74.2M | stride = img->get_image_stride(cIdx); |
538 | | |
539 | 74.2M | int xBLuma = xB * SubWidth; |
540 | 74.2M | int yBLuma = yB * SubHeight; |
541 | | |
542 | 74.2M | int currBlockAddr = pps->scan->MinTbAddrZS[ (xBLuma>>sps->Log2MinTrafoSize) + |
543 | 74.2M | (yBLuma>>sps->Log2MinTrafoSize) * sps->PicWidthInTbsY ]; |
544 | | |
545 | | |
546 | | // copy pixels at left column |
547 | | |
548 | 258M | for (int y=nBottom-1 ; y>=0 ; y-=4) |
549 | 184M | if (availableLeft) |
550 | 181M | { |
551 | 181M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB-1)*SubWidth )>>sps->Log2MinTrafoSize) + |
552 | 181M | (((yB+y)*SubHeight)>>sps->Log2MinTrafoSize) |
553 | 181M | * sps->PicWidthInTbsY ]; |
554 | | |
555 | 181M | bool availableN = NBlockAddr <= currBlockAddr; |
556 | | |
557 | 181M | if (pps->constrained_intra_pred_flag) { |
558 | 11.0M | if (img->get_pred_mode((xB-1)*SubWidth,(yB+y)*SubHeight)!=MODE_INTRA) |
559 | 36.7k | availableN = false; |
560 | 11.0M | } |
561 | | |
562 | 181M | if (availableN) { |
563 | 121M | if (!nAvail) firstValue = image[xB-1 + (yB+y)*stride]; |
564 | | |
565 | 608M | for (int i=0;i<4;i++) { |
566 | 487M | available[-y+i-1] = availableN; |
567 | 487M | out_border[-y+i-1] = image[xB-1 + (yB+y-i)*stride]; |
568 | 487M | } |
569 | | |
570 | 121M | nAvail+=4; |
571 | 121M | } |
572 | 181M | } |
573 | | |
574 | | // copy pixel at top-left position |
575 | | |
576 | 74.2M | if (availableTopLeft) |
577 | 72.3M | { |
578 | 72.3M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB-1)*SubWidth )>>sps->Log2MinTrafoSize) + |
579 | 72.3M | (((yB-1)*SubHeight)>>sps->Log2MinTrafoSize) |
580 | 72.3M | * sps->PicWidthInTbsY ]; |
581 | | |
582 | 72.3M | bool availableN = NBlockAddr <= currBlockAddr; |
583 | | |
584 | 72.3M | if (pps->constrained_intra_pred_flag) { |
585 | 4.67M | if (img->get_pred_mode((xB-1)*SubWidth,(yB-1)*SubHeight)!=MODE_INTRA) { |
586 | 27.1k | availableN = false; |
587 | 27.1k | } |
588 | 4.67M | } |
589 | | |
590 | 72.3M | if (availableN) { |
591 | 72.3M | if (!nAvail) firstValue = image[xB-1 + (yB-1)*stride]; |
592 | | |
593 | 72.3M | out_border[0] = image[xB-1 + (yB-1)*stride]; |
594 | 72.3M | available[0] = availableN; |
595 | 72.3M | nAvail++; |
596 | 72.3M | } |
597 | 72.3M | } |
598 | | |
599 | | // copy pixels at top row |
600 | | |
601 | 260M | for (int x=0 ; x<nRight ; x+=4) { |
602 | 185M | bool borderAvailable; |
603 | 185M | if (x<nT) borderAvailable=availableTop; |
604 | 92.2M | else borderAvailable=availableTopRight; |
605 | | |
606 | 185M | if (borderAvailable) |
607 | 180M | { |
608 | 180M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB+x)*SubWidth )>>sps->Log2MinTrafoSize) + |
609 | 180M | (((yB-1)*SubHeight)>>sps->Log2MinTrafoSize) |
610 | 180M | * sps->PicWidthInTbsY ]; |
611 | | |
612 | 180M | bool availableN = NBlockAddr <= currBlockAddr; |
613 | | |
614 | 180M | if (pps->constrained_intra_pred_flag) { |
615 | 10.9M | if (img->get_pred_mode((xB+x)*SubWidth,(yB-1)*SubHeight)!=MODE_INTRA) { |
616 | 42.5k | availableN = false; |
617 | 42.5k | } |
618 | 10.9M | } |
619 | | |
620 | | |
621 | 180M | if (availableN) { |
622 | 150M | if (!nAvail) firstValue = image[xB+x + (yB-1)*stride]; |
623 | | |
624 | 753M | for (int i=0;i<4;i++) { |
625 | 602M | out_border[x+i+1] = image[xB+x+i + (yB-1)*stride]; |
626 | 602M | available[x+i+1] = availableN; |
627 | 602M | } |
628 | | |
629 | 150M | nAvail+=4; |
630 | 150M | } |
631 | 180M | } |
632 | 185M | } |
633 | 74.2M | } intra_border_computer<unsigned short>::fill_from_image() Line | Count | Source | 531 | 17.5M | { | 532 | 17.5M | assert(nT<=32); | 533 | | | 534 | 17.5M | pixel_t* image; | 535 | 17.5M | ptrdiff_t stride; | 536 | 17.5M | image = (pixel_t*)img->get_image_plane(cIdx); | 537 | 17.5M | stride = img->get_image_stride(cIdx); | 538 | | | 539 | 17.5M | int xBLuma = xB * SubWidth; | 540 | 17.5M | int yBLuma = yB * SubHeight; | 541 | | | 542 | 17.5M | int currBlockAddr = pps->scan->MinTbAddrZS[ (xBLuma>>sps->Log2MinTrafoSize) + | 543 | 17.5M | (yBLuma>>sps->Log2MinTrafoSize) * sps->PicWidthInTbsY ]; | 544 | | | 545 | | | 546 | | // copy pixels at left column | 547 | | | 548 | 61.1M | for (int y=nBottom-1 ; y>=0 ; y-=4) | 549 | 43.6M | if (availableLeft) | 550 | 42.9M | { | 551 | 42.9M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB-1)*SubWidth )>>sps->Log2MinTrafoSize) + | 552 | 42.9M | (((yB+y)*SubHeight)>>sps->Log2MinTrafoSize) | 553 | 42.9M | * sps->PicWidthInTbsY ]; | 554 | | | 555 | 42.9M | bool availableN = NBlockAddr <= currBlockAddr; | 556 | | | 557 | 42.9M | if (pps->constrained_intra_pred_flag) { | 558 | 4.26M | if (img->get_pred_mode((xB-1)*SubWidth,(yB+y)*SubHeight)!=MODE_INTRA) | 559 | 22.8k | availableN = false; | 560 | 4.26M | } | 561 | | | 562 | 42.9M | if (availableN) { | 563 | 28.8M | if (!nAvail) firstValue = image[xB-1 + (yB+y)*stride]; | 564 | | | 565 | 144M | for (int i=0;i<4;i++) { | 566 | 115M | available[-y+i-1] = availableN; | 567 | 115M | out_border[-y+i-1] = image[xB-1 + (yB+y-i)*stride]; | 568 | 115M | } | 569 | | | 570 | 28.8M | nAvail+=4; | 571 | 28.8M | } | 572 | 42.9M | } | 573 | | | 574 | | // copy pixel at top-left position | 575 | | | 576 | 17.5M | if (availableTopLeft) | 577 | 16.8M | { | 578 | 16.8M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB-1)*SubWidth )>>sps->Log2MinTrafoSize) + | 579 | 16.8M | (((yB-1)*SubHeight)>>sps->Log2MinTrafoSize) | 580 | 16.8M | * sps->PicWidthInTbsY ]; | 581 | | | 582 | 16.8M | bool availableN = NBlockAddr <= currBlockAddr; | 583 | | | 584 | 16.8M | if (pps->constrained_intra_pred_flag) { | 585 | 1.84M | if (img->get_pred_mode((xB-1)*SubWidth,(yB-1)*SubHeight)!=MODE_INTRA) { | 586 | 18.2k | availableN = false; | 587 | 18.2k | } | 588 | 1.84M | } | 589 | | | 590 | 16.8M | if (availableN) { | 591 | 16.8M | if (!nAvail) firstValue = image[xB-1 + (yB-1)*stride]; | 592 | | | 593 | 16.8M | out_border[0] = image[xB-1 + (yB-1)*stride]; | 594 | 16.8M | available[0] = availableN; | 595 | 16.8M | nAvail++; | 596 | 16.8M | } | 597 | 16.8M | } | 598 | | | 599 | | // copy pixels at top row | 600 | | | 601 | 61.4M | for (int x=0 ; x<nRight ; x+=4) { | 602 | 43.9M | bool borderAvailable; | 603 | 43.9M | if (x<nT) borderAvailable=availableTop; | 604 | 21.8M | else borderAvailable=availableTopRight; | 605 | | | 606 | 43.9M | if (borderAvailable) | 607 | 42.3M | { | 608 | 42.3M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB+x)*SubWidth )>>sps->Log2MinTrafoSize) + | 609 | 42.3M | (((yB-1)*SubHeight)>>sps->Log2MinTrafoSize) | 610 | 42.3M | * sps->PicWidthInTbsY ]; | 611 | | | 612 | 42.3M | bool availableN = NBlockAddr <= currBlockAddr; | 613 | | | 614 | 42.3M | if (pps->constrained_intra_pred_flag) { | 615 | 4.22M | if (img->get_pred_mode((xB+x)*SubWidth,(yB-1)*SubHeight)!=MODE_INTRA) { | 616 | 25.3k | availableN = false; | 617 | 25.3k | } | 618 | 4.22M | } | 619 | | | 620 | | | 621 | 42.3M | if (availableN) { | 622 | 35.2M | if (!nAvail) firstValue = image[xB+x + (yB-1)*stride]; | 623 | | | 624 | 176M | for (int i=0;i<4;i++) { | 625 | 140M | out_border[x+i+1] = image[xB+x+i + (yB-1)*stride]; | 626 | 140M | available[x+i+1] = availableN; | 627 | 140M | } | 628 | | | 629 | 35.2M | nAvail+=4; | 630 | 35.2M | } | 631 | 42.3M | } | 632 | 43.9M | } | 633 | 17.5M | } |
intra_border_computer<unsigned char>::fill_from_image() Line | Count | Source | 531 | 56.7M | { | 532 | 56.7M | assert(nT<=32); | 533 | | | 534 | 56.7M | pixel_t* image; | 535 | 56.7M | ptrdiff_t stride; | 536 | 56.7M | image = (pixel_t*)img->get_image_plane(cIdx); | 537 | 56.7M | stride = img->get_image_stride(cIdx); | 538 | | | 539 | 56.7M | int xBLuma = xB * SubWidth; | 540 | 56.7M | int yBLuma = yB * SubHeight; | 541 | | | 542 | 56.7M | int currBlockAddr = pps->scan->MinTbAddrZS[ (xBLuma>>sps->Log2MinTrafoSize) + | 543 | 56.7M | (yBLuma>>sps->Log2MinTrafoSize) * sps->PicWidthInTbsY ]; | 544 | | | 545 | | | 546 | | // copy pixels at left column | 547 | | | 548 | 197M | for (int y=nBottom-1 ; y>=0 ; y-=4) | 549 | 140M | if (availableLeft) | 550 | 138M | { | 551 | 138M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB-1)*SubWidth )>>sps->Log2MinTrafoSize) + | 552 | 138M | (((yB+y)*SubHeight)>>sps->Log2MinTrafoSize) | 553 | 138M | * sps->PicWidthInTbsY ]; | 554 | | | 555 | 138M | bool availableN = NBlockAddr <= currBlockAddr; | 556 | | | 557 | 138M | if (pps->constrained_intra_pred_flag) { | 558 | 6.75M | if (img->get_pred_mode((xB-1)*SubWidth,(yB+y)*SubHeight)!=MODE_INTRA) | 559 | 13.8k | availableN = false; | 560 | 6.75M | } | 561 | | | 562 | 138M | if (availableN) { | 563 | 92.9M | if (!nAvail) firstValue = image[xB-1 + (yB+y)*stride]; | 564 | | | 565 | 464M | for (int i=0;i<4;i++) { | 566 | 371M | available[-y+i-1] = availableN; | 567 | 371M | out_border[-y+i-1] = image[xB-1 + (yB+y-i)*stride]; | 568 | 371M | } | 569 | | | 570 | 92.9M | nAvail+=4; | 571 | 92.9M | } | 572 | 138M | } | 573 | | | 574 | | // copy pixel at top-left position | 575 | | | 576 | 56.7M | if (availableTopLeft) | 577 | 55.5M | { | 578 | 55.5M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB-1)*SubWidth )>>sps->Log2MinTrafoSize) + | 579 | 55.5M | (((yB-1)*SubHeight)>>sps->Log2MinTrafoSize) | 580 | 55.5M | * sps->PicWidthInTbsY ]; | 581 | | | 582 | 55.5M | bool availableN = NBlockAddr <= currBlockAddr; | 583 | | | 584 | 55.5M | if (pps->constrained_intra_pred_flag) { | 585 | 2.83M | if (img->get_pred_mode((xB-1)*SubWidth,(yB-1)*SubHeight)!=MODE_INTRA) { | 586 | 8.95k | availableN = false; | 587 | 8.95k | } | 588 | 2.83M | } | 589 | | | 590 | 55.5M | if (availableN) { | 591 | 55.5M | if (!nAvail) firstValue = image[xB-1 + (yB-1)*stride]; | 592 | | | 593 | 55.5M | out_border[0] = image[xB-1 + (yB-1)*stride]; | 594 | 55.5M | available[0] = availableN; | 595 | 55.5M | nAvail++; | 596 | 55.5M | } | 597 | 55.5M | } | 598 | | | 599 | | // copy pixels at top row | 600 | | | 601 | 198M | for (int x=0 ; x<nRight ; x+=4) { | 602 | 141M | bool borderAvailable; | 603 | 141M | if (x<nT) borderAvailable=availableTop; | 604 | 70.4M | else borderAvailable=availableTopRight; | 605 | | | 606 | 141M | if (borderAvailable) | 607 | 138M | { | 608 | 138M | int NBlockAddr = pps->scan->MinTbAddrZS[ (((xB+x)*SubWidth )>>sps->Log2MinTrafoSize) + | 609 | 138M | (((yB-1)*SubHeight)>>sps->Log2MinTrafoSize) | 610 | 138M | * sps->PicWidthInTbsY ]; | 611 | | | 612 | 138M | bool availableN = NBlockAddr <= currBlockAddr; | 613 | | | 614 | 138M | if (pps->constrained_intra_pred_flag) { | 615 | 6.72M | if (img->get_pred_mode((xB+x)*SubWidth,(yB-1)*SubHeight)!=MODE_INTRA) { | 616 | 17.2k | availableN = false; | 617 | 17.2k | } | 618 | 6.72M | } | 619 | | | 620 | | | 621 | 138M | if (availableN) { | 622 | 115M | if (!nAvail) firstValue = image[xB+x + (yB-1)*stride]; | 623 | | | 624 | 577M | for (int i=0;i<4;i++) { | 625 | 461M | out_border[x+i+1] = image[xB+x+i + (yB-1)*stride]; | 626 | 461M | available[x+i+1] = availableN; | 627 | 461M | } | 628 | | | 629 | 115M | nAvail+=4; | 630 | 115M | } | 631 | 138M | } | 632 | 141M | } | 633 | 56.7M | } |
|
634 | | |
635 | | |
636 | | |
637 | | template <class pixel_t> |
638 | | void intra_border_computer<pixel_t>::reference_sample_substitution() |
639 | 74.5M | { |
640 | | // reference sample substitution |
641 | | |
642 | 74.5M | const int bit_depth = img->get_bit_depth(cIdx); |
643 | | |
644 | 74.5M | if (nAvail!=4*nT+1) { |
645 | 51.6M | if (nAvail==0) { |
646 | 35.4k | if (sizeof(pixel_t)==1) { |
647 | 22.0k | memset(out_border-2*nT, 1<<(bit_depth-1), 4*nT+1); |
648 | 22.0k | } |
649 | 13.4k | else { |
650 | 612k | for (int i = -2*nT; i <= 2*nT ; i++) { |
651 | 599k | out_border[i] = 1<<(bit_depth-1); |
652 | 599k | } |
653 | 13.4k | } |
654 | 35.4k | } |
655 | 51.6M | else { |
656 | 51.6M | if (!available[-2*nT]) { |
657 | 49.8M | out_border[-2*nT] = firstValue; |
658 | 49.8M | } |
659 | | |
660 | 1.10G | for (int i=-2*nT+1; i<=2*nT; i++) |
661 | 1.05G | if (!available[i]) { |
662 | 355M | out_border[i]=out_border[i-1]; |
663 | 355M | } |
664 | 51.6M | } |
665 | 51.6M | } |
666 | | |
667 | 74.5M | logtrace(LogIntraPred,"availableN: "); |
668 | 74.5M | print_border(available,nullptr,nT); |
669 | 74.5M | logtrace(LogIntraPred,"\n"); |
670 | | |
671 | 74.5M | logtrace(LogIntraPred,"output: "); |
672 | 74.5M | print_border(out_border,nullptr,nT); |
673 | 74.5M | logtrace(LogIntraPred,"\n"); |
674 | 74.5M | } intra_border_computer<unsigned short>::reference_sample_substitution() Line | Count | Source | 639 | 17.5M | { | 640 | | // reference sample substitution | 641 | | | 642 | 17.5M | const int bit_depth = img->get_bit_depth(cIdx); | 643 | | | 644 | 17.5M | if (nAvail!=4*nT+1) { | 645 | 12.2M | if (nAvail==0) { | 646 | 13.4k | if (sizeof(pixel_t)==1) { | 647 | 0 | memset(out_border-2*nT, 1<<(bit_depth-1), 4*nT+1); | 648 | 0 | } | 649 | 13.4k | else { | 650 | 612k | for (int i = -2*nT; i <= 2*nT ; i++) { | 651 | 599k | out_border[i] = 1<<(bit_depth-1); | 652 | 599k | } | 653 | 13.4k | } | 654 | 13.4k | } | 655 | 12.2M | else { | 656 | 12.2M | if (!available[-2*nT]) { | 657 | 11.6M | out_border[-2*nT] = firstValue; | 658 | 11.6M | } | 659 | | | 660 | 264M | for (int i=-2*nT+1; i<=2*nT; i++) | 661 | 252M | if (!available[i]) { | 662 | 86.0M | out_border[i]=out_border[i-1]; | 663 | 86.0M | } | 664 | 12.2M | } | 665 | 12.2M | } | 666 | | | 667 | 17.5M | logtrace(LogIntraPred,"availableN: "); | 668 | 17.5M | print_border(available,nullptr,nT); | 669 | 17.5M | logtrace(LogIntraPred,"\n"); | 670 | | | 671 | 17.5M | logtrace(LogIntraPred,"output: "); | 672 | 17.5M | print_border(out_border,nullptr,nT); | 673 | 17.5M | logtrace(LogIntraPred,"\n"); | 674 | 17.5M | } |
intra_border_computer<unsigned char>::reference_sample_substitution() Line | Count | Source | 639 | 57.0M | { | 640 | | // reference sample substitution | 641 | | | 642 | 57.0M | const int bit_depth = img->get_bit_depth(cIdx); | 643 | | | 644 | 57.0M | if (nAvail!=4*nT+1) { | 645 | 39.4M | if (nAvail==0) { | 646 | 22.0k | if (sizeof(pixel_t)==1) { | 647 | 22.0k | memset(out_border-2*nT, 1<<(bit_depth-1), 4*nT+1); | 648 | 22.0k | } | 649 | 0 | else { | 650 | 0 | for (int i = -2*nT; i <= 2*nT ; i++) { | 651 | 0 | out_border[i] = 1<<(bit_depth-1); | 652 | 0 | } | 653 | 0 | } | 654 | 22.0k | } | 655 | 39.3M | else { | 656 | 39.3M | if (!available[-2*nT]) { | 657 | 38.1M | out_border[-2*nT] = firstValue; | 658 | 38.1M | } | 659 | | | 660 | 841M | for (int i=-2*nT+1; i<=2*nT; i++) | 661 | 802M | if (!available[i]) { | 662 | 269M | out_border[i]=out_border[i-1]; | 663 | 269M | } | 664 | 39.3M | } | 665 | 39.4M | } | 666 | | | 667 | 57.0M | logtrace(LogIntraPred,"availableN: "); | 668 | 57.0M | print_border(available,nullptr,nT); | 669 | 57.0M | logtrace(LogIntraPred,"\n"); | 670 | | | 671 | 57.0M | logtrace(LogIntraPred,"output: "); | 672 | 57.0M | print_border(out_border,nullptr,nT); | 673 | 57.0M | logtrace(LogIntraPred,"\n"); | 674 | 57.0M | } |
|
675 | | |
676 | | |
677 | | #endif |