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

mindmark at gmail.com mindmark at gmail.com
Mon Oct 31 02:32:33 EET 2022


From: Mark Reid <mindmark at gmail.com>

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

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;
         }
-- 
2.31.1.windows.1



More information about the ffmpeg-devel mailing list