mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Drop temporary arrays in bipred search
Changes bipred search to use the original source and reconstruction arrays directly instead of copying them.
This commit is contained in:
parent
0ea516ba30
commit
cb06cfeadb
|
@ -1405,19 +1405,16 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
|
||||||
if (i >= info->num_merge_cand || j >= info->num_merge_cand) break;
|
if (i >= info->num_merge_cand || j >= info->num_merge_cand) break;
|
||||||
|
|
||||||
// Find one L0 and L1 candidate according to the priority list
|
// Find one L0 and L1 candidate according to the priority list
|
||||||
if ((merge_cand[i].dir & 0x1) && (merge_cand[j].dir & 0x2)) {
|
if (!(merge_cand[i].dir & 0x1) || !(merge_cand[j].dir & 0x2)) continue;
|
||||||
if (ref_LX[0][merge_cand[i].ref[0]] !=
|
|
||||||
ref_LX[1][merge_cand[j].ref[1]] ||
|
|
||||||
|
|
||||||
merge_cand[i].mv[0][0] != merge_cand[j].mv[1][0] ||
|
if (ref_LX[0][merge_cand[i].ref[0]] == ref_LX[1][merge_cand[j].ref[1]] &&
|
||||||
merge_cand[i].mv[0][1] != merge_cand[j].mv[1][1])
|
merge_cand[i].mv[0][0] == merge_cand[j].mv[1][0] &&
|
||||||
|
merge_cand[i].mv[0][1] == merge_cand[j].mv[1][1])
|
||||||
{
|
{
|
||||||
uint32_t bitcost[2];
|
continue;
|
||||||
uint32_t cost = 0;
|
}
|
||||||
int16_t mv[2][2];
|
|
||||||
kvz_pixel tmp_block[64 * 64];
|
|
||||||
kvz_pixel tmp_pic[64 * 64];
|
|
||||||
|
|
||||||
|
int16_t mv[2][2];
|
||||||
mv[0][0] = merge_cand[i].mv[0][0];
|
mv[0][0] = merge_cand[i].mv[0][0];
|
||||||
mv[0][1] = merge_cand[i].mv[0][1];
|
mv[0][1] = merge_cand[i].mv[0][1];
|
||||||
mv[1][0] = merge_cand[j].mv[1][0];
|
mv[1][0] = merge_cand[j].mv[1][0];
|
||||||
|
@ -1430,7 +1427,6 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcu_t templcu;
|
|
||||||
kvz_inter_recon_bipred(info->state,
|
kvz_inter_recon_bipred(info->state,
|
||||||
ref->images[ref_LX[0][merge_cand[i].ref[0]]],
|
ref->images[ref_LX[0][merge_cand[i].ref[0]]],
|
||||||
ref->images[ref_LX[1][merge_cand[j].ref[1]]],
|
ref->images[ref_LX[1][merge_cand[j].ref[1]]],
|
||||||
|
@ -1438,18 +1434,14 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
mv,
|
mv,
|
||||||
&templcu);
|
lcu);
|
||||||
|
|
||||||
for (int ypos = 0; ypos < height; ++ypos) {
|
const kvz_pixel *rec = &lcu->rec.y[SUB_SCU(y) * LCU_WIDTH + SUB_SCU(x)];
|
||||||
int dst_y = ypos * width;
|
const kvz_pixel *src = &frame->source->y[x + y * frame->source->width];
|
||||||
for (int xpos = 0; xpos < width; ++xpos) {
|
uint32_t cost =
|
||||||
tmp_block[dst_y + xpos] = templcu.rec.y[
|
kvz_satd_any_size(cu_width, cu_width, rec, LCU_WIDTH, src, frame->source->width);
|
||||||
SUB_SCU(y + ypos) * LCU_WIDTH + SUB_SCU(x + xpos)];
|
|
||||||
tmp_pic[dst_y + xpos] = frame->source->y[x + xpos + (y + ypos)*frame->source->width];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cost = kvz_satd_any_size(cu_width, cu_width, tmp_pic, cu_width, tmp_block, cu_width);
|
uint32_t bitcost[2] = { 0, 0 };
|
||||||
|
|
||||||
cost += info->mvd_cost_func(info->state,
|
cost += info->mvd_cost_func(info->state,
|
||||||
merge_cand[i].mv[0][0],
|
merge_cand[i].mv[0][0],
|
||||||
|
@ -1473,7 +1465,6 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
|
||||||
const int extra_bits = mv_ref_coded[0] + mv_ref_coded[1] + 2 /* mv dir cost */;
|
const int extra_bits = mv_ref_coded[0] + mv_ref_coded[1] + 2 /* mv dir cost */;
|
||||||
cost += info->state->lambda_sqrt * extra_bits + 0.5;
|
cost += info->state->lambda_sqrt * extra_bits + 0.5;
|
||||||
|
|
||||||
|
|
||||||
if (cost < *inter_cost) {
|
if (cost < *inter_cost) {
|
||||||
cur_cu->inter.mv_dir = 3;
|
cur_cu->inter.mv_dir = 3;
|
||||||
|
|
||||||
|
@ -1518,8 +1509,6 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue