diff mbox series

[FFmpeg-devel,2/4] avfilter/vf_hflip: add support for packed rgb float formats

Message ID 20220929180841.614-3-mindmark@gmail.com
State New
Headers show
Series swscale rgbaf32 input/output support | expand

Commit Message

Mark Reid Sept. 29, 2022, 6:08 p.m. UTC
From: Mark Reid <mindmark@gmail.com>

---
 libavfilter/vf_hflip_init.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h
index d0319f463d..31173f73fc 100644
--- a/libavfilter/vf_hflip_init.h
+++ b/libavfilter/vf_hflip_init.h
@@ -86,6 +86,29 @@  static void hflip_qword_c(const uint8_t *ssrc, uint8_t *ddst, int w)
         dst[j] = src[-j];
 }
 
+static void hflip_b96_c(const uint8_t *ssrc, uint8_t *ddst, int w)
+{
+    const uint32_t *in = (const uint32_t *)ssrc;
+    uint32_t *out = (uint32_t *)ddst;
+
+    for (int j = 0; j < w; j++, out += 3, in -= 3) {
+        out[0] = in[0];
+        out[1] = in[1];
+        out[2] = in[2];
+    }
+}
+
+static void hflip_b128_c(const uint8_t *ssrc, uint8_t *ddst, int w)
+{
+    const uint64_t *in = (const uint64_t *)ssrc;
+    uint64_t *out = (uint64_t *)ddst;
+
+    for (int j = 0; j < w; j++, out += 2, in -= 2) {
+        out[0] = in[0];
+        out[1] = in[1];
+    }
+}
+
 static av_unused int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
 {
     for (int i = 0; i < nb_planes; i++) {
@@ -97,6 +120,8 @@  static av_unused int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
         case 4: s->flip_line[i] = hflip_dword_c; break;
         case 6: s->flip_line[i] = hflip_b48_c;   break;
         case 8: s->flip_line[i] = hflip_qword_c; break;
+        case 12: s->flip_line[i] = hflip_b96_c; break;
+        case 16: s->flip_line[i] = hflip_b128_c; break;
         default:
             return AVERROR_BUG;
         }