[Ffmpeg-devel] [patch] minor cleanup

Michael Niedermayer michaelni
Sat Apr 7 11:10:00 CEST 2007


Hi

On Sat, Apr 07, 2007 at 12:26:17AM -0700, Nicholas T wrote:
> Michael N suggested some general cleanup so junk doesn't get copied
> and pasted around. I know people hate it when multiple diffs are
> combined, but these are such minor issues, I hope it's okay. This
> really shouldn't break anything, though I honestly don't have time to
> test all of the codecs.
> 
> * Removed avctx->priv_data unneeded casts
> * Removed some empty functions
> * Removed all "has_b_frames = 0"
> * Fixed memory leaks with semi-allocated packets
> * removed unused copies of avctx in SomeDecoderContext

these must be in seperate patches, a single 90k patch combining 5 seperate
cleanups is too big


[...]
> @@ -528,7 +519,6 @@
>  
>      avctx->pix_fmt = PIX_FMT_PAL8;
>  
> -
>      /* decode huffman trees from extradata */

cosmetic


[...]
>          return 0;
>  }
>  
> -
> -
>  AVCodec eightbps_decoder = {

cosmetic

[...]


>  
>  static int seqvideo_decode_init(AVCodecContext *avctx)
>  {
> -    SeqVideoContext *seq = (SeqVideoContext *)avctx->priv_data;
> -
> -    seq->avctx = avctx;
> +    SeqVideoContext *seq = avctx->priv_data;
>      avctx->pix_fmt = PIX_FMT_PAL8;
> -    avctx->has_b_frames = 0;
> -
>      seq->frame.data[0] = NULL;
> -
>      return 0;
>  }


more cosmetics




[...]
> Index: libavcodec/ulti.c
> ===================================================================
> --- libavcodec/ulti.c	(revision 8638)
> +++ libavcodec/ulti.c	(working copy)
> @@ -36,8 +36,7 @@
>  #include "ulti_cb.h"
>  
>  typedef struct UltimotionDecodeContext {
> -    AVCodecContext *avctx;
> -    int width, height, blocks;
> +    int blocks;
>      AVFrame frame;
>      const uint8_t *ulti_codebook;
>  } UltimotionDecodeContext;
> @@ -46,10 +45,7 @@
>  {
>      UltimotionDecodeContext *s = avctx->priv_data;
>  
> -    s->avctx = avctx;
> -    s->width = avctx->width;
> -    s->height = avctx->height;
> -    s->blocks = (s->width / 8) * (s->height / 8);
> +    s->blocks = (avctx->width / 8) * (avctx->height / 8);
>      avctx->pix_fmt = PIX_FMT_YUV410P;

changes not mentioned in the summary



[...]
> @@ -392,7 +388,7 @@
>              }
>              blocks++;
>                  x += 8;
> -            if(x >= s->width) {
> +                if(x >= avctx->width) {
>                  x = 0;

wrong


[...]
>          pkt->stream_index = AUDIO_SID;
>  
> -    }else
> +    }
> +    else
>      {

even more cosmetics

[...]

>      ret= av_get_packet(&s->pb, pkt, packet_size);
>  
>      pkt->stream_index = 0;
> -    if (ret != packet_size) {
> +    if (ret != packet_size)
> +    {

and more cosmetics

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070407/624ebbd5/attachment.pgp>



More information about the ffmpeg-devel mailing list