[FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO

Tobias Rapp t.rapp at noa-archive.com
Tue Oct 8 09:55:47 EEST 2024


On 07/10/2024 20:09, Niklas Haas wrote:

> On Mon, 07 Oct 2024 20:03:06 +0200 Michael Niedermayer <michael at niedermayer.cc> wrote:
>> On Mon, Oct 07, 2024 at 06:47:24PM +0200, Niklas Haas wrote:
>>> On Mon, 07 Oct 2024 00:15:32 +0200 Michael Niedermayer <michael at niedermayer.cc> wrote:
>>>> On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote:
>>>>> From: Niklas Haas <git at haasn.dev>
>>>>>
>>>>> This is done for consistency with the other public enums which will be
>>>>> added in the upcoming swscale API refactor. I went through the code and checked
>>>>> carefully that the value of `dither` is never implicitly compared against
>>>>> zero, so this change should not break anything.
>>>>>
>>>>> Sponsored-by: Sovereign Tech Fund
>>>>> Signed-off-by: Niklas Haas <git at haasn.dev>
>>>>> ---
>>>>>   libswscale/swscale_internal.h | 4 ++--
>>>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>> this breaks:
>>>>
>>>> ./ffmpeg -i lena.pnm -vf scale=iw:ih:flags=0x000002:sws_dither=0,format=bgr4_byte -bitexact whatever.bmp
>>> This is expected, of course. Are you saying that the change in consistency is
>>> not worth the risk of breaking users who directly specify numeric IDs instead
>>> of using the symbolic names?
>> iam not really sure what to do but
>> 0 has a feeling of "none" to me
> Well, I also wanted to add a "none" option to the enum, so maybe I can make
> that be the value of 0. I just think that it's weird for the default value of
> an enum option to be something other than 0, and the default should probably
> be "auto". (Otherwise, what's the point of the "auto" option?)

For some of the options in FFmpeg "auto" is mapped to -1, and the 
explicit options start at 0 (for example in wavenc.c RF64_AUTO=-1 / 
RF64_NEVER=0 / RF64_ALWAYS=1). You could do that here if you want to 
align "none" with zero.

Just my 2ct.

Regards, Tobias




More information about the ffmpeg-devel mailing list