History

avcodec/vvcdec: sao, refact out tile_edge arrays

Nuo Mi committed 2 years ago

Commit 0c3018b1 parent c9e75391 file · +14 −22Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vvc/vvc_filter.c+14−22
@@ -157,56 +157,48 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) · 156 unmodified lines
157 const int ctb_size_y = fc->ps.sps->ctb_size_y;157 const int ctb_size_y = fc->ps.sps->ctb_size_y;
158 static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 };158 static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 };
159 int c_idx;159 int c_idx;
160 int edges[4]; // 0 left 1 top 2 right 3 bottom
161 const int rx = x >> fc->ps.sps->ctb_log2_size_y;160 const int rx = x >> fc->ps.sps->ctb_log2_size_y;
162 const int ry = y >> fc->ps.sps->ctb_log2_size_y;161 const int ry = y >> fc->ps.sps->ctb_log2_size_y;
162 int edges[4] = { !rx, !ry, rx == fc->ps.pps->ctb_width - 1, ry == fc->ps.pps->ctb_height - 1 };
163 const SAOParams *sao = &CTB(fc->tab.sao, rx, ry);163 const SAOParams *sao = &CTB(fc->tab.sao, rx, ry);
164 // flags indicating unfilterable edges164 // flags indicating unfilterable edges
165 uint8_t vert_edge[] = { 0, 0 };165 uint8_t vert_edge[] = { 0, 0 };
166 uint8_t horiz_edge[] = { 0, 0 };166 uint8_t horiz_edge[] = { 0, 0 };
167 uint8_t diag_edge[] = { 0, 0, 0, 0 };167 uint8_t diag_edge[] = { 0, 0, 0, 0 };
168 uint8_t tile_edge[] = { 0, 0, 0, 0 };
168 const uint8_t lfase = fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag;169 const uint8_t lfase = fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag;
169 const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 &&170 const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 &&
170 !fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag;171 !fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag;
171 const uint8_t restore = no_tile_filter || !lfase;172 const uint8_t restore = no_tile_filter || !lfase;
172 uint8_t left_tile_edge = 0;
173 uint8_t right_tile_edge = 0;
174 uint8_t up_tile_edge = 0;
175 uint8_t bottom_tile_edge = 0;
176
177 edges[LEFT] = rx == 0;
178 edges[TOP] = ry == 0;
179 edges[RIGHT] = rx == fc->ps.pps->ctb_width - 1;
180 edges[BOTTOM] = ry == fc->ps.pps->ctb_height - 1;
181 173
182 if (restore) {174 if (restore) {
183 if (!edges[LEFT]) {175 if (!edges[LEFT]) {
184 left_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx;176 tile_edge[LEFT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx;
185 vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || left_tile_edge;177 vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT];
186 }178 }
187 if (!edges[RIGHT]) {179 if (!edges[RIGHT]) {
188 right_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1];180 tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1];
189 vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || right_tile_edge;181 vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT];
190 }182 }
191 if (!edges[TOP]) {183 if (!edges[TOP]) {
192 up_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry;184 tile_edge[TOP] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry;
193 horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || up_tile_edge;185 horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP];
194 }186 }
195 if (!edges[BOTTOM]) {187 if (!edges[BOTTOM]) {
196 bottom_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];188 tile_edge[BOTTOM] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];
197 horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || bottom_tile_edge;189 horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM];
198 }190 }
199 if (!edges[LEFT] && !edges[TOP]) {191 if (!edges[LEFT] && !edges[TOP]) {
200 diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || left_tile_edge || up_tile_edge;192 diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || tile_edge[LEFT] || tile_edge[TOP];
201 }193 }
202 if (!edges[TOP] && !edges[RIGHT]) {194 if (!edges[TOP] && !edges[RIGHT]) {
203 diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || right_tile_edge || up_tile_edge;195 diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || tile_edge[RIGHT] || tile_edge[TOP];
204 }196 }
205 if (!edges[RIGHT] && !edges[BOTTOM]) {197 if (!edges[RIGHT] && !edges[BOTTOM]) {
206 diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || right_tile_edge || bottom_tile_edge;198 diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || tile_edge[RIGHT] || tile_edge[BOTTOM];
207 }199 }
208 if (!edges[LEFT] && !edges[BOTTOM]) {200 if (!edges[LEFT] && !edges[BOTTOM]) {
209 diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || left_tile_edge || bottom_tile_edge;201 diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || tile_edge[LEFT] || tile_edge[BOTTOM];
210 }202 }
211 }203 }
212 204

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t