diff mbox series

[FFmpeg-devel,1/3] swscale: don't assign range converters for float

Message ID 20231113153234.8812-1-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,1/3] swscale: don't assign range converters for float | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Niklas Haas Nov. 13, 2023, 3:32 p.m. UTC
From: Niklas Haas <git@haasn.dev>

This logic was incongruent with logic used elsewhere, where floating
point formats are explicitly exempted from range conversion. Fixes an
issue where floating point formats were not going through special
unscaled converters even when it was otherwise possible.
---
 libswscale/swscale.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chen, Wenbin Nov. 14, 2023, 2:27 a.m. UTC | #1
> From: Niklas Haas <git@haasn.dev>
> 
> This logic was incongruent with logic used elsewhere, where floating
> point formats are explicitly exempted from range conversion. Fixes an
> issue where floating point formats were not going through special
> unscaled converters even when it was otherwise possible.
> ---
>  libswscale/swscale.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> index 46ba68fe6a..a66db22767 100644
> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -534,7 +534,8 @@ av_cold void ff_sws_init_range_convert(SwsContext
> *c)
>  {
>      c->lumConvertRange = NULL;
>      c->chrConvertRange = NULL;
> -    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
> +    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
> +        !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) {
>          if (c->dstBpc <= 14) {
>              if (c->srcRange) {
>                  c->lumConvertRange = lumRangeFromJpeg_c;
> --
> 2.42.0
> 

This patchset works for me. Thanks for your quick fixing.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Chen, Wenbin Nov. 27, 2023, 2:10 a.m. UTC | #2
> > From: Niklas Haas <git@haasn.dev>
> >
> > This logic was incongruent with logic used elsewhere, where floating
> > point formats are explicitly exempted from range conversion. Fixes an
> > issue where floating point formats were not going through special
> > unscaled converters even when it was otherwise possible.
> > ---
> >  libswscale/swscale.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> > index 46ba68fe6a..a66db22767 100644
> > --- a/libswscale/swscale.c
> > +++ b/libswscale/swscale.c
> > @@ -534,7 +534,8 @@ av_cold void ff_sws_init_range_convert(SwsContext
> > *c)
> >  {
> >      c->lumConvertRange = NULL;
> >      c->chrConvertRange = NULL;
> > -    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
> > +    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
> > +        !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) {
> >          if (c->dstBpc <= 14) {
> >              if (c->srcRange) {
> >                  c->lumConvertRange = lumRangeFromJpeg_c;
> > --
> > 2.42.0
> >
> 
> This patchset works for me. Thanks for your quick fixing.

Ping. When can this patchset be merged?

Thanks
Wenbin 
> 
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Chen, Wenbin Dec. 12, 2023, 7:54 a.m. UTC | #3
> > > From: Niklas Haas <git@haasn.dev>
> > >
> > > This logic was incongruent with logic used elsewhere, where floating
> > > point formats are explicitly exempted from range conversion. Fixes an
> > > issue where floating point formats were not going through special
> > > unscaled converters even when it was otherwise possible.
> > > ---
> > >  libswscale/swscale.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> > > index 46ba68fe6a..a66db22767 100644
> > > --- a/libswscale/swscale.c
> > > +++ b/libswscale/swscale.c
> > > @@ -534,7 +534,8 @@ av_cold void
> ff_sws_init_range_convert(SwsContext
> > > *c)
> > >  {
> > >      c->lumConvertRange = NULL;
> > >      c->chrConvertRange = NULL;
> > > -    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
> > > +    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
> > > +        !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) {
> > >          if (c->dstBpc <= 14) {
> > >              if (c->srcRange) {
> > >                  c->lumConvertRange = lumRangeFromJpeg_c;
> > > --
> > > 2.42.0
> > >
> >
> > This patchset works for me. Thanks for your quick fixing.
> 
> Ping. When can this patchset be merged?
> 
> Thanks
> Wenbin

Anyone who can help to merge this patchset?

Thanks
Wenbin

> >
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Niklas Haas Jan. 10, 2024, 1:15 p.m. UTC | #4
On Mon, 27 Nov 2023 02:10:11 +0000 "Chen, Wenbin" <wenbin.chen-at-intel.com@ffmpeg.org> wrote:
> > > From: Niklas Haas <git@haasn.dev>
> > >
> > > This logic was incongruent with logic used elsewhere, where floating
> > > point formats are explicitly exempted from range conversion. Fixes an
> > > issue where floating point formats were not going through special
> > > unscaled converters even when it was otherwise possible.
> > > ---
> > >  libswscale/swscale.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> > > index 46ba68fe6a..a66db22767 100644
> > > --- a/libswscale/swscale.c
> > > +++ b/libswscale/swscale.c
> > > @@ -534,7 +534,8 @@ av_cold void ff_sws_init_range_convert(SwsContext
> > > *c)
> > >  {
> > >      c->lumConvertRange = NULL;
> > >      c->chrConvertRange = NULL;
> > > -    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
> > > +    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
> > > +        !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) {
> > >          if (c->dstBpc <= 14) {
> > >              if (c->srcRange) {
> > >                  c->lumConvertRange = lumRangeFromJpeg_c;
> > > --
> > > 2.42.0
> > >
> > 
> > This patchset works for me. Thanks for your quick fixing.
> 
> Ping. When can this patchset be merged?

Hi, do you still need this patch, now that YUV negotiation means
vf_scale no longer changes the filter range dynamically?

> 
> Thanks
> Wenbin 
> > 
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Chen, Wenbin Jan. 11, 2024, 2:59 a.m. UTC | #5
> On Mon, 27 Nov 2023 02:10:11 +0000 "Chen, Wenbin" <wenbin.chen-at-
> intel.com@ffmpeg.org> wrote:
> > > > From: Niklas Haas <git@haasn.dev>
> > > >
> > > > This logic was incongruent with logic used elsewhere, where floating
> > > > point formats are explicitly exempted from range conversion. Fixes an
> > > > issue where floating point formats were not going through special
> > > > unscaled converters even when it was otherwise possible.
> > > > ---
> > > >  libswscale/swscale.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> > > > index 46ba68fe6a..a66db22767 100644
> > > > --- a/libswscale/swscale.c
> > > > +++ b/libswscale/swscale.c
> > > > @@ -534,7 +534,8 @@ av_cold void
> ff_sws_init_range_convert(SwsContext
> > > > *c)
> > > >  {
> > > >      c->lumConvertRange = NULL;
> > > >      c->chrConvertRange = NULL;
> > > > -    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
> > > > +    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
> > > > +        !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) {
> > > >          if (c->dstBpc <= 14) {
> > > >              if (c->srcRange) {
> > > >                  c->lumConvertRange = lumRangeFromJpeg_c;
> > > > --
> > > > 2.42.0
> > > >
> > >
> > > This patchset works for me. Thanks for your quick fixing.
> >
> > Ping. When can this patchset be merged?
> 
> Hi, do you still need this patch, now that YUV negotiation means
> vf_scale no longer changes the filter range dynamically?

The problem is not solved.
Command " ffmpeg -i input.png -vf format=grayf32,format=gray8 output.png " still reports
error: "Assertion c->srcBpc == 16 failed at libswscale/x86/swscale.c:533"
After I add --disable-sse2, the problem is unseen.

> 
> >
> > Thanks
> > Wenbin
> > >
> > > > _______________________________________________
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel@ffmpeg.org
> > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > >
> > > > To unsubscribe, visit link above, or email
> > > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 46ba68fe6a..a66db22767 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -534,7 +534,8 @@  av_cold void ff_sws_init_range_convert(SwsContext *c)
 {
     c->lumConvertRange = NULL;
     c->chrConvertRange = NULL;
-    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
+    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
+        !isFloat(c->srcFormat) && !isFloat(c->dstFormat)) {
         if (c->dstBpc <= 14) {
             if (c->srcRange) {
                 c->lumConvertRange = lumRangeFromJpeg_c;