Unified · Split
| @@ -157,56 +157,48 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) · 156 unmodified lines | ||
| 157 | 157 | const int ctb_size_y = fc->ps.sps->ctb_size_y; |
| 158 | 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 | 159 | int c_idx; |
| 160 | − int edges[4]; // 0 left 1 top 2 right 3 bottom | |
| 161 | 160 | const int rx = x >> fc->ps.sps->ctb_log2_size_y; |
| 162 | 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 | 163 | const SAOParams *sao = &CTB(fc->tab.sao, rx, ry); |
| 164 | 164 | // flags indicating unfilterable edges |
| 165 | 165 | uint8_t vert_edge[] = { 0, 0 }; |
| 166 | 166 | uint8_t horiz_edge[] = { 0, 0 }; |
| 167 | 167 | uint8_t diag_edge[] = { 0, 0, 0, 0 }; |
| 168 | + uint8_t tile_edge[] = { 0, 0, 0, 0 }; | |
| 168 | 169 | const uint8_t lfase = fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag; |
| 169 | 170 | const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 && |
| 170 | 171 | !fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag; |
| 171 | 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 | 174 | if (restore) { |
| 183 | 175 | 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]; | |
| 186 | 178 | } |
| 187 | 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]; | |
| 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]; | |
| 190 | 182 | } |
| 191 | 183 | 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]; | |
| 194 | 186 | } |
| 195 | 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]; | |
| 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]; | |
| 198 | 190 | } |
| 199 | 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 | 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 | 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 | 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 | |