FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hevcpred_template.c
Go to the documentation of this file.
1 /*
2  * HEVC video decoder
3  *
4  * Copyright (C) 2012 - 2013 Guillaume Martres
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include "libavutil/pixdesc.h"
24 
25 #include "bit_depth_template.c"
26 #include "hevcpred.h"
27 
28 #define POS(x, y) src[(x) + stride * (y)]
29 
30 static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int c_idx)
31 {
32 #define PU(x) \
33  ((x) >> s->sps->log2_min_pu_size)
34 #define MVF(x, y) \
35  (s->ref->tab_mvf[(x) + (y) * min_pu_width])
36 #define MVF_PU(x, y) \
37  MVF(PU(x0 + ((x) << hshift)), PU(y0 + ((y) << vshift)))
38 #define IS_INTRA(x, y) \
39  MVF_PU(x, y).is_intra
40 #define MIN_TB_ADDR_ZS(x, y) \
41  s->pps->min_tb_addr_zs[(y) * s->sps->min_tb_width + (x)]
42 #define EXTEND_LEFT(ptr, start, length) \
43  for (i = (start); i > (start) - (length); i--) \
44  ptr[i - 1] = ptr[i]
45 #define EXTEND_RIGHT(ptr, start, length) \
46  for (i = (start); i < (start) + (length); i++) \
47  ptr[i] = ptr[i - 1]
48 #define EXTEND_UP(ptr, start, length) EXTEND_LEFT(ptr, start, length)
49 #define EXTEND_DOWN(ptr, start, length) EXTEND_RIGHT(ptr, start, length)
50 #define EXTEND_LEFT_CIP(ptr, start, length) \
51  for (i = (start); i > (start) - (length); i--) \
52  if (!IS_INTRA(i - 1, -1)) \
53  ptr[i - 1] = ptr[i]
54 #define EXTEND_RIGHT_CIP(ptr, start, length) \
55  for (i = (start); i < (start) + (length); i++) \
56  if (!IS_INTRA(i, -1)) \
57  ptr[i] = ptr[i - 1]
58 #define EXTEND_UP_CIP(ptr, start, length) \
59  for (i = (start); i > (start) - (length); i--) \
60  if (!IS_INTRA(-1, i - 1)) \
61  ptr[i - 1] = ptr[i]
62 #define EXTEND_UP_CIP_0(ptr, start, length) \
63  for (i = (start); i > (start) - (length); i--) \
64  ptr[i - 1] = ptr[i]
65 #define EXTEND_DOWN_CIP(ptr, start, length) \
66  for (i = (start); i < (start) + (length); i++) \
67  if (!IS_INTRA(-1, i)) \
68  ptr[i] = ptr[i - 1]
69  HEVCLocalContext *lc = s->HEVClc;
70  int i;
71  int hshift = s->sps->hshift[c_idx];
72  int vshift = s->sps->vshift[c_idx];
73  int size = (1 << log2_size);
74  int size_in_luma = size << hshift;
75  int size_in_tbs = size_in_luma >> s->sps->log2_min_tb_size;
76  int x = x0 >> hshift;
77  int y = y0 >> vshift;
78  int x_tb = x0 >> s->sps->log2_min_tb_size;
79  int y_tb = y0 >> s->sps->log2_min_tb_size;
80  int cur_tb_addr = MIN_TB_ADDR_ZS(x_tb, y_tb);
81 
82  ptrdiff_t stride = s->frame->linesize[c_idx] / sizeof(pixel);
83  pixel *src = (pixel*)s->frame->data[c_idx] + x + y * stride;
84 
85  int min_pu_width = s->sps->min_pu_width;
86 
87  enum IntraPredMode mode = c_idx ? lc->pu.intra_pred_mode_c :
89 
90  pixel left_array[2 * MAX_TB_SIZE + 1];
91  pixel filtered_left_array[2 * MAX_TB_SIZE + 1];
92  pixel top_array[2 * MAX_TB_SIZE + 1];
93  pixel filtered_top_array[2 * MAX_TB_SIZE + 1];
94 
95  pixel *left = left_array + 1;
96  pixel *top = top_array + 1;
97  pixel *filtered_left = filtered_left_array + 1;
98  pixel *filtered_top = filtered_top_array + 1;
99 
100  int cand_bottom_left = lc->na.cand_bottom_left && cur_tb_addr > MIN_TB_ADDR_ZS(x_tb - 1, y_tb + size_in_tbs);
101  int cand_left = lc->na.cand_left;
102  int cand_up_left = lc->na.cand_up_left;
103  int cand_up = lc->na.cand_up;
104  int cand_up_right = lc->na.cand_up_right && cur_tb_addr > MIN_TB_ADDR_ZS(x_tb + size_in_tbs, y_tb - 1);
105 
106  int bottom_left_size = (FFMIN(y0 + 2 * size_in_luma, s->sps->height) -
107  (y0 + size_in_luma)) >> vshift;
108  int top_right_size = (FFMIN(x0 + 2 * size_in_luma, s->sps->width) -
109  (x0 + size_in_luma)) >> hshift;
110 
111  if (s->pps->constrained_intra_pred_flag == 1) {
112  int size_in_luma_pu = PU(size_in_luma);
113  int on_pu_edge_x = !(x0 & ((1 << s->sps->log2_min_pu_size) - 1));
114  int on_pu_edge_y = !(y0 & ((1 << s->sps->log2_min_pu_size) - 1));
115  if (!size_in_luma_pu)
116  size_in_luma_pu++;
117  if (cand_bottom_left == 1 && on_pu_edge_x) {
118  int x_left_pu = PU(x0 - 1);
119  int y_bottom_pu = PU(y0 + size_in_luma);
120  int max = FFMIN(size_in_luma_pu, s->sps->min_pu_height - y_bottom_pu);
121  cand_bottom_left = 0;
122  for (i = 0; i < max; i++)
123  cand_bottom_left |= MVF(x_left_pu, y_bottom_pu + i).is_intra;
124  }
125  if (cand_left == 1 && on_pu_edge_x) {
126  int x_left_pu = PU(x0 - 1);
127  int y_left_pu = PU(y0);
128  int max = FFMIN(size_in_luma_pu, s->sps->min_pu_height - y_left_pu);
129  cand_left = 0;
130  for (i = 0; i < max; i++)
131  cand_left |= MVF(x_left_pu, y_left_pu + i).is_intra;
132  }
133  if (cand_up_left == 1) {
134  int x_left_pu = PU(x0 - 1);
135  int y_top_pu = PU(y0 - 1);
136  cand_up_left = MVF(x_left_pu, y_top_pu).is_intra;
137  }
138  if (cand_up == 1 && on_pu_edge_y) {
139  int x_top_pu = PU(x0);
140  int y_top_pu = PU(y0 - 1);
141  int max = FFMIN(size_in_luma_pu, s->sps->min_pu_width - x_top_pu);
142  cand_up = 0;
143  for (i = 0; i < max; i++)
144  cand_up |= MVF(x_top_pu + i, y_top_pu).is_intra;
145  }
146  if (cand_up_right == 1 && on_pu_edge_y) {
147  int y_top_pu = PU(y0 - 1);
148  int x_right_pu = PU(x0 + size_in_luma);
149  int max = FFMIN(size_in_luma_pu, s->sps->min_pu_width - x_right_pu);
150  cand_up_right = 0;
151  for (i = 0; i < max; i++)
152  cand_up_right |= MVF(x_right_pu + i, y_top_pu).is_intra;
153  }
154  for (i = 0; i < 2 * MAX_TB_SIZE; i++) {
155  left[i] = 128;
156  top[i] = 128;
157  }
158  }
159  if (cand_bottom_left) {
160  for (i = size + bottom_left_size; i < (size << 1); i++)
161  if (IS_INTRA(-1, size + bottom_left_size - 1) ||
162  !s->pps->constrained_intra_pred_flag)
163  left[i] = POS(-1, size + bottom_left_size - 1);
164  for (i = size + bottom_left_size - 1; i >= size; i--)
165  if (IS_INTRA(-1, i) || !s->pps->constrained_intra_pred_flag)
166  left[i] = POS(-1, i);
167  }
168  if (cand_left)
169  for (i = size - 1; i >= 0; i--)
170  if (IS_INTRA(-1, i) || !s->pps->constrained_intra_pred_flag)
171  left[i] = POS(-1, i);
172  if (cand_up_left)
173  if (IS_INTRA(-1, -1) || !s->pps->constrained_intra_pred_flag) {
174  left[-1] = POS(-1, -1);
175  top[-1] = left[-1];
176  }
177  if (cand_up)
178  for (i = size - 1; i >= 0; i--)
179  if (IS_INTRA(i, -1) || !s->pps->constrained_intra_pred_flag)
180  top[i] = POS(i, -1);
181  if (cand_up_right) {
182  for (i = size + top_right_size; i < (size << 1); i++)
183  if (IS_INTRA(size + top_right_size - 1, -1) ||
184  !s->pps->constrained_intra_pred_flag)
185  top[i] = POS(size + top_right_size - 1, -1);
186  for (i = size + top_right_size - 1; i >= size; i--)
187  if (IS_INTRA(i, -1) || !s->pps->constrained_intra_pred_flag)
188  top[i] = POS(i, -1);
189  }
190 
191  if (s->pps->constrained_intra_pred_flag == 1) {
192  if (cand_bottom_left || cand_left || cand_up_left || cand_up || cand_up_right) {
193  int size_max_x = x0 + ((2 * size) << hshift) < s->sps->width ?
194  2 * size : (s->sps->width - x0) >> hshift;
195  int size_max_y = y0 + ((2 * size) << vshift) < s->sps->height ?
196  2 * size : (s->sps->height - y0) >> vshift;
197  int j = size + (cand_bottom_left? bottom_left_size: 0) -1;
198  if (!cand_up_right) {
199  size_max_x = x0 + ((size) << hshift) < s->sps->width ?
200  size : (s->sps->width - x0) >> hshift;
201  }
202  if (!cand_bottom_left) {
203  size_max_y = y0 + (( size) << vshift) < s->sps->height ?
204  size : (s->sps->height - y0) >> vshift;
205  }
206  if (cand_bottom_left || cand_left || cand_up_left) {
207  while (j > -1 && !IS_INTRA(-1, j))
208  j--;
209  if (!IS_INTRA(-1, j)) {
210  j = 0;
211  while (j < size_max_x && !IS_INTRA(j, -1))
212  j++;
213  EXTEND_LEFT_CIP(top, j, j + 1);
214  left[-1] = top[-1];
215  j = 0;
216  }
217  } else {
218  j = 0;
219  while (j < size_max_x && !IS_INTRA(j, -1))
220  j++;
221  if (j > 0)
222  if (x0 > 0) {
223  EXTEND_LEFT_CIP(top, j, j + 1);
224  } else {
225  EXTEND_LEFT_CIP(top, j, j);
226  top[-1] = top[0];
227  }
228  left[-1] = top[-1];
229  j = 0;
230  }
231  if (cand_bottom_left || cand_left) {
232  EXTEND_DOWN_CIP(left, j, size_max_y - j);
233  }
234  if (!cand_left) {
235  EXTEND_DOWN(left, 0, size);
236  }
237  if (!cand_bottom_left) {
238  EXTEND_DOWN(left, size, size);
239  }
240  if (x0 != 0 && y0 != 0) {
241  EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
242  } else if (x0 == 0) {
243  EXTEND_UP_CIP_0(left, size_max_y - 1, size_max_y);
244  } else {
245  EXTEND_UP_CIP(left, size_max_y - 1, size_max_y - 1);
246  }
247  top[-1] = left[-1];
248  if (y0 != 0) {
249  EXTEND_RIGHT_CIP(top, 0, size_max_x);
250  }
251  }
252  }
253  // Infer the unavailable samples
254  if (!cand_bottom_left) {
255  if (cand_left) {
256  EXTEND_DOWN(left, size, size);
257  } else if (cand_up_left) {
258  EXTEND_DOWN(left, 0, 2 * size);
259  cand_left = 1;
260  } else if (cand_up) {
261  left[-1] = top[0];
262  EXTEND_DOWN(left, 0, 2 * size);
263  cand_up_left = 1;
264  cand_left = 1;
265  } else if (cand_up_right) {
266  EXTEND_LEFT(top, size, size);
267  left[-1] = top[0];
268  EXTEND_DOWN(left, 0, 2 * size);
269  cand_up = 1;
270  cand_up_left = 1;
271  cand_left = 1;
272  } else { // No samples available
273  top[0] = left[-1] = (1 << (BIT_DEPTH - 1));
274  EXTEND_RIGHT(top, 1, 2 * size - 1);
275  EXTEND_DOWN(left, 0, 2 * size);
276  }
277  }
278 
279  if (!cand_left) {
280  EXTEND_UP(left, size, size);
281  }
282  if (!cand_up_left) {
283  left[-1] = left[0];
284  }
285  if (!cand_up) {
286  top[0] = left[-1];
287  EXTEND_RIGHT(top, 1, size - 1);
288  }
289  if (!cand_up_right) {
290  EXTEND_RIGHT(top, size, size);
291  }
292 
293  top[-1] = left[-1];
294 
295  // Filtering process
296  if (c_idx == 0 && mode != INTRA_DC && size != 4) {
297  int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
298  int min_dist_vert_hor = FFMIN(FFABS((int)(mode - 26U)),
299  FFABS((int)(mode - 10U)));
300  if (min_dist_vert_hor > intra_hor_ver_dist_thresh[log2_size - 3]) {
301  int threshold = 1 << (BIT_DEPTH - 5);
302  if (s->sps->sps_strong_intra_smoothing_enable_flag &&
303  log2_size == 5 &&
304  FFABS(top[-1] + top[63] - 2 * top[31]) < threshold &&
305  FFABS(left[-1] + left[63] - 2 * left[31]) < threshold) {
306  // We can't just overwrite values in top because it could be
307  // a pointer into src
308  filtered_top[-1] = top[-1];
309  filtered_top[63] = top[63];
310  for (i = 0; i < 63; i++)
311  filtered_top[i] = ((64 - (i + 1)) * top[-1] +
312  (i + 1) * top[63] + 32) >> 6;
313  for (i = 0; i < 63; i++)
314  left[i] = ((64 - (i + 1)) * left[-1] +
315  (i + 1) * left[63] + 32) >> 6;
316  top = filtered_top;
317  } else {
318  filtered_left[2 * size - 1] = left[2 * size - 1];
319  filtered_top[2 * size - 1] = top[2 * size - 1];
320  for (i = 2 * size - 2; i >= 0; i--)
321  filtered_left[i] = (left[i + 1] + 2 * left[i] +
322  left[i - 1] + 2) >> 2;
323  filtered_top[-1] =
324  filtered_left[-1] = (left[0] + 2 * left[-1] + top[0] + 2) >> 2;
325  for (i = 2 * size - 2; i >= 0; i--)
326  filtered_top[i] = (top[i + 1] + 2 * top[i] +
327  top[i - 1] + 2) >> 2;
328  left = filtered_left;
329  top = filtered_top;
330  }
331  }
332  }
333 
334  switch (mode) {
335  case INTRA_PLANAR:
336  s->hpc.pred_planar[log2_size - 2]((uint8_t *)src, (uint8_t *)top,
337  (uint8_t *)left, stride);
338  break;
339  case INTRA_DC:
340  s->hpc.pred_dc((uint8_t *)src, (uint8_t *)top,
341  (uint8_t *)left, stride, log2_size, c_idx);
342  break;
343  default:
344  s->hpc.pred_angular[log2_size - 2]((uint8_t *)src, (uint8_t *)top,
345  (uint8_t *)left, stride, c_idx,
346  mode);
347  break;
348  }
349 }
350 
351 static void FUNC(pred_planar_0)(uint8_t *_src, const uint8_t *_top,
352  const uint8_t *_left,
353  ptrdiff_t stride)
354 {
355  int x, y;
356  pixel *src = (pixel *)_src;
357  const pixel *top = (const pixel *)_top;
358  const pixel *left = (const pixel *)_left;
359  for (y = 0; y < 4; y++)
360  for (x = 0; x < 4; x++)
361  POS(x, y) = ((3 - x) * left[y] + (x + 1) * top[4] +
362  (3 - y) * top[x] + (y + 1) * left[4] + 4) >> 3;
363 }
364 
365 static void FUNC(pred_planar_1)(uint8_t *_src, const uint8_t *_top,
366  const uint8_t *_left, ptrdiff_t stride)
367 {
368  int x, y;
369  pixel *src = (pixel *)_src;
370  const pixel *top = (const pixel *)_top;
371  const pixel *left = (const pixel *)_left;
372  for (y = 0; y < 8; y++)
373  for (x = 0; x < 8; x++)
374  POS(x, y) = ((7 - x) * left[y] + (x + 1) * top[8] +
375  (7 - y) * top[x] + (y + 1) * left[8] + 8) >> 4;
376 }
377 
378 static void FUNC(pred_planar_2)(uint8_t *_src, const uint8_t *_top,
379  const uint8_t *_left, ptrdiff_t stride)
380 {
381  int x, y;
382  pixel *src = (pixel *)_src;
383  const pixel *top = (const pixel *)_top;
384  const pixel *left = (const pixel *)_left;
385  for (y = 0; y < 16; y++)
386  for (x = 0; x < 16; x++)
387  POS(x, y) = ((15 - x) * left[y] + (x + 1) * top[16] +
388  (15 - y) * top[x] + (y + 1) * left[16] + 16) >> 5;
389 }
390 
391 static void FUNC(pred_planar_3)(uint8_t *_src, const uint8_t *_top,
392  const uint8_t *_left, ptrdiff_t stride)
393 {
394  int x, y;
395  pixel *src = (pixel *)_src;
396  const pixel *top = (const pixel *)_top;
397  const pixel *left = (const pixel *)_left;
398  for (y = 0; y < 32; y++)
399  for (x = 0; x < 32; x++)
400  POS(x, y) = ((31 - x) * left[y] + (x + 1) * top[32] +
401  (31 - y) * top[x] + (y + 1) * left[32] + 32) >> 6;
402 }
403 
404 static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top,
405  const uint8_t *_left,
406  ptrdiff_t stride, int log2_size, int c_idx)
407 {
408  int i, j, x, y;
409  int size = (1 << log2_size);
410  pixel *src = (pixel *)_src;
411  const pixel *top = (const pixel *)_top;
412  const pixel *left = (const pixel *)_left;
413  int dc = size;
414  pixel4 a;
415  for (i = 0; i < size; i++)
416  dc += left[i] + top[i];
417 
418  dc >>= log2_size + 1;
419 
420  a = PIXEL_SPLAT_X4(dc);
421 
422  for (i = 0; i < size; i++)
423  for (j = 0; j < size / 4; j++)
424  AV_WN4PA(&POS(j * 4, i), a);
425 
426  if (c_idx == 0 && size < 32) {
427  POS(0, 0) = (left[0] + 2 * dc + top[0] + 2) >> 2;
428  for (x = 1; x < size; x++)
429  POS(x, 0) = (top[x] + 3 * dc + 2) >> 2;
430  for (y = 1; y < size; y++)
431  POS(0, y) = (left[y] + 3 * dc + 2) >> 2;
432  }
433 }
434 
436  const uint8_t *_top,
437  const uint8_t *_left,
438  ptrdiff_t stride, int c_idx,
439  int mode, int size)
440 {
441  int x, y;
442  pixel *src = (pixel *)_src;
443  const pixel *top = (const pixel *)_top;
444  const pixel *left = (const pixel *)_left;
445 
446  static const int intra_pred_angle[] = {
447  32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32,
448  -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32
449  };
450  static const int inv_angle[] = {
451  -4096, -1638, -910, -630, -482, -390, -315, -256, -315, -390, -482,
452  -630, -910, -1638, -4096
453  };
454 
455  int angle = intra_pred_angle[mode - 2];
456  pixel ref_array[3 * MAX_TB_SIZE + 1];
457  pixel *ref_tmp = ref_array + size;
458  const pixel *ref;
459  int last = (size * angle) >> 5;
460 
461  if (mode >= 18) {
462  ref = top - 1;
463  if (angle < 0 && last < -1) {
464  for (x = 0; x <= size; x++)
465  ref_tmp[x] = top[x - 1];
466  for (x = last; x <= -1; x++)
467  ref_tmp[x] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)];
468  ref = ref_tmp;
469  }
470 
471  for (y = 0; y < size; y++) {
472  int idx = ((y + 1) * angle) >> 5;
473  int fact = ((y + 1) * angle) & 31;
474  if (fact) {
475  for (x = 0; x < size; x++) {
476  POS(x, y) = ((32 - fact) * ref[x + idx + 1] +
477  fact * ref[x + idx + 2] + 16) >> 5;
478  }
479  } else {
480  for (x = 0; x < size; x++)
481  POS(x, y) = ref[x + idx + 1];
482  }
483  }
484  if (mode == 26 && c_idx == 0 && size < 32) {
485  for (y = 0; y < size; y++)
486  POS(0, y) = av_clip_pixel(top[0] + ((left[y] - left[-1]) >> 1));
487  }
488  } else {
489  ref = left - 1;
490  if (angle < 0 && last < -1) {
491  for (x = 0; x <= size; x++)
492  ref_tmp[x] = left[x - 1];
493  for (x = last; x <= -1; x++)
494  ref_tmp[x] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)];
495  ref = ref_tmp;
496  }
497 
498  for (x = 0; x < size; x++) {
499  int idx = ((x + 1) * angle) >> 5;
500  int fact = ((x + 1) * angle) & 31;
501  if (fact) {
502  for (y = 0; y < size; y++) {
503  POS(x, y) = ((32 - fact) * ref[y + idx + 1] +
504  fact * ref[y + idx + 2] + 16) >> 5;
505  }
506  } else {
507  for (y = 0; y < size; y++)
508  POS(x, y) = ref[y + idx + 1];
509  }
510  }
511  if (mode == 10 && c_idx == 0 && size < 32) {
512  for (x = 0; x < size; x++)
513  POS(x, 0) = av_clip_pixel(left[0] + ((top[x] - top[-1]) >> 1));
514  }
515  }
516 }
517 
518 static void FUNC(pred_angular_0)(uint8_t *src, const uint8_t *top,
519  const uint8_t *left,
520  ptrdiff_t stride, int c_idx, int mode)
521 {
522  FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 2);
523 }
524 
525 static void FUNC(pred_angular_1)(uint8_t *src, const uint8_t *top,
526  const uint8_t *left,
527  ptrdiff_t stride, int c_idx, int mode)
528 {
529  FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 3);
530 }
531 
532 static void FUNC(pred_angular_2)(uint8_t *src, const uint8_t *top,
533  const uint8_t *left,
534  ptrdiff_t stride, int c_idx, int mode)
535 {
536  FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 4);
537 }
538 
539 static void FUNC(pred_angular_3)(uint8_t *src, const uint8_t *top,
540  const uint8_t *left,
541  ptrdiff_t stride, int c_idx, int mode)
542 {
543  FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 5);
544 }
545 
546 #undef EXTEND_LEFT_CIP
547 #undef EXTEND_RIGHT_CIP
548 #undef EXTEND_UP_CIP
549 #undef EXTEND_DOWN_CIP
550 #undef IS_INTRA
551 #undef MVF_PU
552 #undef MVF
553 #undef PU
554 #undef EXTEND_LEFT
555 #undef EXTEND_RIGHT
556 #undef EXTEND_UP
557 #undef EXTEND_DOWN
558 #undef MIN_TB_ADDR_ZS
559 #undef POS