Rename struct vector2d to vector2d_t.

This commit is contained in:
Ari Koivula 2015-03-04 13:32:11 +02:00
parent 5b12830756
commit a0767a76d2
8 changed files with 57 additions and 57 deletions

View file

@ -40,7 +40,7 @@ typedef enum { CU_NOTSET = 0, CU_PCM, CU_SKIP, CU_SPLIT, CU_INTRA, CU_INTER } cu
typedef struct {
int x;
int y;
} vector2d;
} vector2d_t;
/**
* \brief Struct for CU intra info

View file

@ -1222,7 +1222,7 @@ void encode_coding_tree(encoder_state_t * const encoder_state,
// it can be signaled with two EP's. Otherwise we can send
// 5 EP bins with the full predmode
for (j = 0; j < num_pred_units; ++j) {
static const vector2d offset[4] = {{0,0},{1,0},{0,1},{1,1}};
static const vector2d_t offset[4] = {{0,0},{1,0},{0,1},{1,1}};
const cu_info_t *left_cu = NULL;
const cu_info_t *above_cu = NULL;

View file

@ -126,9 +126,9 @@ typedef struct lcu_order_element {
int id;
int index;
struct encoder_state_t *encoder_state;
vector2d position;
vector2d position_px; //Top-left
vector2d size;
vector2d_t position;
vector2d_t position_px; //Top-left
vector2d_t size;
int first_column;
int first_row;
int last_column;

View file

@ -216,7 +216,7 @@ void filter_deblock_edge_luma(encoder_state_t * const encoder_state,
int32_t dp0, dq0, dp3, dq3, d0, d3, dp, dq, d;
{
vector2d px = {
vector2d_t px = {
(dir == EDGE_HOR ? xpos + block_idx * 4 : xpos),
(dir == EDGE_VER ? ypos + block_idx * 4 : ypos)
};
@ -343,7 +343,7 @@ void filter_deblock_edge_chroma(encoder_state_t * const encoder_state,
for (blk_idx = 0; blk_idx < blocks_in_part; ++blk_idx)
{
vector2d px = {
vector2d_t px = {
(dir == EDGE_HOR ? x + blk_idx * 4 : x),
(dir == EDGE_VER ? y + blk_idx * 4 : y)
};
@ -438,7 +438,7 @@ void filter_deblock_cu(encoder_state_t * const encoder_state, int32_t x, int32_t
*/
void filter_deblock_lcu(encoder_state_t * const encoder_state, int x_px, int y_px)
{
const vector2d lcu = { x_px / LCU_WIDTH, y_px / LCU_WIDTH };
const vector2d_t lcu = { x_px / LCU_WIDTH, y_px / LCU_WIDTH };
filter_deblock_cu(encoder_state, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_VER);

View file

@ -660,7 +660,7 @@ void intra_get_planar_pred(const pixel* src, int32_t srcstride, uint32_t width,
void intra_recon_lcu_luma(encoder_state_t * const encoder_state, int x, int y, int depth, int8_t intra_mode, cu_info_t *cur_cu, lcu_t *lcu)
{
const encoder_control_t * const encoder = encoder_state->encoder_control;
const vector2d lcu_px = { x & 0x3f, y & 0x3f };
const vector2d_t lcu_px = { x & 0x3f, y & 0x3f };
if (cur_cu == NULL) {
cur_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x >> 3) + (lcu_px.y >> 3)*LCU_T_CU_WIDTH];
}
@ -709,7 +709,7 @@ void intra_recon_lcu_luma(encoder_state_t * const encoder_state, int x, int y, i
void intra_recon_lcu_chroma(encoder_state_t * const encoder_state, int x, int y, int depth, int8_t intra_mode, cu_info_t *cur_cu, lcu_t *lcu)
{
const encoder_control_t * const encoder = encoder_state->encoder_control;
const vector2d lcu_px = { x & 0x3f, y & 0x3f };
const vector2d_t lcu_px = { x & 0x3f, y & 0x3f };
const int8_t width = LCU_WIDTH >> depth;
const int8_t width_c = (depth == MAX_PU_DEPTH ? width : width / 2);

View file

@ -34,7 +34,7 @@
// | | a | a | a |
// | a c b | c | c | c |
// | | b | b | b |
static const vector2d g_sao_edge_offsets[SAO_NUM_EO][2] = {
static const vector2d_t g_sao_edge_offsets[SAO_NUM_EO][2] = {
{ { -1, 0 }, { 1, 0 } },
{ { 0, -1 }, { 0, 1 } },
{ { -1, -1 }, { 1, 1 } },
@ -88,8 +88,8 @@ int sao_edge_ddistortion(const pixel *orig_data, const pixel *rec_data,
{
int y, x;
int sum = 0;
vector2d a_ofs = g_sao_edge_offsets[eo_class][0];
vector2d b_ofs = g_sao_edge_offsets[eo_class][1];
vector2d_t a_ofs = g_sao_edge_offsets[eo_class][0];
vector2d_t b_ofs = g_sao_edge_offsets[eo_class][1];
for (y = 1; y < block_height - 1; ++y) {
for (x = 1; x < block_width - 1; ++x) {
@ -354,8 +354,8 @@ static void calc_sao_edge_dir(const pixel *orig_data, const pixel *rec_data,
int cat_sum_cnt[2][NUM_SAO_EDGE_CATEGORIES])
{
int y, x;
vector2d a_ofs = g_sao_edge_offsets[eo_class][0];
vector2d b_ofs = g_sao_edge_offsets[eo_class][1];
vector2d_t a_ofs = g_sao_edge_offsets[eo_class][0];
vector2d_t b_ofs = g_sao_edge_offsets[eo_class][1];
// Arrays orig_data and rec_data are quarter size for chroma.
// Don't sample the edge pixels because this function doesn't have access to
@ -399,8 +399,8 @@ static void sao_reconstruct_color(const encoder_control_t * const encoder,
// their neighbours.
for (y = 0; y < block_height; ++y) {
for (x = 0; x < block_width; ++x) {
vector2d a_ofs = g_sao_edge_offsets[sao->eo_class][0];
vector2d b_ofs = g_sao_edge_offsets[sao->eo_class][1];
vector2d_t a_ofs = g_sao_edge_offsets[sao->eo_class][0];
vector2d_t b_ofs = g_sao_edge_offsets[sao->eo_class][1];
const pixel *c_data = &rec_data[y * stride + x];
pixel *new_data = &new_rec_data[y * new_stride + x];
pixel a = c_data[a_ofs.y * stride + a_ofs.x];
@ -423,7 +423,7 @@ static void sao_reconstruct_color(const encoder_control_t * const encoder,
* \param rec Top-left corner of the LCU
*/
static void sao_calc_band_block_dims(const videoframe_t *frame, color_index color_i,
vector2d *rec, vector2d *block)
vector2d_t *rec, vector2d_t *block)
{
const int is_chroma = (color_i != COLOR_Y ? 1 : 0);
int width = frame->width >> is_chroma;
@ -478,12 +478,12 @@ static void sao_calc_band_block_dims(const videoframe_t *frame, color_index colo
* \param rec Top-left corner of the LCU, modified to be top-left corner of
*/
static void sao_calc_edge_block_dims(const videoframe_t * const frame, color_index color_i,
const sao_info *sao, vector2d *rec,
vector2d *tl, vector2d *br,
vector2d *block)
const sao_info *sao, vector2d_t *rec,
vector2d_t *tl, vector2d_t *br,
vector2d_t *block)
{
vector2d a_ofs = g_sao_edge_offsets[sao->eo_class][0];
vector2d b_ofs = g_sao_edge_offsets[sao->eo_class][1];
vector2d_t a_ofs = g_sao_edge_offsets[sao->eo_class][0];
vector2d_t b_ofs = g_sao_edge_offsets[sao->eo_class][1];
const int is_chroma = (color_i != COLOR_Y ? 1 : 0);
int width = frame->width >> is_chroma;
int height = frame->height >> is_chroma;
@ -543,10 +543,10 @@ void sao_reconstruct(const encoder_control_t * const encoder, videoframe_t * fra
pixel *lcu_rec = &recdata[CU_TO_PIXEL(x_ctb, y_ctb, is_chroma, frame->rec->stride>>is_chroma)];
const pixel *old_lcu_rec = &old_rec[CU_TO_PIXEL(x_ctb, y_ctb, is_chroma, pic_stride)];
vector2d ofs;
vector2d tl = { 1, 1 };
vector2d br = { 1, 1 };
vector2d block;
vector2d_t ofs;
vector2d_t tl = { 1, 1 };
vector2d_t br = { 1, 1 };
vector2d_t block;
if (sao->type == SAO_TYPE_NONE) {
return;
@ -892,7 +892,7 @@ void sao_search_luma(const encoder_state_t * const encoder_state, const videofra
void sao_reconstruct_frame(encoder_state_t * const encoder_state)
{
vector2d lcu;
vector2d_t lcu;
videoframe_t * const frame = encoder_state->tile->frame;
// These are needed because SAO needs the pre-SAO pixels form left and

View file

@ -91,7 +91,7 @@
* \ /
* 4 o-o 3
*/
const vector2d large_hexbs[10] = {
const vector2d_t large_hexbs[10] = {
{ 0, 0 },
{ 1, -2 }, { 2, 0 }, { 1, 2 }, { -1, 2 }, { -2, 0 }, { -1, -2 },
{ 1, -2 }, { 2, 0 }
@ -100,7 +100,7 @@ const vector2d large_hexbs[10] = {
/**
* This is used as the last step of the hexagon search.
*/
const vector2d small_hexbs[5] = {
const vector2d_t small_hexbs[5] = {
{ 0, 0 },
{ -1, -1 }, { -1, 0 }, { 1, 0 }, { 1, 1 }
};
@ -110,7 +110,7 @@ const vector2d small_hexbs[5] = {
* 3 4 5
* 0 1 2
*/
const vector2d square[9] = {
const vector2d_t square[9] = {
{ -1, 1 },
{ 0, 1 }, { 1, 1 }, { -1, 0 }, { 0, 0 }, { 1, 0 }, { -1, -1 },
{ 0, -1 }, { 1, -1 }
@ -129,7 +129,7 @@ static uint32_t get_ep_ex_golomb_bitcost(uint32_t symbol, uint32_t count)
return num_bins;
}
static uint32_t get_mvd_coding_cost(vector2d *mvd)
static uint32_t get_mvd_coding_cost(vector2d_t *mvd)
{
uint32_t bitcost = 0;
const int32_t mvd_hor = mvd->x;
@ -168,7 +168,7 @@ static int calc_mvd_cost(const encoder_state_t * const encoder_state, int x, int
uint32_t temp_bitcost = 0;
uint32_t merge_idx;
int cand1_cost,cand2_cost;
vector2d mvd_temp1, mvd_temp2;
vector2d_t mvd_temp1, mvd_temp2;
int8_t merged = 0;
int8_t cur_mv_cand = 0;
@ -229,11 +229,11 @@ static int calc_mvd_cost(const encoder_state_t * const encoder_state, int x, int
*/
static unsigned hexagon_search(const encoder_state_t * const encoder_state, unsigned depth,
const image *pic, const image *ref,
const vector2d *orig, vector2d *mv_in_out,
const vector2d_t *orig, vector2d_t *mv_in_out,
int16_t mv_cand[2][2], int16_t merge_cand[MRG_MAX_NUM_CANDS][3],
int16_t num_cand, int32_t ref_idx, uint32_t *bitcost_out)
{
vector2d mv = { mv_in_out->x >> 2, mv_in_out->y >> 2 };
vector2d_t mv = { mv_in_out->x >> 2, mv_in_out->y >> 2 };
int block_width = CU_WIDTH_FROM_DEPTH(depth);
unsigned best_cost = UINT32_MAX;
uint32_t best_bitcost = 0, bitcost;
@ -301,7 +301,7 @@ static unsigned hexagon_search(const encoder_state_t * const encoder_state, unsi
// Search the initial 7 points of the hexagon.
best_index = 0;
for (i = 0; i < 7; ++i) {
const vector2d *pattern = &large_hexbs[i];
const vector2d_t *pattern = &large_hexbs[i];
unsigned cost;
{
PERFORMANCE_MEASURE_START(_DEBUG_PERF_SEARCH_PIXELS);
@ -344,7 +344,7 @@ static unsigned hexagon_search(const encoder_state_t * const encoder_state, unsi
// Iterate through the next 3 points.
for (i = 0; i < 3; ++i) {
const vector2d *offset = &large_hexbs[start + i];
const vector2d_t *offset = &large_hexbs[start + i];
unsigned cost;
{
PERFORMANCE_MEASURE_START(_DEBUG_PERF_SEARCH_PIXELS);
@ -376,7 +376,7 @@ static unsigned hexagon_search(const encoder_state_t * const encoder_state, unsi
// Do the final step of the search with a small pattern.
for (i = 1; i < 5; ++i) {
const vector2d *offset = &small_hexbs[i];
const vector2d_t *offset = &small_hexbs[i];
unsigned cost;
{
PERFORMANCE_MEASURE_START(_DEBUG_PERF_SEARCH_PIXELS);
@ -482,12 +482,12 @@ static unsigned search_mv_full(unsigned depth,
static unsigned search_frac( const encoder_state_t * const encoder_state,
unsigned depth,
const image *pic, const image *ref,
const vector2d *orig, vector2d *mv_in_out,
const vector2d_t *orig, vector2d_t *mv_in_out,
int16_t mv_cand[2][2], int16_t merge_cand[MRG_MAX_NUM_CANDS][3],
int16_t num_cand, int32_t ref_idx, uint32_t *bitcost_out) {
//Set mv to halfpel precision
vector2d mv = { mv_in_out->x >> 2, mv_in_out->y >> 2 };
vector2d_t mv = { mv_in_out->x >> 2, mv_in_out->y >> 2 };
int block_width = CU_WIDTH_FROM_DEPTH(depth);
unsigned best_cost = UINT32_MAX;
uint32_t best_bitcost = 0, bitcost;
@ -498,7 +498,7 @@ static unsigned search_frac( const encoder_state_t * const encoder_state,
cost_pixel_nxn_func *satd = pixels_get_satd_func(block_width);
vector2d halfpel_offset;
vector2d_t halfpel_offset;
#define FILTER_SIZE 8
#define HALF_FILTER (FILTER_SIZE>>1)
@ -528,7 +528,7 @@ static unsigned search_frac( const encoder_state_t * const encoder_state,
// Search halfpel positions around best integer mv
for (i = 0; i < 9; ++i) {
const vector2d *pattern = &square[i];
const vector2d_t *pattern = &square[i];
pixel tmp_filtered[LCU_WIDTH*LCU_WIDTH];
pixel tmp_pic[LCU_WIDTH*LCU_WIDTH];
@ -568,7 +568,7 @@ static unsigned search_frac( const encoder_state_t * const encoder_state,
//Search quarterpel points around best halfpel mv
for (i = 0; i < 9; ++i) {
const vector2d *pattern = &square[i];
const vector2d_t *pattern = &square[i];
pixel tmp_filtered[LCU_WIDTH*LCU_WIDTH];
pixel tmp_pic[LCU_WIDTH*LCU_WIDTH];
@ -639,7 +639,7 @@ static int search_cu_inter(const encoder_state_t * const encoder_state, int x, i
const cu_info_t *ref_cu = &encoder_state->global->ref->cu_arrays[ref_idx]->data[x_cu + y_cu * (frame->width_in_lcu << MAX_DEPTH)];
uint32_t temp_bitcost = 0;
uint32_t temp_cost = 0;
vector2d orig, mv, mvd;
vector2d_t orig, mv, mvd;
int32_t merged = 0;
uint8_t cu_mv_cand = 0;
int8_t merge_idx = 0;
@ -679,7 +679,7 @@ static int search_cu_inter(const encoder_state_t * const encoder_state, int x, i
// Only check when candidates are different
if (!merged && (mv_cand[0][0] != mv_cand[1][0] || mv_cand[0][1] != mv_cand[1][1])) {
vector2d mvd_temp1, mvd_temp2;
vector2d_t mvd_temp1, mvd_temp2;
int cand1_cost,cand2_cost;
mvd_temp1.x = mv.x - mv_cand[0][0];
@ -819,7 +819,7 @@ static void work_tree_copy_down(int x_px, int y_px, int depth, lcu_t work_tree[M
static void lcu_set_trdepth(lcu_t *lcu, int x_px, int y_px, int depth, int tr_depth)
{
const int width_cu = LCU_CU_WIDTH >> depth;
const vector2d lcu_cu = { (x_px & (LCU_WIDTH - 1)) / 8, (y_px & (LCU_WIDTH - 1)) / 8 };
const vector2d_t lcu_cu = { (x_px & (LCU_WIDTH - 1)) / 8, (y_px & (LCU_WIDTH - 1)) / 8 };
cu_info_t *const cur_cu = &lcu->cu[lcu_cu.x + lcu_cu.y * LCU_T_CU_WIDTH + LCU_CU_OFFSET];
int x, y;
@ -1012,7 +1012,7 @@ static double cu_rd_cost_chroma(const encoder_state_t *const encoder_state,
const cu_info_t *const pred_cu,
lcu_t *const lcu)
{
const vector2d lcu_px = { x_px / 2, y_px / 2 };
const vector2d_t lcu_px = { x_px / 2, y_px / 2 };
const int width = (depth <= MAX_DEPTH) ? LCU_WIDTH >> (depth + 1) : LCU_WIDTH >> depth;
cu_info_t *const tr_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x / 4) + (lcu_px.y / 4)*LCU_T_CU_WIDTH];
@ -1106,7 +1106,7 @@ static double search_intra_trdepth(encoder_state_t * const encoder_state,
const int width_c = width > TR_MIN_WIDTH ? width / 2 : width;
const int offset = width / 2;
const vector2d lcu_px = { x_px & 0x3f, y_px & 0x3f };
const vector2d_t lcu_px = { x_px & 0x3f, y_px & 0x3f };
cu_info_t *const tr_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x >> 3) + (lcu_px.y >> 3)*LCU_T_CU_WIDTH];
const bool reconstruct_chroma = !(x_px & 4 || y_px & 4);
@ -1278,7 +1278,7 @@ static int8_t search_intra_chroma(encoder_state_t * const encoder_state,
const bool reconstruct_chroma = !(x_px & 4 || y_px & 4);
if (reconstruct_chroma) {
const vector2d lcu_px = { x_px & 0x3f, y_px & 0x3f };
const vector2d_t lcu_px = { x_px & 0x3f, y_px & 0x3f };
cu_info_t *const tr_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x >> 3) + (lcu_px.y >> 3)*LCU_T_CU_WIDTH];
struct {
@ -1742,8 +1742,8 @@ static double search_cu_intra(encoder_state_t * const encoder_state,
const int depth, lcu_t *lcu)
{
const videoframe_t * const frame = encoder_state->tile->frame;
const vector2d lcu_px = { x_px & 0x3f, y_px & 0x3f };
const vector2d lcu_cu = { lcu_px.x >> 3, lcu_px.y >> 3 };
const vector2d_t lcu_px = { x_px & 0x3f, y_px & 0x3f };
const vector2d_t lcu_cu = { lcu_px.x >> 3, lcu_px.y >> 3 };
const int8_t cu_width = (LCU_WIDTH >> (depth));
const int cu_index = LCU_CU_OFFSET + lcu_cu.x + lcu_cu.y * LCU_T_CU_WIDTH;
@ -1862,7 +1862,7 @@ static double calc_mode_bits(const encoder_state_t *encoder_state,
static uint8_t get_ctx_cu_split_model(const lcu_t *lcu, int x, int y, int depth)
{
vector2d lcu_cu = { (x & 0x3f) / 8, (y & 0x3f) / 8 };
vector2d_t lcu_cu = { (x & 0x3f) / 8, (y & 0x3f) / 8 };
const cu_info_t *cu_array = &(lcu)->cu[LCU_CU_OFFSET];
bool condA = x >= 8 && cu_array[(lcu_cu.x - 1) * lcu_cu.y * LCU_T_CU_WIDTH].depth > depth;
bool condL = y >= 8 && cu_array[lcu_cu.x * (lcu_cu.y - 1) * LCU_T_CU_WIDTH].depth > depth;
@ -1887,7 +1887,7 @@ static double search_cu(encoder_state_t * const encoder_state, int x, int y, int
double cost = MAX_INT;
cu_info_t *cur_cu;
const vector2d lcu_px = { x & 0x3f, y & 0x3f };
const vector2d_t lcu_px = { x & 0x3f, y & 0x3f };
lcu_t *const lcu = &work_tree[depth];
int x_local = (x&0x3f), y_local = (y&0x3f);
@ -1996,7 +1996,7 @@ static double search_cu(encoder_state_t * const encoder_state, int x, int y, int
frame->width / 2, frame->height / 2,
lcu);
vector2d lcu_cpx = { lcu_px.x / 2, lcu_px.y / 2 };
vector2d_t lcu_cpx = { lcu_px.x / 2, lcu_px.y / 2 };
pixel *ref_u = &lcu->ref.u[lcu_cpx.x + lcu_cpx.y * LCU_WIDTH_C];
pixel *ref_v = &lcu->ref.u[lcu_cpx.x + lcu_cpx.y * LCU_WIDTH_C];
@ -2087,7 +2087,7 @@ static double search_cu(encoder_state_t * const encoder_state, int x, int y, int
if (cur_cu->type == CU_NOTSET && depth < MAX_PU_DEPTH
&& x + cu_width <= frame->width && y + cu_width <= frame->height)
{
vector2d lcu_cu = { x_local / 8, y_local / 8 };
vector2d_t lcu_cu = { x_local / 8, y_local / 8 };
cu_info_t *cu_array_d1 = &(&work_tree[depth + 1])->cu[LCU_CU_OFFSET];
cu_info_t *cu_d1 = &cu_array_d1[(lcu_cu.x + lcu_cu.y * LCU_T_CU_WIDTH)];

View file

@ -502,7 +502,7 @@ int quantize_residual_trskip(
void quantize_lcu_luma_residual(encoder_state_t * const encoder_state, int32_t x, int32_t y, const uint8_t depth, cu_info_t *cur_cu, lcu_t* lcu)
{
// we have 64>>depth transform size
const vector2d lcu_px = {x & 0x3f, y & 0x3f};
const vector2d_t lcu_px = {x & 0x3f, y & 0x3f};
const int pu_index = PU_INDEX(lcu_px.x / 4, lcu_px.y / 4);
if (cur_cu == NULL) {
cur_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x >> 3) + (lcu_px.y >> 3)*LCU_T_CU_WIDTH];
@ -586,7 +586,7 @@ void quantize_lcu_luma_residual(encoder_state_t * const encoder_state, int32_t x
void quantize_lcu_chroma_residual(encoder_state_t * const encoder_state, int32_t x, int32_t y, const uint8_t depth, cu_info_t *cur_cu, lcu_t* lcu)
{
// we have 64>>depth transform size
const vector2d lcu_px = {x & 0x3f, y & 0x3f};
const vector2d_t lcu_px = {x & 0x3f, y & 0x3f};
const int pu_index = PU_INDEX(lcu_px.x / 4, lcu_px.y / 4);
const int8_t width = LCU_WIDTH>>depth;
if (cur_cu == NULL) {