Commit 7517e932 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/snow: fix support for odd dimensions

Fixes Ticket3914
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a089d567
...@@ -535,8 +535,8 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { ...@@ -535,8 +535,8 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
int h= s->avctx->height; int h= s->avctx->height;
if(plane_index){ if(plane_index){
w>>= s->chroma_h_shift; w = FF_CEIL_RSHIFT(w, s->chroma_h_shift);
h>>= s->chroma_v_shift; h = FF_CEIL_RSHIFT(h, s->chroma_v_shift);
} }
s->plane[plane_index].width = w; s->plane[plane_index].width = w;
s->plane[plane_index].height= h; s->plane[plane_index].height= h;
...@@ -590,8 +590,8 @@ static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *fra ...@@ -590,8 +590,8 @@ static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *fra
for(p=0; p < s->nb_planes; p++){ for(p=0; p < s->nb_planes; p++){
int is_chroma= !!p; int is_chroma= !!p;
int w= is_chroma ? s->avctx->width >>s->chroma_h_shift : s->avctx->width; int w= is_chroma ? FF_CEIL_RSHIFT(s->avctx->width, s->chroma_h_shift) : s->avctx->width;
int h= is_chroma ? s->avctx->height>>s->chroma_v_shift : s->avctx->height; int h= is_chroma ? FF_CEIL_RSHIFT(s->avctx->height, s->chroma_v_shift) : s->avctx->height;
int ls= frame->linesize[p]; int ls= frame->linesize[p];
uint8_t *src= frame->data[p]; uint8_t *src= frame->data[p];
......
...@@ -1565,12 +1565,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -1565,12 +1565,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
for(i=0; i < s->nb_planes; i++){ for(i=0; i < s->nb_planes; i++){
int hshift= i ? s->chroma_h_shift : 0; int hshift= i ? s->chroma_h_shift : 0;
int vshift= i ? s->chroma_v_shift : 0; int vshift= i ? s->chroma_v_shift : 0;
for(y=0; y<(height>>vshift); y++) for(y=0; y<FF_CEIL_RSHIFT(height, vshift); y++)
memcpy(&s->input_picture->data[i][y * s->input_picture->linesize[i]], memcpy(&s->input_picture->data[i][y * s->input_picture->linesize[i]],
&pict->data[i][y * pict->linesize[i]], &pict->data[i][y * pict->linesize[i]],
width>>hshift); FF_CEIL_RSHIFT(width, hshift));
s->mpvencdsp.draw_edges(s->input_picture->data[i], s->input_picture->linesize[i], s->mpvencdsp.draw_edges(s->input_picture->data[i], s->input_picture->linesize[i],
width >> hshift, height >> vshift, FF_CEIL_RSHIFT(width, hshift), FF_CEIL_RSHIFT(height, vshift),
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM); EDGE_TOP | EDGE_BOTTOM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment