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
157157 const int ctb_size_y = fc->ps.sps->ctb_size_y;
158158 static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 };
159159 int c_idx;
160− int edges[4]; // 0 left 1 top 2 right 3 bottom
161160 const int rx = x >> fc->ps.sps->ctb_log2_size_y;
162161 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 };
163163 const SAOParams *sao = &CTB(fc->tab.sao, rx, ry);
164164 // flags indicating unfilterable edges
165165 uint8_t vert_edge[] = { 0, 0 };
166166 uint8_t horiz_edge[] = { 0, 0 };
167167 uint8_t diag_edge[] = { 0, 0, 0, 0 };
168+ uint8_t tile_edge[] = { 0, 0, 0, 0 };
168169 const uint8_t lfase = fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag;
169170 const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 &&
170171 !fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag;
171172 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;
181173
182174 if (restore) {
183175 if (!edges[LEFT]) {
184− left_tile_edge = 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;
176+ tile_edge[LEFT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx;
177+ vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT];
186178 }
187179 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];
189− vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || right_tile_edge;
180+ tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1];
181+ vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT];
190182 }
191183 if (!edges[TOP]) {
192− up_tile_edge = 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;
184+ tile_edge[TOP] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry;
185+ horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP];
194186 }
195187 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];
197− horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || bottom_tile_edge;
188+ tile_edge[BOTTOM] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1];
189+ horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM];
198190 }
199191 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];
201193 }
202194 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];
204196 }
205197 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];
207199 }
208200 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];
210202 }
211203 }
212204

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