From 52e31420705ce968c5366a87cda330f13fde267e Mon Sep 17 00:00:00 2001 From: Brian Heng Date: Mon, 28 Sep 2015 10:56:45 -0700 Subject: [PATCH] Fix up-right intra prediction context Current handling of up-right pixel availability fails to deal with cases where some but not all up-right pixels are available. Specifically when the picture width is not an integer number of 64x64 super blocks. --- common/intra_prediction.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/common/intra_prediction.c b/common/intra_prediction.c index a1d1247..ebe48b0 100644 --- a/common/intra_prediction.c +++ b/common/intra_prediction.c @@ -296,7 +296,12 @@ void get_upright_pred(uint8_t *rec,int ypos,int xpos,int stride,int size,int wid } if (upright_available){ for (j=size;j<2*size;j++){ - ver[j] = rec[(ypos-1)*stride+xpos+j]; + if(xpos + j >= width) { + ver[j] = ver[j-1]; + } + else { + ver[j] = rec[(ypos-1)*stride+xpos+j]; + } } } else{ @@ -342,7 +347,12 @@ void get_upupright_pred(uint8_t *rec,int ypos,int xpos,int stride,int size,int w } if (upright_available){ for (j=size;j<2*size;j++){ - ver[j] = rec[(ypos-1)*stride+xpos+j]; + if(xpos + j >= width) { + ver[j] = ver[j-1]; + } + else { + ver[j] = rec[(ypos-1)*stride+xpos+j]; + } } } else{