[FFmpeg-devel] [PATCH] Move the filters table in postprocess.c to .rodata
Michael Niedermayer
michaelni
Tue Jan 8 20:16:47 CET 2008
On Tue, Jan 08, 2008 at 02:19:56PM +0100, Diego 'Flameeyes' Petten? wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
>
> > hmm the size of the struct after your change is 36 byte, that is not left
> > shift friendly ...
> > also 3 of the ints in the struct can be changed to uint8_t
> > with that the struct would be 28 byte
> > and if you would use bitfields you could get it to 24byte
>
> Okay new patch with the changes you suggested, it's down to 21 bytes.
> I haven't made shortName an array of two characters, as that most likely
> would slow down the code (and make it look worse) as it's used for
> comparison.
>
> I also moved the structure definition from postprocess_internal.h
> directly to postprocess.c as no other structure is declared with that type.
>
[...]
> -static struct PPFilter filters[]=
> +/**
> + * Postprocessing filter.
> + */
> +static const struct {
> + char shortName[3];
> + char longName[15];
> + uint8_t chromDefault:1; ///< is chrominance filtering on by default if this filter is manually activated
> + uint8_t minLumQuality:3; ///< minimum quality to turn luminance filtering on
> + uint8_t minChromQuality:4; ///< minimum quality to turn chrominance filtering on
> + uint8_t mask_log2; ///< log2 of the bitmask to turn this filter on
vertical align the doxy comments please
[...]
> --- a/libpostproc/postprocess_internal.h
> +++ b/libpostproc/postprocess_internal.h
> @@ -29,42 +29,65 @@
> #include "avutil.h"
> #include "postprocess.h"
>
> -#define V_DEBLOCK 0x01
> -#define H_DEBLOCK 0x02
> -#define DERING 0x04
> -#define LEVEL_FIX 0x08 ///< Brightness & Contrast
> -
> -#define LUM_V_DEBLOCK V_DEBLOCK // 1
> -#define LUM_H_DEBLOCK H_DEBLOCK // 2
> -#define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16
> -#define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32
> -#define LUM_DERING DERING // 4
> -#define CHROM_DERING (DERING<<4) // 64
> -#define LUM_LEVEL_FIX LEVEL_FIX // 8
> -#define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
> +#define V_DEBLOCK_LOG2 0
> +#define V_DEBLOCK ( 1 << V_DEBLOCK_LOG2 )
> +#define H_DEBLOCK_LOG2 1
> +#define H_DEBLOCK ( 1 << H_DEBLOCK_LOG2 )
> +#define DERING_LOG2 2
> +#define DERING ( 1 << DERING_LOG2 )
> +#define LEVEL_FIX_LOG2 3
> +#define LEVEL_FIX ( 1 << LEVEL_FIX_LOG2) ///< Brightness & Contrast
> +
> +#define LUM_V_DEBLOCK V_DEBLOCK // 1
> +#define LUM_H_DEBLOCK H_DEBLOCK // 2
> +#define CHRMO_V_DEBLOCK_LOG2 ( V_DEBLOCK_LOG2 + 4 )
> +#define CHROM_V_DEBLOCK ( 1 << CHRMO_V_DEBLOCK_LOG2 ) // 16
> +#define CHRMO_H_DEBLOCK_LOG2 ( H_DEBLOCK_LOG2 + 4 )
> +#define CHROM_H_DEBLOCK ( 1 << CHRMO_V_DEBLOCK_LOG2 ) // 32
> +#define LUM_DERING_LOG2 DERING_LOG2
> +#define LUM_DERING ( 1 << LUM_DERING_LOG2 ) // 4
> +#define CHROM_DERING_LOG2 ( DERING_LOG2 + 4 )
> +#define CHROM_DERING ( 1 << CHROM_DERING_LOG2 ) // 64
> +#define LUM_LEVEL_FIX_LOG2 LEVEL_FIX_LOG2
> +#define LUM_LEVEL_FIX ( 1 << LUM_LEVEL_FIX_LOG2 ) // 8
> +#define CHROM_LEVEL_FIX_LOG2 ( LEVEL_FIX_LOG2 + 4 )
> +#define CHROM_LEVEL_FIX ( 1 << CHROM_LEVEL_FIX_LOG2 ) // 128 (not implemented yet)
hmm, i think this mess doesnt justify the 3 bytes it avoids, sorry
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080108/62a06aea/attachment.pgp>
More information about the ffmpeg-devel
mailing list