And do not left shift a negative value while at it.

CC: libav-sta...@libav.org
---

Maybe this way looks nicer.


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

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index eb3f5f3..37cbbd4 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -485,11 +485,13 @@ 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;
+                    const int x_pos = x * (1 << s->sps->pixel_shift);
+                    const int y_pos = y * s->frame->linesize[chroma];

                     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_pos + x_pos) >> 1];
                     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