]> git.sesse.net Git - ffmpeg/commitdiff
hevc: rename variable in boundary strength to b more explicit
authorAnton Khirnov <anton@khirnov.net>
Sun, 27 Jul 2014 23:06:32 +0000 (01:06 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 28 Jul 2014 12:20:19 +0000 (14:20 +0200)
Signed-off-by: Mickaƫl Raulet <mraulet@insa-rennes.fr>
cherry picked from commit 348bebedc0012aae201419669fca1eb61ec93ca6
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/hevc.c
libavcodec/hevc.h
libavcodec/hevc_filter.c

index 409be5257bfecf8dbd33af43a9762c0578b9a50c..4473c270fb47a52732616e20959bb0efe76fab47 100644 (file)
@@ -2205,9 +2205,6 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb,
     int ctb_addr_rs       = s->pps->ctb_addr_ts_to_rs[ctb_addr_ts];
     int ctb_addr_in_slice = ctb_addr_rs - s->sh.slice_addr;
 
-    int tile_left_boundary, tile_up_boundary;
-    int slice_left_boundary, slice_up_boundary;
-
     s->tab_slice_address[ctb_addr_rs] = s->sh.slice_addr;
 
     if (s->pps->entropy_coding_sync_enabled_flag) {
@@ -2226,25 +2223,24 @@ static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb,
 
     lc->end_of_tiles_y = FFMIN(y_ctb + ctb_size, s->sps->height);
 
+    lc->boundary_flags = 0;
     if (s->pps->tiles_enabled_flag) {
-        tile_left_boundary = x_ctb > 0 &&
-                             s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
-        slice_left_boundary = x_ctb > 0 &&
-                              s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - 1];
-        tile_up_boundary  = y_ctb > 0 &&
-                            s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->sps->ctb_width]];
-        slice_up_boundary = y_ctb > 0 &&
-                            s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - s->sps->ctb_width];
+        if (x_ctb > 0 && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]])
+            lc->boundary_flags |= BOUNDARY_LEFT_TILE;
+        if (x_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - 1])
+            lc->boundary_flags |= BOUNDARY_LEFT_SLICE;
+        if (y_ctb > 0 && s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->sps->ctb_width]])
+            lc->boundary_flags |= BOUNDARY_UPPER_TILE;
+        if (y_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - s->sps->ctb_width])
+            lc->boundary_flags |= BOUNDARY_UPPER_SLICE;
     } else {
-        tile_left_boundary =
-        tile_up_boundary   = 0;
-        slice_left_boundary = ctb_addr_in_slice <= 0;
-        slice_up_boundary   = ctb_addr_in_slice < s->sps->ctb_width;
-    }
-    lc->slice_or_tiles_left_boundary = slice_left_boundary + (tile_left_boundary << 1);
-    lc->slice_or_tiles_up_boundary   = slice_up_boundary   + (tile_up_boundary   << 1);
-    lc->ctb_left_flag = ((x_ctb > 0) && (ctb_addr_in_slice > 0)                  && !tile_left_boundary);
-    lc->ctb_up_flag   = ((y_ctb > 0) && (ctb_addr_in_slice >= s->sps->ctb_width) && !tile_up_boundary);
+        if (!ctb_addr_in_slice > 0)
+            lc->boundary_flags |= BOUNDARY_LEFT_SLICE;
+        if (ctb_addr_in_slice < s->sps->ctb_width)
+            lc->boundary_flags |= BOUNDARY_UPPER_SLICE;
+    }
+    lc->ctb_left_flag = ((x_ctb > 0) && (ctb_addr_in_slice > 0)                  && !(lc->boundary_flags & BOUNDARY_LEFT_TILE));
+    lc->ctb_up_flag   = ((y_ctb > 0) && (ctb_addr_in_slice >= s->sps->ctb_width) && !(lc->boundary_flags & BOUNDARY_UPPER_TILE));
     lc->ctb_up_right_flag = ((y_ctb > 0)                 && (ctb_addr_in_slice+1 >= s->sps->ctb_width) && (s->pps->tile_id[ctb_addr_ts] == s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs+1 - s->sps->ctb_width]]));
     lc->ctb_up_left_flag  = ((x_ctb > 0) && (y_ctb > 0)  && (ctb_addr_in_slice-1 >= s->sps->ctb_width) && (s->pps->tile_id[ctb_addr_ts] == s->pps->tile_id[s->pps->ctb_addr_rs_to_ts[ctb_addr_rs-1 - s->sps->ctb_width]]));
 }
index 7ed74dba17787aaf02618f5fae88a4530dffe70f..8420f38dc32220bb238195fbe8edeb12dc42ca40 100644 (file)
@@ -779,8 +779,13 @@ typedef struct HEVCLocalContext {
     PredictionUnit pu;
     NeighbourAvailable na;
 
-    uint8_t slice_or_tiles_left_boundary;
-    uint8_t slice_or_tiles_up_boundary;
+#define BOUNDARY_LEFT_SLICE     (1 << 0)
+#define BOUNDARY_LEFT_TILE      (1 << 1)
+#define BOUNDARY_UPPER_SLICE    (1 << 2)
+#define BOUNDARY_UPPER_TILE     (1 << 3)
+    /* properties of the boundary of the current CTB for the purposes
+     * of the deblocking filter */
+    int boundary_flags;
 } HEVCLocalContext;
 
 typedef struct HEVCContext {
index a68d8434295b550ed6e4ceacc66127e79a777c6a..bf471cea3c943c79dff27d3251ffd29db6e0cfc2 100644 (file)
@@ -585,9 +585,9 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
     if (y0 > 0 && (y0 & 7) == 0) {
         int bd_ctby = y0 & ((1 << s->sps->log2_ctb_size) - 1);
         int bd_slice = s->sh.slice_loop_filter_across_slices_enabled_flag ||
-                       !(lc->slice_or_tiles_up_boundary & 1);
+                       !(lc->boundary_flags & BOUNDARY_UPPER_SLICE);
         int bd_tiles = s->pps->loop_filter_across_tiles_enabled_flag ||
-                       !(lc->slice_or_tiles_up_boundary & 2);
+                       !(lc->boundary_flags & BOUNDARY_UPPER_TILE);
         if (((bd_slice && bd_tiles)  || bd_ctby)) {
             int yp_pu = (y0 - 1) >> log2_min_pu_size;
             int yq_pu =  y0      >> log2_min_pu_size;
@@ -619,9 +619,9 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
     if (x0 > 0 && (x0 & 7) == 0) {
         int bd_ctbx = x0 & ((1 << s->sps->log2_ctb_size) - 1);
         int bd_slice = s->sh.slice_loop_filter_across_slices_enabled_flag ||
-                       !(lc->slice_or_tiles_left_boundary & 1);
+                       !(lc->boundary_flags & BOUNDARY_LEFT_SLICE);
         int bd_tiles = s->pps->loop_filter_across_tiles_enabled_flag ||
-                       !(lc->slice_or_tiles_left_boundary & 2);
+                       !(lc->boundary_flags & BOUNDARY_LEFT_TILE);
         if (((bd_slice && bd_tiles)  || bd_ctbx)) {
             int xp_pu = (x0 - 1) >> log2_min_pu_size;
             int xq_pu =  x0      >> log2_min_pu_size;