From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 1/2] swscale/input: add support for NV20
Date: Sun, 16 Mar 2025 17:56:08 -0300
Message-ID: <20250316205609.58465-1-jamrial@gmail.com> (raw)
Signed-off-by: James Almer <jamrial@gmail.com>
---
libswscale/format.c | 2 ++
libswscale/input.c | 37 +++++++++++++++++++++++++++----------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/libswscale/format.c b/libswscale/format.c
index c3ef499438..fd0269a23e 100644
--- a/libswscale/format.c
+++ b/libswscale/format.c
@@ -226,6 +226,8 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_Y216LE] = { 1, 1 },
[AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
[AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
+ [AV_PIX_FMT_NV20BE] = { 1, 0 },
+ [AV_PIX_FMT_NV20LE] = { 1, 0 },
[AV_PIX_FMT_P210BE] = { 1, 1 },
[AV_PIX_FMT_P210LE] = { 1, 1 },
[AV_PIX_FMT_P212BE] = { 1, 1 },
diff --git a/libswscale/input.c b/libswscale/input.c
index cab8de6d3f..aa3cfebc87 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -945,8 +945,9 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
nvXXtoUV_c(dstV, dstU, src1, width);
}
-#define p01x_uv_wrapper(bits, shift) \
- static void p0 ## bits ## LEToUV_c(uint8_t *dstU, uint8_t *dstV, \
+#define p01x_uv_wrapper(fmt, shift) \
+ static void fmt ## LEToUV ## _c(uint8_t *dstU, \
+ uint8_t *dstV, \
const uint8_t *unused0, \
const uint8_t *src1, \
const uint8_t *src2, int width, \
@@ -959,7 +960,8 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
} \
} \
\
- static void p0 ## bits ## BEToUV_c(uint8_t *dstU, uint8_t *dstV, \
+ static void fmt ## BEToUV ## _c(uint8_t *dstU, \
+ uint8_t *dstV, \
const uint8_t *unused0, \
const uint8_t *src1, \
const uint8_t *src2, int width, \
@@ -972,8 +974,9 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
} \
}
-#define p01x_wrapper(bits, shift) \
- static void p0 ## bits ## LEToY_c(uint8_t *dst, const uint8_t *src, \
+#define p01x_wrapper(fmt, shift) \
+ static void fmt ## LEToY ## _c(uint8_t *dst, \
+ const uint8_t *src, \
const uint8_t *unused1, \
const uint8_t *unused2, int width, \
uint32_t *unused, void *opq) \
@@ -984,7 +987,8 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
} \
} \
\
- static void p0 ## bits ## BEToY_c(uint8_t *dst, const uint8_t *src, \
+ static void fmt ## BEToY ## _c(uint8_t *dst, \
+ const uint8_t *src, \
const uint8_t *unused1, \
const uint8_t *unused2, int width, \
uint32_t *unused, void *opq) \
@@ -994,11 +998,12 @@ static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
} \
} \
- p01x_uv_wrapper(bits, shift)
+ p01x_uv_wrapper(fmt, shift)
-p01x_wrapper(10, 6)
-p01x_wrapper(12, 4)
-p01x_uv_wrapper(16, 0)
+p01x_wrapper(nv20, 0)
+p01x_wrapper(p010, 6)
+p01x_wrapper(p012, 4)
+p01x_uv_wrapper(p016, 0)
static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
int width, uint32_t *rgb2yuv, void *opq)
@@ -1910,11 +1915,17 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
case AV_PIX_FMT_XV48BE:
*chrToYV12 = read_xv48be_UV_c;
break;
+ case AV_PIX_FMT_NV20LE:
+ *chrToYV12 = nv20LEToUV_c;
+ break;
case AV_PIX_FMT_P010LE:
case AV_PIX_FMT_P210LE:
case AV_PIX_FMT_P410LE:
*chrToYV12 = p010LEToUV_c;
break;
+ case AV_PIX_FMT_NV20BE:
+ *chrToYV12 = nv20BEToUV_c;
+ break;
case AV_PIX_FMT_P010BE:
case AV_PIX_FMT_P210BE:
case AV_PIX_FMT_P410BE:
@@ -2468,11 +2479,17 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
case AV_PIX_FMT_BGRA64LE:
*lumToYV12 = bgr64LEToY_c;
break;
+ case AV_PIX_FMT_NV20LE:
+ *lumToYV12 = nv20LEToY_c;
+ break;
case AV_PIX_FMT_P010LE:
case AV_PIX_FMT_P210LE:
case AV_PIX_FMT_P410LE:
*lumToYV12 = p010LEToY_c;
break;
+ case AV_PIX_FMT_NV20BE:
+ *lumToYV12 = nv20BEToY_c;
+ break;
case AV_PIX_FMT_P010BE:
case AV_PIX_FMT_P210BE:
case AV_PIX_FMT_P410BE:
--
2.48.1
_______________________________________________
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".
next reply other threads:[~2025-03-16 20:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-16 20:56 James Almer [this message]
2025-03-16 20:56 ` [FFmpeg-devel] [PATCH 2/2] swscale/output: " James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250316205609.58465-1-jamrial@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git