They are not common. Furthermore, this file is pulled in when linking checkasm and up until now, the calls to ff_get_buffer() and av_codec_is_decoder() caused all of libavcodec to be pulled in as well. Besides being bad size-wise this also has the downside that it pulls in avpriv_(cga|vga16)_font from libavutil which are marked as being imported from another library when building libavcodec as a DLL; this breaks checkasm because it links both lavc and lavu statically.
Unified · Split
| @@ -21,7 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | #include "libavutil/log.h" |
| 22 | 22 | #include "libavutil/thread.h" |
| 23 | 23 | #include "avcodec.h" |
| 24 | −#include "decode.h" | |
| 25 | 24 | #include "snow_dwt.h" |
| 26 | 25 | #include "snow.h" |
| 27 | 26 | #include "snowdata.h" |
| @@ -476,27 +475,15 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ · 448 unmodified lines | ||
| 476 | 475 | int ff_snow_common_init_after_header(AVCodecContext *avctx) { |
| 477 | 476 | SnowContext *s = avctx->priv_data; |
| 478 | 477 | int plane_index, level, orientation; |
| 479 | − int ret, emu_buf_size; | |
| 480 | 478 | |
| 481 | 479 | if(!s->scratchbuf) { |
| 482 | − if (av_codec_is_decoder(avctx->codec)) { | |
| 483 | − if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, | |
| 484 | − AV_GET_BUFFER_FLAG_REF)) < 0) | |
| 485 | − return ret; | |
| 486 | − } | |
| 487 | − | |
| 480 | + int emu_buf_size; | |
| 488 | 481 | emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); |
| 489 | 482 | if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) || |
| 490 | 483 | !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size)) |
| 491 | 484 | return AVERROR(ENOMEM); |
| 492 | 485 | } |
| 493 | 486 | |
| 494 | − if (av_codec_is_decoder(avctx->codec) && | |
| 495 | − s->mconly_picture->format != avctx->pix_fmt) { | |
| 496 | − av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); | |
| 497 | − return AVERROR_INVALIDDATA; | |
| 498 | − } | |
| 499 | − | |
| 500 | 487 | for(plane_index=0; plane_index < s->nb_planes; plane_index++){ |
| 501 | 488 | int w= s->avctx->width; |
| 502 | 489 | int h= s->avctx->height; |
| @@ -455,6 +455,17 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 454 unmodified lines | ||
| 455 | 455 | s->current_picture->pict_type= AV_PICTURE_TYPE_I; //FIXME I vs. P |
| 456 | 456 | if ((res = decode_header(s)) < 0) |
| 457 | 457 | return res; |
| 458 | + | |
| 459 | + if (!s->mconly_picture->data[0]) { | |
| 460 | + res = ff_get_buffer(avctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF); | |
| 461 | + if (res < 0) | |
| 462 | + return res; | |
| 463 | + } | |
| 464 | + if (s->mconly_picture->format != avctx->pix_fmt) { | |
| 465 | + av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); | |
| 466 | + return AVERROR_INVALIDDATA; | |
| 467 | + } | |
| 468 | + | |
| 458 | 469 | if ((res=ff_snow_common_init_after_header(avctx)) < 0) |
| 459 | 470 | return res; |
| 460 | 471 | |