[FFmpeg-devel] [PATCH] avfilter/lut: simplify endianness specific code

James Almer jamrial at gmail.com
Sat Sep 16 20:18:34 EEST 2017


---
 libavfilter/vf_lut.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 11c039ead7..2e0dedb730 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -372,17 +372,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             for (j = 0; j < w; j++) {
 
                 switch (step) {
-#if HAVE_BIGENDIAN
-                case 4:  outrow[3] = av_bswap16(tab[3][av_bswap16(inrow[3])]); // Fall-through
-                case 3:  outrow[2] = av_bswap16(tab[2][av_bswap16(inrow[2])]); // Fall-through
-                case 2:  outrow[1] = av_bswap16(tab[1][av_bswap16(inrow[1])]); // Fall-through
-                default: outrow[0] = av_bswap16(tab[0][av_bswap16(inrow[0])]);
-#else
-                case 4:  outrow[3] = tab[3][inrow[3]]; // Fall-through
-                case 3:  outrow[2] = tab[2][inrow[2]]; // Fall-through
-                case 2:  outrow[1] = tab[1][inrow[1]]; // Fall-through
-                default: outrow[0] = tab[0][inrow[0]];
-#endif
+                case 4:  outrow[3] = av_le2ne16(tab[3][av_le2ne16(inrow[3])]); // Fall-through
+                case 3:  outrow[2] = av_le2ne16(tab[2][av_le2ne16(inrow[2])]); // Fall-through
+                case 2:  outrow[1] = av_le2ne16(tab[1][av_le2ne16(inrow[1])]); // Fall-through
+                default: outrow[0] = av_le2ne16(tab[0][av_le2ne16(inrow[0])]);
                 }
                 outrow += step;
                 inrow  += step;
@@ -437,11 +430,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
             for (i = 0; i < h; i++) {
                 for (j = 0; j < w; j++) {
-#if HAVE_BIGENDIAN
-                    outrow[j] = av_bswap16(tab[av_bswap16(inrow[j])]);
-#else
-                    outrow[j] = tab[inrow[j]];
-#endif
+                    outrow[j] = av_le2ne16(tab[av_le2ne16(inrow[j])]);
                 }
                 inrow  += in_linesize;
                 outrow += out_linesize;
-- 
2.13.3



More information about the ffmpeg-devel mailing list