Commit 80e1d0cd authored by Martin Storsjö's avatar Martin Storsjö Committed by Jean-Baptiste Kempf

cdef: Add a CDEF_ prefix to the HAVE_LEFT etc enum values

This reduces potential ambiguity across the codebase, as the enum
is CDEF specific, and there is another similar enum for loop restoration.

Alternatively an independent enum could be used for both CDEF and loop
restoration.
parent 8a19ee0e
Pipeline #4379 passed with stages
in 8 minutes and 21 seconds
......@@ -34,10 +34,10 @@
#include "common/bitdepth.h"
enum CdefEdgeFlags {
HAVE_LEFT = 1 << 0,
HAVE_RIGHT = 1 << 1,
HAVE_TOP = 1 << 2,
HAVE_BOTTOM = 1 << 3,
CDEF_HAVE_LEFT = 1 << 0,
CDEF_HAVE_RIGHT = 1 << 1,
CDEF_HAVE_TOP = 1 << 2,
CDEF_HAVE_BOTTOM = 1 << 3,
};
#ifdef BITDEPTH
......
......@@ -85,7 +85,7 @@ void bytefn(dav1d_cdef_brow)(Dav1dFrameContext *const f,
{
const int bitdepth_min_8 = BITDEPTH == 8 ? 0 : f->cur.p.bpc - 8;
const Dav1dDSPContext *const dsp = f->dsp;
enum CdefEdgeFlags edges = HAVE_BOTTOM | (by_start > 0 ? HAVE_TOP : 0);
enum CdefEdgeFlags edges = CDEF_HAVE_BOTTOM | (by_start > 0 ? CDEF_HAVE_TOP : 0);
pixel *ptrs[3] = { p[0], p[1], p[2] };
const int sbsz = 16;
const int sb64w = f->sb128w << 1;
......@@ -101,11 +101,11 @@ void bytefn(dav1d_cdef_brow)(Dav1dFrameContext *const f,
// the backup of pre-filter data is empty, and the restore is therefore
// unnecessary as well.
for (int bit = 0, by = by_start; by < by_end; by += 2, edges |= HAVE_TOP) {
for (int bit = 0, by = by_start; by < by_end; by += 2, edges |= CDEF_HAVE_TOP) {
const int tf = f->lf.top_pre_cdef_toggle;
if (by + 2 >= f->bh) edges &= ~HAVE_BOTTOM;
if (by + 2 >= f->bh) edges &= ~CDEF_HAVE_BOTTOM;
if (edges & HAVE_BOTTOM) {
if (edges & CDEF_HAVE_BOTTOM) {
// backup pre-filter data for next iteration
backup2lines(f->lf.cdef_line_ptr[!tf], ptrs, f->cur.stride,
8, f->bw * 4, layout);
......@@ -113,9 +113,9 @@ void bytefn(dav1d_cdef_brow)(Dav1dFrameContext *const f,
pixel lr_bak[2 /* idx */][3 /* plane */][8 /* y */][2 /* x */];
pixel *iptrs[3] = { ptrs[0], ptrs[1], ptrs[2] };
edges &= ~HAVE_LEFT;
edges |= HAVE_RIGHT;
for (int sbx = 0, last_skip = 1; sbx < sb64w; sbx++, edges |= HAVE_LEFT) {
edges &= ~CDEF_HAVE_LEFT;
edges |= CDEF_HAVE_RIGHT;
for (int sbx = 0, last_skip = 1; sbx < sb64w; sbx++, edges |= CDEF_HAVE_LEFT) {
const int sb128x = sbx >>1;
const int sb64_idx = ((by & sbsz) >> 3) + (sbx & 1);
const int cdef_idx = lflvl[sb128x].cdef_idx[sb64_idx];
......@@ -131,9 +131,9 @@ void bytefn(dav1d_cdef_brow)(Dav1dFrameContext *const f,
const int uv_lvl = f->frame_hdr->cdef.uv_strength[cdef_idx];
pixel *bptrs[3] = { iptrs[0], iptrs[1], iptrs[2] };
for (int bx = sbx * sbsz; bx < imin((sbx + 1) * sbsz, f->bw);
bx += 2, edges |= HAVE_LEFT)
bx += 2, edges |= CDEF_HAVE_LEFT)
{
if (bx + 2 >= f->bw) edges &= ~HAVE_RIGHT;
if (bx + 2 >= f->bw) edges &= ~CDEF_HAVE_RIGHT;
// check if this 8x8 block had any coded coefficients; if not,
// go to the next block
......@@ -146,12 +146,12 @@ void bytefn(dav1d_cdef_brow)(Dav1dFrameContext *const f,
goto next_b;
}
if (last_skip && edges & HAVE_LEFT) {
if (last_skip && edges & CDEF_HAVE_LEFT) {
// we didn't backup the prefilter data because it wasn't
// there, so do it here instead
backup2x8(lr_bak[bit], bptrs, f->cur.stride, 0, layout);
}
if (edges & HAVE_RIGHT) {
if (edges & CDEF_HAVE_RIGHT) {
// backup pre-filter data for next iteration
backup2x8(lr_bak[!bit], bptrs, f->cur.stride, 8, layout);
}
......
......@@ -61,19 +61,19 @@ static void padding(uint16_t *tmp, const ptrdiff_t tmp_stride,
{
// fill extended input buffer
int x_start = -2, x_end = w + 2, y_start = -2, y_end = h + 2;
if (!(edges & HAVE_TOP)) {
if (!(edges & CDEF_HAVE_TOP)) {
fill(tmp - 2 - 2 * tmp_stride, tmp_stride, w + 4, 2);
y_start = 0;
}
if (!(edges & HAVE_BOTTOM)) {
if (!(edges & CDEF_HAVE_BOTTOM)) {
fill(tmp + h * tmp_stride - 2, tmp_stride, w + 4, 2);
y_end -= 2;
}
if (!(edges & HAVE_LEFT)) {
if (!(edges & CDEF_HAVE_LEFT)) {
fill(tmp + y_start * tmp_stride - 2, tmp_stride, 2, y_end - y_start);
x_start = 0;
}
if (!(edges & HAVE_RIGHT)) {
if (!(edges & CDEF_HAVE_RIGHT)) {
fill(tmp + y_start * tmp_stride + w, tmp_stride, 2, y_end - y_start);
x_end -= 2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment