---
 libavcodec/hevc_filter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index eb3f5f3..8f425d8 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -485,11 +485,17 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, 
int y0)
                 if ((bs0 == 2) || (bs1 == 2)) {
                     const int qp0 = bs0 == 2 ? (get_qPy(s, x,     y - 1) + 
get_qPy(s, x,     y) + 1) >> 1 : 0;
                     const int qp1 = bs1 == 2 ? (get_qPy(s, x + 8, y - 1) + 
get_qPy(s, x + 8, y) + 1) >> 1 : 0;
+                    int x_pos;
+
+                    if (x < 0)
+                        x_pos = -((-x / 2) << s->sps->pixel_shift);
+                    else
+                        x_pos = ((x / 2) << s->sps->pixel_shift);
 
                     tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
                     c_tc[0]   = bs0 == 2 ? chroma_tc(s, qp0, chroma, 
tc_offset)     : 0;
                     c_tc[1]   = bs1 == 2 ? chroma_tc(s, qp1, chroma, 
cur_tc_offset) : 0;
-                    src       = &s->frame->data[chroma][y / 2 * 
s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
+                    src       = &s->frame->data[chroma][y / 2 * 
s->frame->linesize[chroma] + x_pos];
                     if (pcmf) {
                         no_p[0] = get_pcm(s, x, y - 1);
                         no_p[1] = get_pcm(s, x + 8, y - 1);
-- 
1.8.5.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to