Commit 5d2e729e authored by Rupert Swarbrick's avatar Rupert Swarbrick

Simplify av1_get_rest_tile_limits

The subtile and clamping features are no longer used. This patch
removes the dead code that implemented them and the parameters to
support them.

It also changes the return format. Instead of having return type void
and passing data out through 4 output pointers, the function now just
returns a RestorationTileLimits structure. Since the function is
defined inline in a header, I suspect that most callsites will
actually compile to identical code.

There should be no functional change from this patch.

Change-Id: I6ebc4da66a00676bd988f939a4b4957f743e8004
parent 87fe5b96
This diff is collapsed.
......@@ -232,37 +232,21 @@ static INLINE int av1_get_rest_ntiles(int width, int height, int tilesize,
return (nhtiles_ * nvtiles_);
}
static INLINE void av1_get_rest_tile_limits(
int tile_idx, int subtile_idx, int subtile_bits, int nhtiles, int nvtiles,
int tile_width, int tile_height, int im_width, int im_height, int clamp_h,
int clamp_v, int *h_start, int *h_end, int *v_start, int *v_end) {
typedef struct { int h_start, h_end, v_start, v_end; } RestorationTileLimits;
static INLINE RestorationTileLimits
av1_get_rest_tile_limits(int tile_idx, int nhtiles, int nvtiles, int tile_width,
int tile_height, int im_width, int im_height) {
const int htile_idx = tile_idx % nhtiles;
const int vtile_idx = tile_idx / nhtiles;
*h_start = htile_idx * tile_width;
*v_start = vtile_idx * tile_height;
*h_end = (htile_idx < nhtiles - 1) ? *h_start + tile_width : im_width;
*v_end = (vtile_idx < nvtiles - 1) ? *v_start + tile_height : im_height;
if (subtile_bits) {
const int num_subtiles_1d = (1 << subtile_bits);
const int subtile_width = (*h_end - *h_start) >> subtile_bits;
const int subtile_height = (*v_end - *v_start) >> subtile_bits;
const int subtile_idx_h = subtile_idx & (num_subtiles_1d - 1);
const int subtile_idx_v = subtile_idx >> subtile_bits;
*h_start += subtile_idx_h * subtile_width;
*v_start += subtile_idx_v * subtile_height;
*h_end = subtile_idx_h == num_subtiles_1d - 1 ? *h_end
: *h_start + subtile_width;
*v_end = subtile_idx_v == num_subtiles_1d - 1 ? *v_end
: *v_start + subtile_height;
}
if (clamp_h) {
*h_start = AOMMAX(*h_start, clamp_h);
*h_end = AOMMIN(*h_end, im_width - clamp_h);
}
if (clamp_v) {
*v_start = AOMMAX(*v_start, clamp_v);
*v_end = AOMMIN(*v_end, im_height - clamp_v);
}
RestorationTileLimits limits;
limits.h_start = htile_idx * tile_width;
limits.v_start = vtile_idx * tile_height;
limits.h_end =
(htile_idx < nhtiles - 1) ? limits.h_start + tile_width : im_width;
limits.v_end =
(vtile_idx < nvtiles - 1) ? limits.v_start + tile_height : im_height;
return limits;
}
extern const sgr_params_type sgr_params[SGRPROJ_PARAMS];
......
This diff is collapsed.
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