[FFmpeg-devel] [WIP][RFC][PATCH] png: support for skiping decoding data

Michael Niedermayer michaelni at gmx.at
Mon Aug 12 13:46:11 CEST 2013


On Fri, Aug 09, 2013 at 01:40:39PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> 
> Crude attempt at parsing only frame and not doing decoding.
> It returns frames with data, not calling ff_get_video_buffer()
> gives error.
> Perhaps doing this from parser is better solution.
> 
> ---
>  libavcodec/pngdec.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 1358ac5..067948c 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -65,6 +65,7 @@ typedef struct PNGDecContext {
>      int pass_row_size; /* decompress row size of the current pass */
>      int y;
>      z_stream zstream;
> +    int decode_data;
>  } PNGDecContext;
>  
>  /* Mask to determine which pixels are valid in a pass */
> @@ -364,6 +365,11 @@ static int png_decode_idat(PNGDecContext *s, int length)
>      s->zstream.next_in  = (unsigned char *)s->gb.buffer;
>      bytestream2_skip(&s->gb, length);
>  
> +    if (!s->decode_data) {
> +        s->state |= PNG_ALLIMAGE;
> +        return 0;
> +    }
> +
>      /* decode one line if possible */
>      while (s->zstream.avail_in > 0) {
>          ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);
> @@ -512,6 +518,8 @@ static int decode_frame(AVCodecContext *avctx,
>      int64_t sig;
>      int ret;
>  
> +
> +    s->decode_data = !(avctx->skip_frame == AVDISCARD_ALL);

skip_frame is probably not what you want to use here because that
would normally skip te frame entirely and not output a AVFrame

a new field like skip_bitmap/skip_samples/skip_decoding or such
maybe could be added
or more hackish skip_top/bottom could be checked to detect cases
where the whole pictures content should be skiped

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130812/3faf9113/attachment.asc>


More information about the ffmpeg-devel mailing list