diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-26 20:44:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-26 20:52:06 +0200 |
commit | e059ac59efb8001494870af5c6ac72d900846b0b (patch) | |
tree | 88efcb81e650af20b1c80db5fadb185a2757729f | |
parent | 932be89c26d71244a5d78378c2c32a826ed6a31e (diff) | |
download | ffmpeg-e059ac59efb8001494870af5c6ac72d900846b0b.tar.gz |
avcodec/snow: ensure the buffers have allocated edges
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/snow.c | 11 | ||||
-rw-r--r-- | libavcodec/snowenc.c | 12 |
2 files changed, 21 insertions, 2 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index bd20388847..616d1170af 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -661,9 +661,18 @@ int ff_snow_frame_start(SnowContext *s){ return -1; } } - + s->current_picture->width = s->avctx->width + 2 * EDGE_WIDTH; + s->current_picture->height = s->avctx->height + 2 * EDGE_WIDTH; if ((ret = ff_get_buffer(s->avctx, s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; + for (i = 0; s->current_picture->data[i]; i++) { + int offset = (EDGE_WIDTH >> (i ? s->chroma_v_shift : 0)) * + s->current_picture->linesize[i] + + (EDGE_WIDTH >> (i ? s->chroma_h_shift : 0)); + s->current_picture->data[i] += offset; + } + s->current_picture->width = s->avctx->width; + s->current_picture->height = s->avctx->height; s->current_picture->key_frame= s->keyframe; diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 167b205cba..d14b88e35e 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -37,6 +37,7 @@ static av_cold int encode_init(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; int plane_index, ret; + int i; if(avctx->prediction_method == DWT_97 && (avctx->flags & CODEC_FLAG_QSCALE) @@ -124,11 +125,20 @@ static av_cold int encode_init(AVCodecContext *avctx) s->input_picture = av_frame_alloc(); if (!s->input_picture) return AVERROR(ENOMEM); + s->input_picture->width = s->avctx->width + 2 * EDGE_WIDTH; + s->input_picture->height = s->avctx->height + 2 * EDGE_WIDTH; if ((ret = ff_get_buffer(s->avctx, s->input_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; + for (i = 0; s->input_picture->data[i]; i++) { + int offset = (EDGE_WIDTH >> (i ? s->chroma_v_shift : 0)) * + s->input_picture->linesize[i] + + (EDGE_WIDTH >> (i ? s->chroma_h_shift : 0)); + s->input_picture->data[i] += offset; + } + s->input_picture->width = s->avctx->width; + s->input_picture->height = s->avctx->height; if(s->avctx->me_method == ME_ITER){ - int i; int size= s->b_width * s->b_height << 2*s->block_max_depth; for(i=0; i<s->max_ref_frames; i++){ s->ref_mvs[i]= av_mallocz_array(size, sizeof(int16_t[2])); |