]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/hevcdsp_template.c
Merge commit '9d3b752fceb0f2a42cac7c2a1109b0629823c99f'
[ffmpeg] / libavcodec / hevcdsp_template.c
index d372c9a2a6bac05cdae9ab9b04502cd6171fcece..cec28e4550dc1229b23f15166050f420a01beeda 100644 (file)
@@ -325,12 +325,10 @@ static void FUNC(sao_band_filter_0)(uint8_t *_dst, uint8_t *_src,
     }
 }
 
-#define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
+#define CMP(a, b) (((a) > (b)) - ((a) < (b)))
 
-static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src,
-                                  ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao,
-                                  int width, int height,
-                                  int c_idx) {
+static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val,
+                                  int eo, int width, int height) {
 
     static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
     static const int8_t pos[4][2][2] = {
@@ -339,28 +337,24 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src,
         { { -1, -1 }, {  1, 1 } }, // 45 degree
         { {  1, -1 }, { -1, 1 } }, // 135 degree
     };
-    int16_t *sao_offset_val = sao->offset_val[c_idx];
-    int eo     = sao->eo_class[c_idx];
     pixel *dst = (pixel *)_dst;
     pixel *src = (pixel *)_src;
     int a_stride, b_stride;
-    int src_offset = 0;
-    int dst_offset = 0;
     int x, y;
-    stride_src /= sizeof(pixel);
+    ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel);
     stride_dst /= sizeof(pixel);
 
     a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src;
     b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src;
     for (y = 0; y < height; y++) {
         for (x = 0; x < width; x++) {
-            int diff0 = CMP(src[x + src_offset], src[x + src_offset + a_stride]);
-            int diff1 = CMP(src[x + src_offset], src[x + src_offset + b_stride]);
+            int diff0 = CMP(src[x], src[x + a_stride]);
+            int diff1 = CMP(src[x], src[x + b_stride]);
             int offset_val        = edge_idx[2 + diff0 + diff1];
-            dst[x + dst_offset] = av_clip_pixel(src[x + src_offset] + sao_offset_val[offset_val]);
+            dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]);
         }
-        src_offset += stride_src;
-        dst_offset += stride_dst;
+        src += stride_src;
+        dst += stride_dst;
     }
 }