[FFmpeg-soc] [soc]: r860 - dirac/libavcodec/dirac.c

Aurelien Jacobs aurel at gnuage.org
Thu Aug 16 15:01:10 CEST 2007


On Thu, 16 Aug 2007 14:45:07 +0200 (CEST)
marco <subversion at mplayerhq.hu> wrote:

> Author: marco
> Date: Thu Aug 16 14:45:07 2007
> New Revision: 860
> 
> Log:
> replace chroma hratio/vratio by hshift/vshift
> 
> Modified:
>    dirac/libavcodec/dirac.c
> 
> Modified: dirac/libavcodec/dirac.c
> ==============================================================================
> --- dirac/libavcodec/dirac.c	(original)
> +++ dirac/libavcodec/dirac.c	Thu Aug 16 14:45:07 2007
> @@ -261,8 +261,8 @@ typedef struct DiracContext {
>      int padded_chroma_width;  ///< padded chroma width
>      int padded_chroma_height; ///< padded chroma height
>  
> -    int chroma_hratio;        ///< horizontal ratio of choma
> -    int chroma_vratio;        ///< vertical ratio of choma
> +    int chroma_hshift;        ///< horizontal bits to shift for choma
> +    int chroma_vshift;        ///< vertical bits to shift for choma
>  
>      int blwidth;              ///< number of blocks (horizontally)
>      int blheight;             ///< number of blocks (vertically)
> @@ -423,10 +423,10 @@ static void parse_sequence_parameters(Di
>          s->sequence.chroma_format = svq3_get_ue_golomb(gb);
>  
>      /* Calculate the chroma dimensions.  */
> -    s->chroma_hratio = 1 + (s->sequence.chroma_format > 1);
> -    s->chroma_vratio = 1 + (s->sequence.chroma_format > 0);
> -    s->sequence.chroma_width  = s->sequence.luma_width  / s->chroma_hratio;
> -    s->sequence.chroma_height = s->sequence.luma_height / s->chroma_vratio;
> +    s->chroma_hshift = (s->sequence.chroma_format == 0 ? 0 : 1);
> +    s->chroma_vshift = (s->sequence.chroma_format <= 1 ? 0 : 1);

No need for ?0:1
instead you could keep the original form:

    s->chroma_hshift = s->sequence.chroma_format > 0;
    s->chroma_vshift = s->sequence.chroma_format > 1;

Aurel



More information about the FFmpeg-soc mailing list