On Thu, Nov 24, 2011 at 09:36:28PM -0800, Ronald S. Bultje wrote:
> Hi,
> 
> On Thu, Nov 24, 2011 at 9:29 PM, Kostya Shishkov
> <[email protected]> wrote:
> > On Thu, Nov 24, 2011 at 12:21:11PM -0800, Ronald S. Bultje wrote:
> >> isGray() is left as a FIXME for later.
> >> ---
> >>  libavutil/pixdesc.c           |    3 +--
> >>  libswscale/swscale_internal.h |    9 +++++++++
> >>  2 files changed, 10 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> >> index 2b5c2fd..3a830ba 100644
> >> --- a/libavutil/pixdesc.c
> >> +++ b/libavutil/pixdesc.c
> >> @@ -219,7 +219,6 @@ const AVPixFmtDescriptor 
> >> av_pix_fmt_descriptors[PIX_FMT_NB] = {
> >>          .comp = {
> >>              {0,0,1,0,7},        /* Y */
> >>          },
> >> -        .flags = PIX_FMT_PAL,
> >>      },
> >>      [PIX_FMT_MONOWHITE] = {
> >>          .name = "monow",
> >> @@ -567,7 +566,7 @@ const AVPixFmtDescriptor 
> >> av_pix_fmt_descriptors[PIX_FMT_NB] = {
> >>              {0,5,3,0,15},       /* G */
> >>              {0,5,5,0,15},       /* B */
> >>          },
> >> -        .flags = PIX_FMT_BE,
> >> +        .flags = PIX_FMT_RGB | PIX_FMT_BE,
> >>      },
> >>      [PIX_FMT_RGB48LE] = {
> >>          .name = "rgb48le",
> >> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> >> index b20e0a3..7bfdc7e 100644
> >> --- a/libswscale/swscale_internal.h
> >> +++ b/libswscale/swscale_internal.h
> >> @@ -552,9 +552,18 @@ const char *sws_format_name(enum PixelFormat format);
> >>  #define isRGB(x) \
> >>      (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
> >>
> >> +#if 0 // FIXME
> >>  #define isGray(x) \
> >>      (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
> >>       av_pix_fmt_descriptors[x].nb_components <= 2)
> >> +#else
> >> +#define isGray(x)       (           \
> >> +           (x)==PIX_FMT_GRAY8       \
> >> +        || (x)==PIX_FMT_Y400A      \
> >> +        || (x)==PIX_FMT_GRAY16BE    \
> >> +        || (x)==PIX_FMT_GRAY16LE    \
> >> +    )
> >> +#endif
> >>
> >>  #define isRGBinInt(x)   (           \
> >>             (x)==PIX_FMT_RGB48BE     \
> >> --
> >
> > I have a strong suspicion that
> > #define isGray(x) \
> >    (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
> >     !(av_pix_fmt_descriptors[x].flags & PIX_FMT_BITSTREAM) && \
> >       av_pix_fmt_descriptors[x].nb_components <= 2)
> >
> > would do the trick.
> > But I'm too lazy to test that claim :(
> 
> It does. But I don't think it's right as part of the longer-term
> effort of cleaning up swscale. monow/b is gray. All RGB workarounds
> that we do right now should die. I don't understand why monow/b is a
> RGB format according to swscale.
> 
> It appears to be because RGB is the only place that did dithering back
> in 2003 when this was written. That's barely a good reason to keep the
> architecture in place.

My guess is that SwScaler was oriented on YUV (kinda obvious from its internal
structure) so everything else should be treated as non-YUV (aka RGB).

Probably it's just bit-packed formats should be treated separately.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to