[FFmpeg-devel] [PATCH] sws: add dither enum

Clément Bœsch u at pkh.me
Thu Aug 15 01:53:55 CEST 2013


On Wed, Aug 14, 2013 at 05:33:53PM +0200, Michael Niedermayer wrote:
> This allows specifying more dither algorithms without using up flags and
> without ambiguities.
> 
> Also initialize the new field based on the flags and use it
> 
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libswscale/options.c          |    6 ++++++
>  libswscale/output.c           |    6 +++---
>  libswscale/swscale.c          |    2 +-
>  libswscale/swscale_internal.h |    9 +++++++++
>  libswscale/swscale_unscaled.c |    2 +-
>  libswscale/utils.c            |   12 ++++++++----
>  libswscale/version.h          |    2 +-
>  7 files changed, 29 insertions(+), 10 deletions(-)
> 
> diff --git a/libswscale/options.c b/libswscale/options.c
> index 81d8c28..f7edd21 100644
> --- a/libswscale/options.c
> +++ b/libswscale/options.c
> @@ -69,6 +69,12 @@ static const AVOption swscale_options[] = {
>      { "dst_v_chr_pos",   "destination vertical chroma position in luma grid/256"  , OFFSET(dst_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1            }, -1,      512,             VE },
>      { "dst_h_chr_pos",   "destination horizontal chroma position in luma grid/256", OFFSET(dst_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1            }, -1,      512,             VE },
>  
> +    { "sws_dither",      "Dither algorithm",              OFFSET(dither),    AV_OPT_TYPE_INT,    { .i64  = SWS_DITHER_AUTO   }, 0,       1,              VE, "sws_dither" },

"set dithering algorithm"?

Also, the 0 → 1 range looks strange; 0, NB_SWS_DITHER looks more
appropriate.

> +    { "auto",            "leave choice to sws",           0,                 AV_OPT_TYPE_CONST,  { .i64  = SWS_DITHER_AUTO   }, INT_MIN, INT_MAX,        VE, "sws_dither" },

> +    { "off",             "no dither",                     0,                 AV_OPT_TYPE_CONST,  { .i64  = SWS_DITHER_NONE   }, INT_MIN, INT_MAX,        VE, "sws_dither" },

IIRC there is a builtin in the parse op to automatically recognize "none"
or similar.

Assuming that's not the case, I think it would be wise to use "none" here,
for consistency (and potential factoring later).

> +    { "bayer",           "bayer dither",                  0,                 AV_OPT_TYPE_CONST,  { .i64  = SWS_DITHER_BAYER  }, INT_MIN, INT_MAX,        VE, "sws_dither" },
> +    { "ed",              "error diffusion",               0,                 AV_OPT_TYPE_CONST,  { .i64  = SWS_DITHER_ED     }, INT_MIN, INT_MAX,        VE, "sws_dither" },
> +
>      { NULL }
>  };
>  
[...]

'Can't really comment on the rest.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130815/dd00b695/attachment.asc>


More information about the ffmpeg-devel mailing list