diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-23 22:10:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-23 22:11:51 +0100 |
commit | a2e4b23bfe2d3c358f83894df4345d912ec6b8fc (patch) | |
tree | ed0177b8bf323e3a2484d77a8001d726513fc647 /libavcodec | |
parent | c2b5981afa4e27bbc374354e1054df4cb437b909 (diff) | |
parent | ff486c0f7f6b2ace3f0238660bc06cc35b389676 (diff) | |
download | ffmpeg-a2e4b23bfe2d3c358f83894df4345d912ec6b8fc.tar.gz |
Merge commit 'ff486c0f7f6b2ace3f0238660bc06cc35b389676'
* commit 'ff486c0f7f6b2ace3f0238660bc06cc35b389676':
hevc: Do not right shift a negative value in get_pcm
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/hevc_filter.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 165da91dd0..443f2223cb 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -283,11 +283,15 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) static int get_pcm(HEVCContext *s, int x, int y) { int log2_min_pu_size = s->sps->log2_min_pu_size; - int x_pu = x >> log2_min_pu_size; - int y_pu = y >> log2_min_pu_size; + int x_pu, y_pu; - if (x < 0 || x_pu >= s->sps->min_pu_width || - y < 0 || y_pu >= s->sps->min_pu_height) + if (x < 0 || y < 0) + return 2; + + x_pu = x >> log2_min_pu_size; + y_pu = y >> log2_min_pu_size; + + if (x_pu >= s->sps->min_pu_width || y_pu >= s->sps->min_pu_height) return 2; return s->is_pcm[y_pu * s->sps->min_pu_width + x_pu]; } |