diff mbox series

[FFmpeg-devel] libavcodec/exr.c: Made channel name comparisons case insensitive.

Message ID 1579470544-23468-1-git-send-email-ggarra13@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel] libavcodec/exr.c: Made channel name comparisons case insensitive.
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Gonzalo Garramuño Jan. 19, 2020, 9:49 p.m. UTC
From: Gonzalo Garramuño <ggarra13@gmail.com>

---
 libavcodec/exr.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Paul B Mahol Jan. 19, 2020, 10 p.m. UTC | #1
I doubt this is good.

On 1/19/20, ggarra13@gmail.com <ggarra13@gmail.com> wrote:
> From: Gonzalo Garramuño <ggarra13@gmail.com>
>
> ---
>  libavcodec/exr.c |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/libavcodec/exr.c b/libavcodec/exr.c
> index aeeaed4..49250dd 100644
> --- a/libavcodec/exr.c
> +++ b/libavcodec/exr.c
> @@ -41,6 +41,7 @@
>  #include "libavutil/common.h"
>  #include "libavutil/imgutils.h"
>  #include "libavutil/intfloat.h"
> +#include "libavutil/avstring.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/color_utils.h"
>
> @@ -1399,24 +1400,24 @@ static int decode_header(EXRContext *s, AVFrame
> *frame)
>                  }
>
>                  if (layer_match) { /* only search channel if the layer
> match is valid */
> -                    if (!strcmp(ch_gb.buffer, "R") ||
> -                        !strcmp(ch_gb.buffer, "X") ||
> -                        !strcmp(ch_gb.buffer, "U")) {
> +                    if (!av_strcasecmp(ch_gb.buffer, "R") ||
> +                        !av_strcasecmp(ch_gb.buffer, "X") ||
> +                        !av_strcasecmp(ch_gb.buffer, "U")) {
>                          channel_index = 0;
>                          s->is_luma = 0;
> -                    } else if (!strcmp(ch_gb.buffer, "G") ||
> -                               !strcmp(ch_gb.buffer, "V")) {
> +                    } else if (!av_strcasecmp(ch_gb.buffer, "G") ||
> +                               !av_strcasecmp(ch_gb.buffer, "V")) {
>                          channel_index = 1;
>                          s->is_luma = 0;
> -                    } else if (!strcmp(ch_gb.buffer, "Y")) {
> +                    } else if (!av_strcasecmp(ch_gb.buffer, "Y")) {
>                          channel_index = 1;
>                          s->is_luma = 1;
> -                    } else if (!strcmp(ch_gb.buffer, "B") ||
> -                               !strcmp(ch_gb.buffer, "Z") ||
> -                               !strcmp(ch_gb.buffer, "W")){
> +                    } else if (!av_strcasecmp(ch_gb.buffer, "B") ||
> +                               !av_strcasecmp(ch_gb.buffer, "Z") ||
> +                               !av_strcasecmp(ch_gb.buffer, "W")){
>                                 channel_index = 2;
>                          s->is_luma = 0;
> -                    } else if (!strcmp(ch_gb.buffer, "A")) {
> +                    } else if (!av_strcasecmp(ch_gb.buffer, "A")) {
>                          channel_index = 3;
>                      } else {
>                          av_log(s->avctx, AV_LOG_WARNING,
> --
> 1.7.9.5
>
> _______________________________________________
> 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".
Gonzalo Garramuño Jan. 19, 2020, 10:31 p.m. UTC | #2
El 19/01/20 a las 19:00, Paul B Mahol escribió:
> I doubt this is good.
Why?  I have images created out of Houdini that do not follow the 
uppercase convention used in the exr.c decoder.  The layers cannot be 
read unless the pattern matches layers like: indirect_diffuse.r.
diff mbox series

Patch

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index aeeaed4..49250dd 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -41,6 +41,7 @@ 
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intfloat.h"
+#include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 #include "libavutil/color_utils.h"
 
@@ -1399,24 +1400,24 @@  static int decode_header(EXRContext *s, AVFrame *frame)
                 }
 
                 if (layer_match) { /* only search channel if the layer match is valid */
-                    if (!strcmp(ch_gb.buffer, "R") ||
-                        !strcmp(ch_gb.buffer, "X") ||
-                        !strcmp(ch_gb.buffer, "U")) {
+                    if (!av_strcasecmp(ch_gb.buffer, "R") ||
+                        !av_strcasecmp(ch_gb.buffer, "X") ||
+                        !av_strcasecmp(ch_gb.buffer, "U")) {
                         channel_index = 0;
                         s->is_luma = 0;
-                    } else if (!strcmp(ch_gb.buffer, "G") ||
-                               !strcmp(ch_gb.buffer, "V")) {
+                    } else if (!av_strcasecmp(ch_gb.buffer, "G") ||
+                               !av_strcasecmp(ch_gb.buffer, "V")) {
                         channel_index = 1;
                         s->is_luma = 0;
-                    } else if (!strcmp(ch_gb.buffer, "Y")) {
+                    } else if (!av_strcasecmp(ch_gb.buffer, "Y")) {
                         channel_index = 1;
                         s->is_luma = 1;
-                    } else if (!strcmp(ch_gb.buffer, "B") ||
-                               !strcmp(ch_gb.buffer, "Z") ||
-                               !strcmp(ch_gb.buffer, "W")){
+                    } else if (!av_strcasecmp(ch_gb.buffer, "B") ||
+                               !av_strcasecmp(ch_gb.buffer, "Z") ||
+                               !av_strcasecmp(ch_gb.buffer, "W")){
                                channel_index = 2;
                         s->is_luma = 0;
-                    } else if (!strcmp(ch_gb.buffer, "A")) {
+                    } else if (!av_strcasecmp(ch_gb.buffer, "A")) {
                         channel_index = 3;
                     } else {
                         av_log(s->avctx, AV_LOG_WARNING,