summaryrefslogtreecommitdiff
path: root/libavcodec/snow.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-29 22:06:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-29 22:52:04 +0200
commitc4224fff1b0ac3fb67daf5e36184afa609ce8f90 (patch)
tree4e65b0160b6cff79e56dccb8549d56f2ebbfd776 /libavcodec/snow.c
parentec120efaa90ac2232749b03e65900fdbabb77475 (diff)
downloadffmpeg-c4224fff1b0ac3fb67daf5e36184afa609ce8f90.tar.gz
avcodec/snow: gray support
Fixes Ticket839 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/snow.c')
-rw-r--r--libavcodec/snow.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 1c27ae2cf9..4ea82b35e9 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -491,7 +491,7 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
return AVERROR_INVALIDDATA;
}
- for(plane_index=0; plane_index<3; plane_index++){
+ for(plane_index=0; plane_index < s->nb_planes; plane_index++){
int w= s->avctx->width;
int h= s->avctx->height;
@@ -549,7 +549,7 @@ fail:
static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){
int p,x,y;
- for(p=0; p<3; p++){
+ for(p=0; p < s->nb_planes; p++){
int is_chroma= !!p;
int w= is_chroma ? s->avctx->width >>s->chroma_h_shift : s->avctx->width;
int h= is_chroma ? s->avctx->height>>s->chroma_v_shift : s->avctx->height;
@@ -614,12 +614,14 @@ int ff_snow_frame_start(SnowContext *s){
s->dsp.draw_edges(s->current_picture->data[0],
s->current_picture->linesize[0], w , h ,
EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM);
- s->dsp.draw_edges(s->current_picture->data[1],
- s->current_picture->linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift,
- EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);
- s->dsp.draw_edges(s->current_picture->data[2],
- s->current_picture->linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift,
- EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);
+ if (s->current_picture->data[2]) {
+ s->dsp.draw_edges(s->current_picture->data[1],
+ s->current_picture->linesize[1], w>>s->chroma_h_shift, h>>s->chroma_v_shift,
+ EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture->data[2],
+ s->current_picture->linesize[2], w>>s->chroma_h_shift, h>>s->chroma_v_shift,
+ EDGE_WIDTH>>s->chroma_h_shift, EDGE_WIDTH>>s->chroma_v_shift, EDGE_TOP | EDGE_BOTTOM);
+ }
}
ff_snow_release_buffer(s->avctx);
@@ -686,7 +688,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
av_frame_free(&s->last_picture[i]);
}
- for(plane_index=0; plane_index<3; plane_index++){
+ for(plane_index=0; plane_index < s->nb_planes; plane_index++){
for(level=s->spatial_decomposition_count-1; level>=0; level--){
for(orientation=level ? 1 : 0; orientation<4; orientation++){
SubBand *b= &s->plane[plane_index].band[level][orientation];