Coverage Report

Created: 2026-09-01 06:56

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/libde265/libde265/fallback-motion.cc
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
#include "fallback-motion.h"
22
#include "util.h"
23
24
#if defined(_MSC_VER) || defined(__MINGW32__)
25
# include <malloc.h>
26
#elif defined(HAVE_ALLOCA_H)
27
# include <alloca.h>
28
#endif
29
30
#include <assert.h>
31
32
33
void put_unweighted_pred_8_fallback(uint8_t *dst, ptrdiff_t dststride,
34
                                    const int16_t *src, ptrdiff_t srcstride,
35
                                    int width, int height)
36
0
{
37
0
  int offset8bit = 32;
38
0
  int shift8bit = 6;
39
40
0
  assert((width&1)==0);
41
42
0
  for (int y=0;y<height;y++) {
43
0
    const int16_t* in  = &src[y*srcstride];
44
0
    uint8_t* out = &dst[y*dststride];
45
46
0
    for (int x=0;x<width;x+=2) {
47
0
      out[0] = Clip1_8bit((in[0] + offset8bit)>>shift8bit);
48
0
      out[1] = Clip1_8bit((in[1] + offset8bit)>>shift8bit);
49
0
      out+=2; in+=2;
50
0
    }
51
0
  }
52
0
}
53
54
55
void put_weighted_pred_8_fallback(uint8_t *dst, ptrdiff_t dststride,
56
                                  const int16_t *src, ptrdiff_t srcstride,
57
                                  int width, int height,
58
                                  int w,int o,int log2WD)
59
1.31M
{
60
1.31M
  assert(log2WD>=1); // TODO
61
62
1.31M
  const int rnd = (1<<(log2WD-1));
63
64
8.80M
  for (int y=0;y<height;y++) {
65
7.48M
    const int16_t* in  = &src[y*srcstride];
66
7.48M
    uint8_t* out = &dst[y*dststride];
67
68
69.0M
    for (int x=0;x<width;x++) {
69
61.5M
      out[0] = Clip1_8bit(((in[0]*w + rnd)>>log2WD) + o);
70
61.5M
      out++; in++;
71
61.5M
    }
72
7.48M
  }
73
1.31M
}
74
75
void put_weighted_bipred_8_fallback(uint8_t *dst, ptrdiff_t dststride,
76
                                    const int16_t *src1, const int16_t *src2, ptrdiff_t srcstride,
77
                                    int width, int height,
78
                                    int w1,int o1, int w2,int o2, int log2WD)
79
289k
{
80
289k
  assert(log2WD>=1); // TODO
81
82
289k
  const int rnd = static_cast<int>(static_cast<unsigned int>(o1+o2+1) << log2WD);
83
84
2.91M
  for (int y=0;y<height;y++) {
85
2.62M
    const int16_t* in1 = &src1[y*srcstride];
86
2.62M
    const int16_t* in2 = &src2[y*srcstride];
87
2.62M
    uint8_t* out = &dst[y*dststride];
88
89
38.7M
    for (int x=0;x<width;x++) {
90
36.1M
      out[0] = Clip1_8bit((in1[0]*w1 + in2[0]*w2 + rnd)>>(log2WD+1));
91
36.1M
      out++; in1++; in2++;
92
36.1M
    }
93
2.62M
  }
94
289k
}
95
96
97
void put_weighted_pred_avg_8_fallback(uint8_t *dst, ptrdiff_t dststride,
98
                                      const int16_t *src1, const int16_t *src2,
99
                                      ptrdiff_t srcstride, int width,
100
                                      int height)
101
0
{
102
0
  int offset8bit = 64;
103
0
  int shift8bit = 7;
104
105
0
  assert((width&1)==0);
106
107
  // I had a special case for 8-pixel parallel, unrolled code,
108
  // but I did not see any speedup.
109
110
#if 0
111
  for (int y=0;y<height;y++) {
112
    int16_t* in1 = &src1[y*srcstride];
113
    int16_t* in2 = &src2[y*srcstride];
114
    uint8_t* out = &dst[y*dststride];
115
116
    for (int x=0;x<width;x++) {
117
      out[0] = Clip1_8bit((in1[0] + in2[0] + offset8bit)>>shift8bit);
118
      out++; in1++; in2++;
119
    }
120
  }
121
#endif
122
123
#if 0
124
  if ((width&7)==0) {
125
    for (int y=0;y<height;y++) {
126
      int16_t* in1 = &src1[y*srcstride];
127
      int16_t* in2 = &src2[y*srcstride];
128
      uint8_t* out = &dst[y*dststride];
129
130
      for (int x=0;x<width;x+=8) {
131
        out[0] = Clip1_8bit((in1[0] + in2[0] + offset8bit)>>shift8bit);
132
        out[1] = Clip1_8bit((in1[1] + in2[1] + offset8bit)>>shift8bit);
133
        out[2] = Clip1_8bit((in1[2] + in2[2] + offset8bit)>>shift8bit);
134
        out[3] = Clip1_8bit((in1[3] + in2[3] + offset8bit)>>shift8bit);
135
        out[4] = Clip1_8bit((in1[4] + in2[4] + offset8bit)>>shift8bit);
136
        out[5] = Clip1_8bit((in1[5] + in2[5] + offset8bit)>>shift8bit);
137
        out[6] = Clip1_8bit((in1[6] + in2[6] + offset8bit)>>shift8bit);
138
        out[7] = Clip1_8bit((in1[7] + in2[7] + offset8bit)>>shift8bit);
139
        out+=8; in1+=8; in2+=8;
140
      }
141
    }
142
  }
143
  else
144
#endif
145
0
    {
146
0
      for (int y=0;y<height;y++) {
147
0
        const int16_t* in1 = &src1[y*srcstride];
148
0
        const int16_t* in2 = &src2[y*srcstride];
149
0
        uint8_t* out = &dst[y*dststride];
150
151
0
        for (int x=0;x<width;x+=2) {
152
0
          out[0] = Clip1_8bit((in1[0] + in2[0] + offset8bit)>>shift8bit);
153
0
          out[1] = Clip1_8bit((in1[1] + in2[1] + offset8bit)>>shift8bit);
154
0
          out+=2; in1+=2; in2+=2;
155
0
        }
156
0
      }
157
0
    }
158
0
}
159
160
161
162
163
164
void put_unweighted_pred_16_fallback(uint16_t *dst, ptrdiff_t dststride,
165
                                     const int16_t *src, ptrdiff_t srcstride,
166
                                     int width, int height, int bit_depth)
167
476k
{
168
  // shift1 per HEVC v2 (10/2014) spec 8.5.3.3.4.2: Max(2, 14 - BitDepth).
169
  // The Max() was added with the Range Extensions in v2 to handle BitDepth up to 16;
170
  // the v1 (04/2013) formula was just (14 - BitDepth), valid only for BitDepth <= 14.
171
476k
  int shift1 = std::max(2, 14-bit_depth);
172
476k
  int offset1 = 1<<(shift1-1);
173
174
476k
  assert((width&1)==0);
175
176
4.11M
  for (int y=0;y<height;y++) {
177
3.64M
    const int16_t* in  = &src[y*srcstride];
178
3.64M
    uint16_t* out = &dst[y*dststride];
179
180
27.8M
    for (int x=0;x<width;x+=2) {
181
24.2M
      out[0] = Clip_BitDepth((in[0] + offset1)>>shift1, bit_depth);
182
24.2M
      out[1] = Clip_BitDepth((in[1] + offset1)>>shift1, bit_depth);
183
24.2M
      out+=2; in+=2;
184
24.2M
    }
185
3.64M
  }
186
476k
}
187
188
#include <stdlib.h>
189
190
void put_weighted_pred_16_fallback(uint16_t *dst, ptrdiff_t dststride,
191
                                   const int16_t *src, ptrdiff_t srcstride,
192
                                   int width, int height,
193
                                   int w,int o,int log2WD, int bit_depth)
194
87.8k
{
195
87.8k
  assert(log2WD>=1); // TODO
196
197
87.8k
  const int rnd = (1<<(log2WD-1));
198
199
752k
  for (int y=0;y<height;y++) {
200
664k
    const int16_t* in  = &src[y*srcstride];
201
664k
    uint16_t* out = &dst[y*dststride];
202
203
8.78M
    for (int x=0;x<width;x++) {
204
8.11M
      out[0] = Clip_BitDepth(((in[0]*w + rnd)>>log2WD) + o, bit_depth);
205
8.11M
      out++; in++;
206
8.11M
    }
207
664k
  }
208
87.8k
}
209
210
void put_weighted_bipred_16_fallback(uint16_t *dst, ptrdiff_t dststride,
211
                                     const int16_t *src1, const int16_t *src2, ptrdiff_t srcstride,
212
                                     int width, int height,
213
                                     int w1,int o1, int w2,int o2, int log2WD, int bit_depth)
214
3.97k
{
215
3.97k
  assert(log2WD>=1); // TODO
216
217
3.97k
  const int rnd = static_cast<int>(static_cast<unsigned int>(o1+o2+1) << log2WD);
218
219
54.4k
  for (int y=0;y<height;y++) {
220
50.4k
    const int16_t* in1 = &src1[y*srcstride];
221
50.4k
    const int16_t* in2 = &src2[y*srcstride];
222
50.4k
    uint16_t* out = &dst[y*dststride];
223
224
1.19M
    for (int x=0;x<width;x++) {
225
1.14M
      out[0] = Clip_BitDepth((in1[0]*w1 + in2[0]*w2 + rnd)>>(log2WD+1), bit_depth);
226
1.14M
      out++; in1++; in2++;
227
1.14M
    }
228
50.4k
  }
229
3.97k
}
230
231
232
void put_weighted_pred_avg_16_fallback(uint16_t *dst, ptrdiff_t dststride,
233
                                       const int16_t *src1, const int16_t *src2,
234
                                       ptrdiff_t srcstride, int width,
235
                                       int height, int bit_depth)
236
10.5k
{
237
  // shift2 per HEVC v2 (10/2014) spec 8.5.3.3.4.2: Max(3, 15 - BitDepth).
238
  // The Max() was added with the Range Extensions in v2 to handle BitDepth up to 16;
239
  // the v1 (04/2013) formula was just (15 - BitDepth), valid only for BitDepth <= 14.
240
10.5k
  int shift2 = std::max(3, 15-bit_depth);
241
10.5k
  int offset2 = 1<<(shift2-1);
242
243
10.5k
  assert((width&1)==0);
244
245
94.0k
  for (int y=0;y<height;y++) {
246
83.5k
    const int16_t* in1 = &src1[y*srcstride];
247
83.5k
    const int16_t* in2 = &src2[y*srcstride];
248
83.5k
    uint16_t* out = &dst[y*dststride];
249
250
512k
    for (int x=0;x<width;x+=2) {
251
428k
      out[0] = Clip_BitDepth((in1[0] + in2[0] + offset2)>>shift2, bit_depth);
252
428k
      out[1] = Clip_BitDepth((in1[1] + in2[1] + offset2)>>shift2, bit_depth);
253
428k
      out+=2; in1+=2; in2+=2;
254
428k
    }
255
83.5k
  }
256
10.5k
}
257
258
259
260
261
262
void put_epel_8_fallback(int16_t *out, ptrdiff_t out_stride,
263
                         const uint8_t *src, ptrdiff_t src_stride,
264
                         int width, int height,
265
                         int mx, int my, int16_t* mcbuffer)
266
0
{
267
0
  int shift3 = 6;
268
269
0
  for (int y=0;y<height;y++) {
270
0
    int16_t* o = &out[y*out_stride];
271
0
    const uint8_t* i = &src[y*src_stride];
272
273
0
    for (int x=0;x<width;x++) {
274
0
      *o = *i << shift3;
275
0
      o++;
276
0
      i++;
277
0
    }
278
0
  }
279
0
}
280
281
282
void put_epel_16_fallback(int16_t *out, ptrdiff_t out_stride,
283
                          const uint16_t *src, ptrdiff_t src_stride,
284
                          int width, int height,
285
                          int mx, int my, int16_t* mcbuffer, int bit_depth)
286
117k
{
287
  // shift3 per HEVC v2 (10/2014) spec 8.5.3.3.3.3 (chroma): Max(2, 14 - BitDepth).
288
  // The Max() was added with the Range Extensions in v2 to handle BitDepth up to 16;
289
  // the v1 (04/2013) formula was just (14 - BitDepth), valid only for BitDepth <= 14.
290
117k
  int shift3 = std::max(2, 14 - bit_depth);
291
292
746k
  for (int y=0;y<height;y++) {
293
629k
    int16_t* o = &out[y*out_stride];
294
629k
    const uint16_t* i = &src[y*src_stride];
295
296
5.96M
    for (int x=0;x<width;x++) {
297
5.33M
      *o = *i << shift3;
298
5.33M
      o++;
299
5.33M
      i++;
300
5.33M
    }
301
629k
  }
302
117k
}
303
304
305
template <class pixel_t>
306
void put_epel_hv_fallback(int16_t *dst, ptrdiff_t dst_stride,
307
                          const pixel_t *src, ptrdiff_t src_stride,
308
                          int nPbWC, int nPbHC,
309
                          int xFracC, int yFracC, int16_t* mcbuffer, int bit_depth)
310
144k
{
311
144k
  const int shift1 = bit_depth-8;
312
144k
  const int shift2 = 6;
313
  //const int shift3 = 6;
314
315
144k
  int extra_left = 1;
316
144k
  int extra_top  = 1;
317
  //  int extra_right = 2;
318
144k
  int extra_bottom= 2;
319
320
321
144k
  int nPbH_extra = extra_top  + nPbHC + extra_bottom;
322
323
144k
  int16_t* tmp2buf = (int16_t*)alloca( nPbWC      * nPbH_extra * sizeof(int16_t) );
324
325
  /*
326
  int nPbW_extra = extra_left + nPbWC + extra_right;
327
328
329
  printf("x,y FracC: %d/%d\n",xFracC,yFracC);
330
331
  printf("---IN---\n");
332
333
  for (int y=-extra_top;y<nPbHC+extra_bottom;y++) {
334
    uint8_t* p = &src[y*src_stride -extra_left];
335
336
    for (int x=-extra_left;x<nPbWC+extra_right;x++) {
337
      printf("%05d ",*p << 6);
338
      p++;
339
    }
340
    printf("\n");
341
  }
342
  */
343
344
345
  // H-filters
346
347
144k
  logtrace(LogMotion,"---H---\n");
348
  //printf("---H---(%d)\n",xFracC);
349
350
1.32M
  for (int y=-extra_top;y<nPbHC+extra_bottom;y++) {
351
1.17M
    const pixel_t* p = &src[y*src_stride - extra_left];
352
353
8.78M
    for (int x=0;x<nPbWC;x++) {
354
7.60M
      int16_t v;
355
7.60M
      switch (xFracC) {
356
1.39M
      case 0: v = p[1]; break;
357
1.51M
      case 1: v = (-2*p[0]+58*p[1]+10*p[2]-2*p[3])>>shift1; break;
358
829k
      case 2: v = (-4*p[0]+54*p[1]+16*p[2]-2*p[3])>>shift1; break;
359
556k
      case 3: v = (-6*p[0]+46*p[1]+28*p[2]-4*p[3])>>shift1; break;
360
607k
      case 4: v = (-4*p[0]+36*p[1]+36*p[2]-4*p[3])>>shift1; break;
361
654k
      case 5: v = (-4*p[0]+28*p[1]+46*p[2]-6*p[3])>>shift1; break;
362
749k
      case 6: v = (-2*p[0]+16*p[1]+54*p[2]-4*p[3])>>shift1; break;
363
0
      default:
364
1.29M
      case 7: v = (-2*p[0]+10*p[1]+58*p[2]-2*p[3])>>shift1; break;
365
7.60M
      }
366
367
      //printf("%d %d %d %d -> %d\n",p[0],p[1],p[2],p[3],v);
368
369
7.60M
      tmp2buf[y+extra_top + x*nPbH_extra] = v;
370
7.60M
      p++;
371
372
      //printf("%05d ",tmp2buf[y+extra_top + x*nPbH_extra]);
373
7.60M
    }
374
    //printf("\n");
375
1.17M
  }
376
377
  // V-filters
378
379
144k
  int vshift = (xFracC==0 ? shift1 : shift2);
380
381
854k
  for (int x=0;x<nPbWC;x++) {
382
710k
    int16_t* p = &tmp2buf[x*nPbH_extra];
383
384
6.18M
    for (int y=0;y<nPbHC;y++) {
385
5.47M
      int16_t v;
386
      //logtrace(LogMotion,"%x %x %x  %x  %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6]);
387
388
5.47M
      switch (yFracC) {
389
829k
      case 0: v = p[1]; break;
390
646k
      case 1: v = (-2*p[0]+58*p[1]+10*p[2]-2*p[3])>>vshift; break;
391
917k
      case 2: v = (-4*p[0]+54*p[1]+16*p[2]-2*p[3])>>vshift; break;
392
352k
      case 3: v = (-6*p[0]+46*p[1]+28*p[2]-4*p[3])>>vshift; break;
393
633k
      case 4: v = (-4*p[0]+36*p[1]+36*p[2]-4*p[3])>>vshift; break;
394
488k
      case 5: v = (-4*p[0]+28*p[1]+46*p[2]-6*p[3])>>vshift; break;
395
795k
      case 6: v = (-2*p[0]+16*p[1]+54*p[2]-4*p[3])>>vshift; break;
396
0
      default:
397
812k
      case 7: v = (-2*p[0]+10*p[1]+58*p[2]-2*p[3])>>vshift; break;
398
5.47M
      }
399
400
5.47M
      dst[x + y*dst_stride] = v;
401
5.47M
      p++;
402
5.47M
    }
403
404
710k
  }
405
406
  /*
407
  printf("---V---\n");
408
  for (int y=0;y<nPbHC;y++) {
409
    for (int x=0;x<nPbWC;x++) {
410
      printf("%05d ",dst[x+y*dst_stride]);
411
    }
412
    printf("\n");
413
  }
414
  */
415
144k
}
Unexecuted instantiation: void put_epel_hv_fallback<unsigned char>(short*, long, unsigned char const*, long, int, int, int, int, short*, int)
void put_epel_hv_fallback<unsigned short>(short*, long, unsigned short const*, long, int, int, int, int, short*, int)
Line
Count
Source
310
144k
{
311
144k
  const int shift1 = bit_depth-8;
312
144k
  const int shift2 = 6;
313
  //const int shift3 = 6;
314
315
144k
  int extra_left = 1;
316
144k
  int extra_top  = 1;
317
  //  int extra_right = 2;
318
144k
  int extra_bottom= 2;
319
320
321
144k
  int nPbH_extra = extra_top  + nPbHC + extra_bottom;
322
323
144k
  int16_t* tmp2buf = (int16_t*)alloca( nPbWC      * nPbH_extra * sizeof(int16_t) );
324
325
  /*
326
  int nPbW_extra = extra_left + nPbWC + extra_right;
327
328
329
  printf("x,y FracC: %d/%d\n",xFracC,yFracC);
330
331
  printf("---IN---\n");
332
333
  for (int y=-extra_top;y<nPbHC+extra_bottom;y++) {
334
    uint8_t* p = &src[y*src_stride -extra_left];
335
336
    for (int x=-extra_left;x<nPbWC+extra_right;x++) {
337
      printf("%05d ",*p << 6);
338
      p++;
339
    }
340
    printf("\n");
341
  }
342
  */
343
344
345
  // H-filters
346
347
144k
  logtrace(LogMotion,"---H---\n");
348
  //printf("---H---(%d)\n",xFracC);
349
350
1.32M
  for (int y=-extra_top;y<nPbHC+extra_bottom;y++) {
351
1.17M
    const pixel_t* p = &src[y*src_stride - extra_left];
352
353
8.78M
    for (int x=0;x<nPbWC;x++) {
354
7.60M
      int16_t v;
355
7.60M
      switch (xFracC) {
356
1.39M
      case 0: v = p[1]; break;
357
1.51M
      case 1: v = (-2*p[0]+58*p[1]+10*p[2]-2*p[3])>>shift1; break;
358
829k
      case 2: v = (-4*p[0]+54*p[1]+16*p[2]-2*p[3])>>shift1; break;
359
556k
      case 3: v = (-6*p[0]+46*p[1]+28*p[2]-4*p[3])>>shift1; break;
360
607k
      case 4: v = (-4*p[0]+36*p[1]+36*p[2]-4*p[3])>>shift1; break;
361
654k
      case 5: v = (-4*p[0]+28*p[1]+46*p[2]-6*p[3])>>shift1; break;
362
749k
      case 6: v = (-2*p[0]+16*p[1]+54*p[2]-4*p[3])>>shift1; break;
363
0
      default:
364
1.29M
      case 7: v = (-2*p[0]+10*p[1]+58*p[2]-2*p[3])>>shift1; break;
365
7.60M
      }
366
367
      //printf("%d %d %d %d -> %d\n",p[0],p[1],p[2],p[3],v);
368
369
7.60M
      tmp2buf[y+extra_top + x*nPbH_extra] = v;
370
7.60M
      p++;
371
372
      //printf("%05d ",tmp2buf[y+extra_top + x*nPbH_extra]);
373
7.60M
    }
374
    //printf("\n");
375
1.17M
  }
376
377
  // V-filters
378
379
144k
  int vshift = (xFracC==0 ? shift1 : shift2);
380
381
854k
  for (int x=0;x<nPbWC;x++) {
382
710k
    int16_t* p = &tmp2buf[x*nPbH_extra];
383
384
6.18M
    for (int y=0;y<nPbHC;y++) {
385
5.47M
      int16_t v;
386
      //logtrace(LogMotion,"%x %x %x  %x  %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6]);
387
388
5.47M
      switch (yFracC) {
389
829k
      case 0: v = p[1]; break;
390
646k
      case 1: v = (-2*p[0]+58*p[1]+10*p[2]-2*p[3])>>vshift; break;
391
917k
      case 2: v = (-4*p[0]+54*p[1]+16*p[2]-2*p[3])>>vshift; break;
392
352k
      case 3: v = (-6*p[0]+46*p[1]+28*p[2]-4*p[3])>>vshift; break;
393
633k
      case 4: v = (-4*p[0]+36*p[1]+36*p[2]-4*p[3])>>vshift; break;
394
488k
      case 5: v = (-4*p[0]+28*p[1]+46*p[2]-6*p[3])>>vshift; break;
395
795k
      case 6: v = (-2*p[0]+16*p[1]+54*p[2]-4*p[3])>>vshift; break;
396
0
      default:
397
812k
      case 7: v = (-2*p[0]+10*p[1]+58*p[2]-2*p[3])>>vshift; break;
398
5.47M
      }
399
400
5.47M
      dst[x + y*dst_stride] = v;
401
5.47M
      p++;
402
5.47M
    }
403
404
710k
  }
405
406
  /*
407
  printf("---V---\n");
408
  for (int y=0;y<nPbHC;y++) {
409
    for (int x=0;x<nPbWC;x++) {
410
      printf("%05d ",dst[x+y*dst_stride]);
411
    }
412
    printf("\n");
413
  }
414
  */
415
144k
}
416
417
418
template
419
void put_epel_hv_fallback<uint8_t>(int16_t *dst, ptrdiff_t dst_stride,
420
                                   const uint8_t *src, ptrdiff_t src_stride,
421
                                   int nPbWC, int nPbHC,
422
                                   int xFracC, int yFracC, int16_t* mcbuffer, int bit_depth);
423
template
424
void put_epel_hv_fallback<uint16_t>(int16_t *dst, ptrdiff_t dst_stride,
425
                                    const uint16_t *src, ptrdiff_t src_stride,
426
                                    int nPbWC, int nPbHC,
427
                                    int xFracC, int yFracC, int16_t* mcbuffer, int bit_depth);
428
429
430
431
void put_qpel_0_0_fallback(int16_t *out, ptrdiff_t out_stride,
432
                           const uint8_t *src, ptrdiff_t srcstride,
433
                           int nPbW, int nPbH, int16_t* mcbuffer)
434
0
{
435
  //const int shift1 = 0; // sps->BitDepth_Y-8;
436
0
  const int shift2 = 6;
437
438
  // straight copy
439
440
0
  for (int y=0;y<nPbH;y++) {
441
0
      const uint8_t* p = src + srcstride*y;
442
0
      int16_t* o = out + out_stride*y;
443
444
0
      for (int x=0;x<nPbW;x+=4) {
445
446
        // does not seem to be faster...
447
0
        int16_t o0,o1,o2,o3;
448
0
        o0 = p[0] << shift2;
449
0
        o1 = p[1] << shift2;
450
0
        o2 = p[2] << shift2;
451
0
        o3 = p[3] << shift2;
452
0
        o[0]=o0;
453
0
        o[1]=o1;
454
0
        o[2]=o2;
455
0
        o[3]=o3;
456
457
0
        o+=4;
458
0
        p+=4;
459
0
      }
460
0
  }
461
0
}
462
463
464
void put_qpel_0_0_fallback_16(int16_t *out, ptrdiff_t out_stride,
465
                              const uint16_t *src, ptrdiff_t srcstride,
466
                              int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth)
467
174k
{
468
  //const int shift1 = bit_depth-8;
469
  //const int shift2 = 6;
470
  // shift3 per HEVC v2 (10/2014) spec 8.5.3.3.3.2 (luma): Max(2, 14 - BitDepth).
471
  // The Max() was added with the Range Extensions in v2 to handle BitDepth up to 16;
472
  // the v1 (04/2013) formula was just (14 - BitDepth), valid only for BitDepth <= 14.
473
174k
  const int shift3 = std::max(2, 14-bit_depth);
474
475
  // straight copy
476
477
1.89M
  for (int y=0;y<nPbH;y++) {
478
1.71M
    const uint16_t* p = src + srcstride*y;
479
1.71M
    int16_t* o = out + out_stride*y;
480
481
30.2M
    for (int x=0;x<nPbW;x++) {
482
28.5M
      *o++ = *p++ << shift3;
483
28.5M
    }
484
1.71M
  }
485
174k
}
486
487
488
489
static int extra_before[4] = { 0,3,3,2 };
490
static int extra_after [4] = { 0,3,4,4 };
491
492
template <class pixel_t>
493
void put_qpel_fallback(int16_t *out, ptrdiff_t out_stride,
494
                       const pixel_t *src, ptrdiff_t srcstride,
495
                       int nPbW, int nPbH, int16_t* mcbuffer,
496
                       int xFracL, int yFracL, int bit_depth)
497
140k
{
498
140k
  int extra_left   = extra_before[xFracL];
499
  //int extra_right  = extra_after [xFracL];
500
140k
  int extra_top    = extra_before[yFracL];
501
140k
  int extra_bottom = extra_after [yFracL];
502
503
  //int nPbW_extra = extra_left + nPbW + extra_right;
504
140k
  int nPbH_extra = extra_top  + nPbH + extra_bottom;
505
506
140k
  const int shift1 = bit_depth-8;
507
140k
  const int shift2 = 6;
508
509
510
  // H-filters
511
512
140k
  switch (xFracL) {
513
27.1k
  case 0:
514
459k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
515
432k
      const pixel_t* p = src + srcstride*y - extra_left;
516
432k
      int16_t* o = &mcbuffer[y+extra_top];
517
518
6.54M
      for (int x=0;x<nPbW;x++) {
519
6.11M
        *o = *p;
520
6.11M
        o += nPbH_extra;
521
6.11M
        p++;
522
6.11M
      }
523
432k
    }
524
27.1k
    break;
525
42.9k
  case 1:
526
673k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
527
630k
      const pixel_t* p = src + srcstride*y - extra_left;
528
630k
      int16_t* o = &mcbuffer[y+extra_top];
529
530
9.16M
      for (int x=0;x<nPbW;x++) {
531
8.53M
        *o = (-p[0]+4*p[1]-10*p[2]+58*p[3]+17*p[4] -5*p[5]  +p[6])>>shift1;
532
8.53M
        o += nPbH_extra;
533
8.53M
        p++;
534
8.53M
      }
535
630k
    }
536
42.9k
    break;
537
34.3k
  case 2:
538
546k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
539
512k
      const pixel_t* p = src + srcstride*y - extra_left;
540
512k
      int16_t* o = &mcbuffer[y+extra_top];
541
542
6.65M
      for (int x=0;x<nPbW;x++) {
543
6.14M
        *o = (-p[0]+4*p[1]-11*p[2]+40*p[3]+40*p[4]-11*p[5]+4*p[6]-p[7])>>shift1;
544
6.14M
        o += nPbH_extra;
545
6.14M
        p++;
546
6.14M
      }
547
512k
    }
548
34.3k
    break;
549
36.5k
  case 3:
550
579k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
551
542k
      const pixel_t* p = src + srcstride*y - extra_left;
552
542k
      int16_t* o = &mcbuffer[y+extra_top];
553
554
7.34M
      for (int x=0;x<nPbW;x++) {
555
6.80M
        *o = ( p[0]-5*p[1]+17*p[2]+58*p[3]-10*p[4] +4*p[5]  -p[6])>>shift1;
556
6.80M
        o += nPbH_extra;
557
6.80M
        p++;
558
6.80M
      }
559
542k
    }
560
36.5k
    break;
561
140k
  }
562
563
564
140k
  logtrace(LogMotion,"---H---\n");
565
566
2.25M
  for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
567
29.7M
    for (int x=0;x<nPbW;x++) {
568
27.5M
      logtrace(LogMotion,"%04x ",mcbuffer[y+extra_top + x*nPbH_extra]);
569
27.5M
    }
570
2.11M
    logtrace(LogMotion,"\n");
571
2.11M
  }
572
573
  // V-filters
574
575
140k
  int vshift = (xFracL==0 ? shift1 : shift2);
576
577
140k
  switch (yFracL) {
578
21.8k
  case 0:
579
251k
    for (int x=0;x<nPbW;x++) {
580
229k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
581
229k
      int16_t* o = &out[x];
582
583
4.55M
      for (int y=0;y<nPbH;y++) {
584
4.32M
        *o = *p;
585
4.32M
        o+=out_stride;
586
4.32M
        p++;
587
4.32M
      }
588
229k
    }
589
21.8k
    break;
590
41.0k
  case 1:
591
433k
    for (int x=0;x<nPbW;x++) {
592
392k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
593
392k
      int16_t* o = &out[x];
594
595
5.74M
      for (int y=0;y<nPbH;y++) {
596
5.35M
        *o = (-p[0]+4*p[1]-10*p[2]+58*p[3]+17*p[4] -5*p[5]  +p[6])>>vshift;
597
5.35M
        o+=out_stride;
598
5.35M
        p++;
599
5.35M
      }
600
392k
    }
601
41.0k
    break;
602
37.5k
  case 2:
603
401k
    for (int x=0;x<nPbW;x++) {
604
364k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
605
364k
      int16_t* o = &out[x];
606
607
5.68M
      for (int y=0;y<nPbH;y++) {
608
5.32M
        *o = (-p[0]+4*p[1]-11*p[2]+40*p[3]+40*p[4]-11*p[5]+4*p[6]-p[7])>>vshift;
609
5.32M
        o+=out_stride;
610
5.32M
        p++;
611
5.32M
      }
612
364k
    }
613
37.5k
    break;
614
40.6k
  case 3:
615
420k
    for (int x=0;x<nPbW;x++) {
616
380k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
617
380k
      int16_t* o = &out[x];
618
619
5.78M
      for (int y=0;y<nPbH;y++) {
620
5.40M
        *o = ( p[0]-5*p[1]+17*p[2]+58*p[3]-10*p[4] +4*p[5]  -p[6])>>vshift;
621
5.40M
        o+=out_stride;
622
5.40M
        p++;
623
5.40M
      }
624
380k
    }
625
40.6k
    break;
626
140k
  }
627
628
629
140k
  logtrace(LogMotion,"---V---\n");
630
1.50M
  for (int y=0;y<nPbH;y++) {
631
21.7M
    for (int x=0;x<nPbW;x++) {
632
20.4M
      logtrace(LogMotion,"%04x ",out[x+y*out_stride]);
633
20.4M
    }
634
1.36M
    logtrace(LogMotion,"\n");
635
1.36M
  }
636
140k
}
Unexecuted instantiation: void put_qpel_fallback<unsigned char>(short*, long, unsigned char const*, long, int, int, short*, int, int, int)
void put_qpel_fallback<unsigned short>(short*, long, unsigned short const*, long, int, int, short*, int, int, int)
Line
Count
Source
497
140k
{
498
140k
  int extra_left   = extra_before[xFracL];
499
  //int extra_right  = extra_after [xFracL];
500
140k
  int extra_top    = extra_before[yFracL];
501
140k
  int extra_bottom = extra_after [yFracL];
502
503
  //int nPbW_extra = extra_left + nPbW + extra_right;
504
140k
  int nPbH_extra = extra_top  + nPbH + extra_bottom;
505
506
140k
  const int shift1 = bit_depth-8;
507
140k
  const int shift2 = 6;
508
509
510
  // H-filters
511
512
140k
  switch (xFracL) {
513
27.1k
  case 0:
514
459k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
515
432k
      const pixel_t* p = src + srcstride*y - extra_left;
516
432k
      int16_t* o = &mcbuffer[y+extra_top];
517
518
6.54M
      for (int x=0;x<nPbW;x++) {
519
6.11M
        *o = *p;
520
6.11M
        o += nPbH_extra;
521
6.11M
        p++;
522
6.11M
      }
523
432k
    }
524
27.1k
    break;
525
42.9k
  case 1:
526
673k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
527
630k
      const pixel_t* p = src + srcstride*y - extra_left;
528
630k
      int16_t* o = &mcbuffer[y+extra_top];
529
530
9.16M
      for (int x=0;x<nPbW;x++) {
531
8.53M
        *o = (-p[0]+4*p[1]-10*p[2]+58*p[3]+17*p[4] -5*p[5]  +p[6])>>shift1;
532
8.53M
        o += nPbH_extra;
533
8.53M
        p++;
534
8.53M
      }
535
630k
    }
536
42.9k
    break;
537
34.3k
  case 2:
538
546k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
539
512k
      const pixel_t* p = src + srcstride*y - extra_left;
540
512k
      int16_t* o = &mcbuffer[y+extra_top];
541
542
6.65M
      for (int x=0;x<nPbW;x++) {
543
6.14M
        *o = (-p[0]+4*p[1]-11*p[2]+40*p[3]+40*p[4]-11*p[5]+4*p[6]-p[7])>>shift1;
544
6.14M
        o += nPbH_extra;
545
6.14M
        p++;
546
6.14M
      }
547
512k
    }
548
34.3k
    break;
549
36.5k
  case 3:
550
579k
    for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
551
542k
      const pixel_t* p = src + srcstride*y - extra_left;
552
542k
      int16_t* o = &mcbuffer[y+extra_top];
553
554
7.34M
      for (int x=0;x<nPbW;x++) {
555
6.80M
        *o = ( p[0]-5*p[1]+17*p[2]+58*p[3]-10*p[4] +4*p[5]  -p[6])>>shift1;
556
6.80M
        o += nPbH_extra;
557
6.80M
        p++;
558
6.80M
      }
559
542k
    }
560
36.5k
    break;
561
140k
  }
562
563
564
140k
  logtrace(LogMotion,"---H---\n");
565
566
2.25M
  for (int y=-extra_top;y<nPbH+extra_bottom;y++) {
567
29.7M
    for (int x=0;x<nPbW;x++) {
568
27.5M
      logtrace(LogMotion,"%04x ",mcbuffer[y+extra_top + x*nPbH_extra]);
569
27.5M
    }
570
2.11M
    logtrace(LogMotion,"\n");
571
2.11M
  }
572
573
  // V-filters
574
575
140k
  int vshift = (xFracL==0 ? shift1 : shift2);
576
577
140k
  switch (yFracL) {
578
21.8k
  case 0:
579
251k
    for (int x=0;x<nPbW;x++) {
580
229k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
581
229k
      int16_t* o = &out[x];
582
583
4.55M
      for (int y=0;y<nPbH;y++) {
584
4.32M
        *o = *p;
585
4.32M
        o+=out_stride;
586
4.32M
        p++;
587
4.32M
      }
588
229k
    }
589
21.8k
    break;
590
41.0k
  case 1:
591
433k
    for (int x=0;x<nPbW;x++) {
592
392k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
593
392k
      int16_t* o = &out[x];
594
595
5.74M
      for (int y=0;y<nPbH;y++) {
596
5.35M
        *o = (-p[0]+4*p[1]-10*p[2]+58*p[3]+17*p[4] -5*p[5]  +p[6])>>vshift;
597
5.35M
        o+=out_stride;
598
5.35M
        p++;
599
5.35M
      }
600
392k
    }
601
41.0k
    break;
602
37.5k
  case 2:
603
401k
    for (int x=0;x<nPbW;x++) {
604
364k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
605
364k
      int16_t* o = &out[x];
606
607
5.68M
      for (int y=0;y<nPbH;y++) {
608
5.32M
        *o = (-p[0]+4*p[1]-11*p[2]+40*p[3]+40*p[4]-11*p[5]+4*p[6]-p[7])>>vshift;
609
5.32M
        o+=out_stride;
610
5.32M
        p++;
611
5.32M
      }
612
364k
    }
613
37.5k
    break;
614
40.6k
  case 3:
615
420k
    for (int x=0;x<nPbW;x++) {
616
380k
      const int16_t* p = &mcbuffer[x*nPbH_extra];
617
380k
      int16_t* o = &out[x];
618
619
5.78M
      for (int y=0;y<nPbH;y++) {
620
5.40M
        *o = ( p[0]-5*p[1]+17*p[2]+58*p[3]-10*p[4] +4*p[5]  -p[6])>>vshift;
621
5.40M
        o+=out_stride;
622
5.40M
        p++;
623
5.40M
      }
624
380k
    }
625
40.6k
    break;
626
140k
  }
627
628
629
140k
  logtrace(LogMotion,"---V---\n");
630
1.50M
  for (int y=0;y<nPbH;y++) {
631
21.7M
    for (int x=0;x<nPbW;x++) {
632
20.4M
      logtrace(LogMotion,"%04x ",out[x+y*out_stride]);
633
20.4M
    }
634
1.36M
    logtrace(LogMotion,"\n");
635
1.36M
  }
636
140k
}
637
638
639
640
#define QPEL(x,y) void put_qpel_ ## x ## _ ## y ## _fallback(int16_t *out, ptrdiff_t out_stride,    \
641
                                                             const uint8_t *src, ptrdiff_t srcstride, \
642
                                                             int nPbW, int nPbH, int16_t* mcbuffer) \
643
0
  { put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, 8 ); }
Unexecuted instantiation: put_qpel_0_1_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_0_2_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_0_3_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_1_0_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_1_1_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_1_2_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_1_3_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_2_0_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_2_1_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_2_2_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_2_3_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_3_0_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_3_1_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_3_2_fallback(short*, long, unsigned char const*, long, int, int, short*)
Unexecuted instantiation: put_qpel_3_3_fallback(short*, long, unsigned char const*, long, int, int, short*)
644
645
646
#define QPEL16(x,y) void put_qpel_ ## x ## _ ## y ## _fallback_16(int16_t *out, ptrdiff_t out_stride,    \
647
                                                                  const uint16_t *src, ptrdiff_t srcstride, \
648
140k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
140k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_0_1_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
9.07k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
9.07k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_0_2_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
7.99k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
7.99k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_0_3_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
10.1k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
10.1k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_1_0_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
10.6k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
10.6k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_1_1_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
18.2k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
18.2k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_1_2_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
4.22k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
4.22k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_1_3_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
9.85k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
9.85k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_2_0_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
5.84k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
5.84k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_2_1_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
5.76k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
5.76k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_2_2_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
18.6k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
18.6k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_2_3_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
4.00k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
4.00k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_3_0_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
5.34k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
5.34k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_3_1_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
7.99k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
7.99k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_3_2_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
6.61k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
6.61k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
put_qpel_3_3_fallback_16(short*, long, unsigned short const*, long, int, int, short*, int)
Line
Count
Source
648
16.6k
                                                                  int nPbW, int nPbH, int16_t* mcbuffer, int bit_depth) \
649
16.6k
{ put_qpel_fallback(out,out_stride, src,srcstride, nPbW,nPbH,mcbuffer,x,y, bit_depth ); }
650
651
/*     */ QPEL(0,1) QPEL(0,2) QPEL(0,3)
652
QPEL(1,0) QPEL(1,1) QPEL(1,2) QPEL(1,3)
653
QPEL(2,0) QPEL(2,1) QPEL(2,2) QPEL(2,3)
654
QPEL(3,0) QPEL(3,1) QPEL(3,2) QPEL(3,3)
655
656
/*       */ QPEL16(0,1) QPEL16(0,2) QPEL16(0,3)
657
QPEL16(1,0) QPEL16(1,1) QPEL16(1,2) QPEL16(1,3)
658
QPEL16(2,0) QPEL16(2,1) QPEL16(2,2) QPEL16(2,3)
659
QPEL16(3,0) QPEL16(3,1) QPEL16(3,2) QPEL16(3,3)