* [FFmpeg-devel] [PATCH] avcodec/ffv1*: add more pixel formats support
@ 2023-09-28 19:54 Paul B Mahol
2023-09-29 16:22 ` Michael Niedermayer
0 siblings, 1 reply; 2+ messages in thread
From: Paul B Mahol @ 2023-09-28 19:54 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 10 bytes --]
Attached.
[-- Attachment #2: 0001-avcodec-ffv1-add-GBRAP14-GRAY14-YUVA422P12-YUVA444P1.patch --]
[-- Type: text/x-patch, Size: 4422 bytes --]
From 80e70d4cde1734b01809352d280f43a9d4ba79dc Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Thu, 28 Sep 2023 21:22:34 +0200
Subject: [PATCH] avcodec/ffv1*: add GBRAP14, GRAY14, YUVA422P12, YUVA444P12
formats support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
libavcodec/ffv1dec.c | 11 +++++++++++
libavcodec/ffv1enc.c | 9 +++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 54cf075b8f..cdf72a25dd 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -626,6 +626,9 @@ static int read_header(FFV1Context *f)
} else if (f->avctx->bits_per_raw_sample == 12) {
f->packed_at_lsb = 1;
f->avctx->pix_fmt = AV_PIX_FMT_GRAY12;
+ } else if (f->avctx->bits_per_raw_sample == 14) {
+ f->packed_at_lsb = 1;
+ f->avctx->pix_fmt = AV_PIX_FMT_GRAY14;
} else if (f->avctx->bits_per_raw_sample == 16) {
f->packed_at_lsb = 1;
f->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
@@ -690,6 +693,12 @@ static int read_header(FFV1Context *f)
case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUV422P12; break;
case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUV420P12; break;
}
+ } else if (f->avctx->bits_per_raw_sample == 12 && f->transparency) {
+ f->packed_at_lsb = 1;
+ switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
+ case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUVA444P12; break;
+ case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P12; break;
+ }
} else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency) {
f->packed_at_lsb = 1;
switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
@@ -734,6 +743,8 @@ static int read_header(FFV1Context *f)
f->avctx->pix_fmt = AV_PIX_FMT_GBRAP12;
else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP14;
+ else if (f->avctx->bits_per_raw_sample == 14 && f->transparency)
+ f->avctx->pix_fmt = AV_PIX_FMT_GBRAP14;
else if (f->avctx->bits_per_raw_sample == 16 && !f->transparency) {
f->avctx->pix_fmt = AV_PIX_FMT_GBRP16;
f->use32bit = 1;
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 746f717568..2778c63012 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -585,8 +585,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
case AV_PIX_FMT_YUV440P12:
case AV_PIX_FMT_YUV420P12:
case AV_PIX_FMT_YUV422P12:
+ case AV_PIX_FMT_YUVA444P12:
+ case AV_PIX_FMT_YUVA422P12:
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
s->bits_per_raw_sample = 12;
+ case AV_PIX_FMT_GRAY14:
case AV_PIX_FMT_YUV444P14:
case AV_PIX_FMT_YUV420P14:
case AV_PIX_FMT_YUV422P14:
@@ -667,6 +670,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
s->bits_per_raw_sample = 12;
case AV_PIX_FMT_GBRP14:
+ case AV_PIX_FMT_GBRAP14:
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
s->bits_per_raw_sample = 14;
case AV_PIX_FMT_GBRP16:
@@ -1284,13 +1288,14 @@ const FFCodec ff_ffv1_encoder = {
AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA420P16,
+ AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_YUVA422P12,
AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA420P10,
AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA420P9,
AV_PIX_FMT_GRAY16, AV_PIX_FMT_GRAY8, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
- AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14,
+ AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRAP14,
AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12,
AV_PIX_FMT_YA8,
- AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12,
+ AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14,
AV_PIX_FMT_GBRP16, AV_PIX_FMT_RGB48,
AV_PIX_FMT_GBRAP16, AV_PIX_FMT_RGBA64,
AV_PIX_FMT_GRAY9,
--
2.42.0
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/ffv1*: add more pixel formats support
2023-09-28 19:54 [FFmpeg-devel] [PATCH] avcodec/ffv1*: add more pixel formats support Paul B Mahol
@ 2023-09-29 16:22 ` Michael Niedermayer
0 siblings, 0 replies; 2+ messages in thread
From: Michael Niedermayer @ 2023-09-29 16:22 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 835 bytes --]
On Thu, Sep 28, 2023 at 09:54:04PM +0200, Paul B Mahol wrote:
> Attached.
> ffv1dec.c | 11 +++++++++++
> ffv1enc.c | 9 +++++++--
> 2 files changed, 18 insertions(+), 2 deletions(-)
> 4e3e427b7ea8b73dd00628f317f0f5a96e9e5592 0001-avcodec-ffv1-add-GBRAP14-GRAY14-YUVA422P12-YUVA444P1.patch
> From 80e70d4cde1734b01809352d280f43a9d4ba79dc Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda@gmail.com>
> Date: Thu, 28 Sep 2023 21:22:34 +0200
> Subject: [PATCH] avcodec/ffv1*: add GBRAP14, GRAY14, YUVA422P12, YUVA444P12
> formats support
should be ok if you tested it and it works
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-29 16:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 19:54 [FFmpeg-devel] [PATCH] avcodec/ffv1*: add more pixel formats support Paul B Mahol
2023-09-29 16:22 ` Michael Niedermayer
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