Coverage Report

Created: 2025-07-11 07:08

/src/libvpx/vp8/common/reconintra.c
Line
Count
Source
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
 *  that can be found in the LICENSE file in the root of the source
6
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
9
 */
10
11
#include "./vpx_config.h"
12
#include "./vpx_dsp_rtcd.h"
13
#include "./vp8_rtcd.h"
14
#include "vpx_mem/vpx_mem.h"
15
#include "vpx_ports/vpx_once.h"
16
#include "blockd.h"
17
#include "vp8/common/reconintra.h"
18
#include "vp8/common/reconintra4x4.h"
19
20
enum {
21
  SIZE_16,
22
  SIZE_8,
23
  NUM_SIZES,
24
};
25
26
typedef void (*intra_pred_fn)(uint8_t *dst, ptrdiff_t stride,
27
                              const uint8_t *above, const uint8_t *left);
28
29
static intra_pred_fn pred[4][NUM_SIZES];
30
static intra_pred_fn dc_pred[2][2][NUM_SIZES];
31
32
1
static void vp8_init_intra_predictors_internal(void) {
33
1
#define INIT_SIZE(sz)                                           \
34
2
  pred[V_PRED][SIZE_##sz] = vpx_v_predictor_##sz##x##sz;        \
35
2
  pred[H_PRED][SIZE_##sz] = vpx_h_predictor_##sz##x##sz;        \
36
2
  pred[TM_PRED][SIZE_##sz] = vpx_tm_predictor_##sz##x##sz;      \
37
2
                                                                \
38
2
  dc_pred[0][0][SIZE_##sz] = vpx_dc_128_predictor_##sz##x##sz;  \
39
2
  dc_pred[0][1][SIZE_##sz] = vpx_dc_top_predictor_##sz##x##sz;  \
40
2
  dc_pred[1][0][SIZE_##sz] = vpx_dc_left_predictor_##sz##x##sz; \
41
2
  dc_pred[1][1][SIZE_##sz] = vpx_dc_predictor_##sz##x##sz
42
43
1
  INIT_SIZE(16);
44
1
  INIT_SIZE(8);
45
1
  vp8_init_intra4x4_predictors_internal();
46
1
}
47
48
void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x, unsigned char *yabove_row,
49
                                      unsigned char *yleft, int left_stride,
50
63.4M
                                      unsigned char *ypred_ptr, int y_stride) {
51
63.4M
  MB_PREDICTION_MODE mode = x->mode_info_context->mbmi.mode;
52
63.4M
  DECLARE_ALIGNED(16, uint8_t, yleft_col[16]);
53
63.4M
  int i;
54
63.4M
  intra_pred_fn fn;
55
56
1.07G
  for (i = 0; i < 16; ++i) {
57
1.01G
    yleft_col[i] = yleft[i * left_stride];
58
1.01G
  }
59
60
63.4M
  if (mode == DC_PRED) {
61
58.3M
    fn = dc_pred[x->left_available][x->up_available][SIZE_16];
62
58.3M
  } else {
63
5.14M
    fn = pred[mode][SIZE_16];
64
5.14M
  }
65
66
63.4M
  fn(ypred_ptr, y_stride, yabove_row, yleft_col);
67
63.4M
}
68
69
void vp8_build_intra_predictors_mbuv_s(
70
    MACROBLOCKD *x, unsigned char *uabove_row, unsigned char *vabove_row,
71
    unsigned char *uleft, unsigned char *vleft, int left_stride,
72
646M
    unsigned char *upred_ptr, unsigned char *vpred_ptr, int pred_stride) {
73
646M
  MB_PREDICTION_MODE uvmode = x->mode_info_context->mbmi.uv_mode;
74
#if HAVE_VSX
75
  /* Power PC implementation uses "vec_vsx_ld" to read 16 bytes from
76
     uleft_col and vleft_col. Play it safe by reserving enough stack
77
     space here. */
78
  unsigned char uleft_col[16];
79
  unsigned char vleft_col[16];
80
#else
81
646M
  unsigned char uleft_col[8];
82
646M
  unsigned char vleft_col[8];
83
646M
#endif
84
646M
  int i;
85
646M
  intra_pred_fn fn;
86
87
5.81G
  for (i = 0; i < 8; ++i) {
88
5.17G
    uleft_col[i] = uleft[i * left_stride];
89
5.17G
    vleft_col[i] = vleft[i * left_stride];
90
5.17G
  }
91
92
646M
  if (uvmode == DC_PRED) {
93
641M
    fn = dc_pred[x->left_available][x->up_available][SIZE_8];
94
641M
  } else {
95
5.11M
    fn = pred[uvmode][SIZE_8];
96
5.11M
  }
97
98
646M
  fn(upred_ptr, pred_stride, uabove_row, uleft_col);
99
646M
  fn(vpred_ptr, pred_stride, vabove_row, vleft_col);
100
646M
}
101
102
1
void vp8_init_intra_predictors(void) {
103
1
  once(vp8_init_intra_predictors_internal);
104
1
}