Re: [FFmpeg-devel] [PATCH 4/7] hwcontext_vulkan: add support for AV_PIX_FMT_RGBA32

2024-10-11 Thread Lynne via ffmpeg-devel

On 12/10/2024 00:11, James Almer wrote:

On 10/10/2024 2:32 AM, Lynne via ffmpeg-devel wrote:

---
  libavutil/hwcontext_vulkan.c |  1 +
  libavutil/vulkan.c   | 11 ++-
  2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 1fb0481fa7..24aafcba07 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -320,6 +320,7 @@ static const struct FFVkFormatEntry {
  { VK_FORMAT_R8G8B8A8_UNORM,   AV_PIX_FMT_RGB0,
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, 
{ VK_FORMAT_R8G8B8A8_UNORM   } },
  { VK_FORMAT_A2R10G10B10_UNORM_PACK32, AV_PIX_FMT_X2RGB10, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, 
{ VK_FORMAT_A2R10G10B10_UNORM_PACK32 } },
  { VK_FORMAT_A2B10G10R10_UNORM_PACK32, AV_PIX_FMT_X2BGR10, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, 
{ VK_FORMAT_A2B10G10R10_UNORM_PACK32 } },
+    { VK_FORMAT_R32G32B32A32_UINT,    AV_PIX_FMT_RGBA32,  
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, 
{ VK_FORMAT_R32G32B32A32_UINT    } },
  { VK_FORMAT_R32G32B32A32_SFLOAT,  AV_PIX_FMT_RGBAF32, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, 
{ VK_FORMAT_R32G32B32A32_SFLOAT  } },

  /* Planar RGB */
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 4cd180f54c..1ad3b3feb5 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -1282,7 +1282,7 @@ int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
  pix_fmt == AV_PIX_FMT_BGR565 || pix_fmt == AV_PIX_FMT_BGR0   ||
  pix_fmt == AV_PIX_FMT_0BGR   || pix_fmt == AV_PIX_FMT_RGB0   ||
  pix_fmt == AV_PIX_FMT_X2RGB10 || pix_fmt == 
AV_PIX_FMT_X2BGR10 ||

-    pix_fmt == AV_PIX_FMT_RGBAF32)
+    pix_fmt == AV_PIX_FMT_RGBAF32 || pix_fmt == AV_PIX_FMT_RGBA32)
  return 1;
  return 0;
  }
@@ -1366,6 +1366,15 @@ const char *ff_vk_shader_rep_fmt(enum 
AVPixelFormat pix_fmt,

  };
  return rep_tab[rep_fmt];
  }
+    case AV_PIX_FMT_RGBA32: {
+    const char *rep_tab[] = {
+    [FF_VK_REP_NATIVE] = "rgba32ui",
+    [FF_VK_REP_FLOAT] = NULL,
+    [FF_VK_REP_INT] = "rgba32i",
+    [FF_VK_REP_UINT] = "rgba32ui",
+    };
+    return rep_tab[rep_fmt];
+    };
  case AV_PIX_FMT_GRAY8:
  case AV_PIX_FMT_GBRAP: {
  const char *rep_tab[] = {


What does this accomplish if you don't add input and/or output support 
to libsws? Assuming Vulkan driver outputs this, nothing but 
av_read_image_line() and av_write_image_line() will be able to do 
anything with it.


Me and the folks working on the VC-2 encoder/decoder need the format so 
we can use the standard AVHWFramesContext interface to allocate internal 
intermediate frames for lossless codecs. Currently we're using buffers,

but they're slower and more error-prone than using images.
Its possible to duplicate all the code from hwcontext_vulkan.c, but 
Vulkan doesn't make it easy, plus the code there is tested.


The plan is to add swscale support with a later patch. The format can be 
useful in other situations too, such as CGI intermediates, since it can 
fully hold 16-bit convolutions (16*16->32), such as what you get when 
tonemapping. Also TIFF supports it (though TIFF supports everything).


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] riscv/vvc: fix UNDEF whilst initialising DSP

2024-10-11 Thread Rémi Denis-Courmont
The current triggers an illegal instruction if the CPU does not support
vectors.
---
 libavcodec/riscv/vvc/vvcdsp_init.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/riscv/vvc/vvcdsp_init.c 
b/libavcodec/riscv/vvc/vvcdsp_init.c
index 0a9f393259..30e8f59a58 100644
--- a/libavcodec/riscv/vvc/vvcdsp_init.c
+++ b/libavcodec/riscv/vvc/vvcdsp_init.c
@@ -41,10 +41,13 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const 
int bd)
 {
 #if HAVE_RVV
 const int flags = av_get_cpu_flags();
-int vlenb = ff_get_rv_vlenb();
+int vlenb;
 
-if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB) &&
-vlenb >= 32) {
+if (!(flags & AV_CPU_FLAG_RVV_I32) || !(flags & AV_CPU_FLAG_RVB))
+return;
+
+vlenb = ff_get_rv_vlenb();
+if (vlenb >= 32) {
 switch (bd) {
 case 8:
 c->inter.avg= ff_vvc_avg_8_rvv_256;
@@ -55,8 +58,7 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const int 
bd)
 default:
 break;
 }
-} else if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB) &&
-   vlenb >= 16) {
+} else if (vlenb >= 16) {
 switch (bd) {
 case 8:
 c->inter.avg= ff_vvc_avg_8_rvv_128;
-- 
2.45.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v11 1/3] libavcodec/dnxucdec: DNxUncompressed decoder

2024-10-11 Thread Anton Khirnov
Quoting Martin Schitter (2024-10-11 03:08:23)
> On 10.10.24 14:13, Anton Khirnov wrote:
> > I've already commented on this in a previous version - this should be
> > directly exported as rawvideo by the demuxer rather than requiring a
> > special encoder.
> 
> 
> hmm -- you touched this topic once in an annotation one month ago:
> 
>On 09.09.24 12:56, Anton Khirnov wrote:
>> Quoting Martin Schitter (2024-09-08 20:41:38)
>>> diff --git a/libavcodec/dnxucdec.c b/libavcodec/dnxucdec.c
>>> new file mode 100644
>>> index 000..455c374
>>> --- /dev/null
>>> +++ b/libavcodec/dnxucdec.c
>>> @@ -0,0 +1,495 @@
>>> +/*
>>> + * Avid DNxUncomressed / SMPTE RDD 50 demuxer
>>
>> This says it's a demuxer, while it's implemented as a decoder.
>>
>> I'm also wondering if this shouldn't be handled as demuxer exporting
>> raw video, at least in some of cases if not all.
> 
> And I quickly responded:
> 
>On 10.09.24 13:58, martin schitter wrote:
>> When I started the work, I also thought, it will not require much
>> more than minimal modifications of MXF related raw data transport
>> details, but during reverse engineering the actually used dense
>> bitpacking turned out to be more complicated.
>>
>> The codec section should fit rather well for this component,
>> although large parts of it could be also categorized just as
>> bitstream filter.
> 
> Although I accepted all your other suggestions for improvement and 
> rewrote lots of code, I didn't change my mid about this particular 
> topic. And I also didn't get any response or further defense of your 
> point of view concerning this issue until now.

It seems rather obvious to me - you're making a demuxer export something
that IS raw video, yet you're tagging it as a new codec ID with a new
decoder that (for these specific pixel format) duplicates what the
rawvideo decoder does.

Just to be clear, I'm not saying the entirety of your decoder should be
handled in the demuxer - just those pixel formats that can be. That
would also have the advantage that the remainder of your decoder could
now enable direct rendering.

> >> +static int float2planes(AVCodecContext *avctx, AVFrame *frame, const 
> >> AVPacket *pkt)
> >> +{
> >> +int lw;
> >> +const size_t sof = 4;
> >> +
> >> +lw = frame->width;
> >> +
> >> +for(int y = 0; y < frame->height; y++){
> >> +for(int x = 0; x < frame->width; x++){
> >> +memcpy(&frame->data[2][sof*(lw*y + x)], &pkt->data[sof* 
> >> 3*(lw*y + x)], sof);
> >> +memcpy(&frame->data[0][sof*(lw*y + x)], 
> >> &pkt->data[sof*(3*(lw*y + x) + 1)], sof);
> >> +memcpy(&frame->data[1][sof*(lw*y + x)], 
> >> &pkt->data[sof*(3*(lw*y + x) + 2)], sof);
> >> +}
> >> +}
> > 
> > Same here, deinterleaving packed to planar is a job for swscale.
> 
> Some of these rather inefficient interleave<->planar conversions where 
> just necessary in practice, because swscale wasn't able to figure out a 
> working pipeline construction otherwise, although in theory the affected 
> pixel format closer to the data input should be supported and work as 
> well!:(
> 
> At the end I just looked for something that simply works in real world, too!

But we do have a packed RGBF32 pixel format, how is it different from
this?

> >> +return pkt->size;
> >> +}
> >> +
> >> +static int half_add_alpha(AVCodecContext *avctx, AVFrame *frame, const 
> >> AVPacket *pkt)
> >> +{
> >> +/* ffmpeg doesn't provide any Float16 RGB pixel format without alpha 
> >> channel
> >> + * right now. As workaround we simply add an opaque alpha layer. */
> > 
> > So why not add the format then?
> 
> No! -- I definitely don't want to add another ad-hoc provisional 
> solution to swscale! :(

Why would it be ad-hoc or provisional? We already have the exact format,
except that it contains alpha. Adding an analogue without alpha should
be very simple, and as there's a lot of swscale work going on right now
I'm sure someone will be able to help you with it if you need it.

Pixel format conversion in decoders should really be a last resort. We
consciously moved away from it about 15 years ago, with good reason.

Besides the above, your code does very uncomfortable amounts of raw
access to pkt->data. That is inefficient, hard to read, and potentially
unsafe. Seems to me the bytestream2 API would make things a lot better.

Also, all those commented out av_log() calls are visual noise that needs
to go.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/3] avformat/dashdec: return ret directly in open_demux_for_component()

2024-10-11 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dashdec.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 99ac6197be..9ce23aec65 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1939,16 +1939,15 @@ static int open_demux_for_component(AVFormatContext *s, 
struct representation *p
 }
 
 ret = reopen_demux_for_component(s, pls);
-if (ret < 0) {
-goto fail;
-}
+if (ret < 0)
+return ret;
+
 for (i = 0; i < pls->ctx->nb_streams; i++) {
 AVStream *st = avformat_new_stream(s, NULL);
 AVStream *ist = pls->ctx->streams[i];
-if (!st) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!st)
+return AVERROR(ENOMEM);
+
 st->id = i;
 avcodec_parameters_copy(st->codecpar, ist->codecpar);
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
@@ -1958,8 +1957,6 @@ static int open_demux_for_component(AVFormatContext *s, 
struct representation *p
 }
 
 return 0;
-fail:
-return ret;
 }
 
 static int is_common_init_section_exist(struct representation **pls, int n_pls)
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/3] avformat/dashdec: check return code of avcodec_parameters_copy()

2024-10-11 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dashdec.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 9ce23aec65..cd1b3da3a2 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1949,7 +1949,11 @@ static int open_demux_for_component(AVFormatContext *s, 
struct representation *p
 return AVERROR(ENOMEM);
 
 st->id = i;
-avcodec_parameters_copy(st->codecpar, ist->codecpar);
+
+ret = avcodec_parameters_copy(st->codecpar, ist->codecpar);
+if (ret < 0)
+return ret;
+
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
 
 // copy disposition
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/3] avformat/dashdec: format open_demux_for_component()

2024-10-11 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dashdec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index cd1b3da3a2..a1d274f2f0 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1932,11 +1932,10 @@ static int open_demux_for_component(AVFormatContext *s, 
struct representation *p
 int i;
 
 pls->parent = s;
-pls->cur_seq_no  = calc_cur_seg_no(s, pls);
+pls->cur_seq_no = calc_cur_seg_no(s, pls);
 
-if (!pls->last_seq_no) {
+if (!pls->last_seq_no)
 pls->last_seq_no = calc_max_seg_no(pls, s->priv_data);
-}
 
 ret = reopen_demux_for_component(s, pls);
 if (ret < 0)
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/5] avcodec/ffv1enc: allow manually specifying the crc type

2024-10-11 Thread Jerome Martinez

Le 10/10/2024 à 22:45, Michael Niedermayer a écrit :

[...]

@@ -1266,7 +1268,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
  #define OFFSET(x) offsetof(FFV1Context, x)
  #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
  static const AVOption options[] = {
-{ "slicecrc", "Protect slices with CRCs", OFFSET(ec), AV_OPT_TYPE_BOOL, { 
.i64 = -1 }, -1, 1, VE },
+{ "slicecrc", "Protect slices with CRCs", OFFSET(ec), AV_OPT_TYPE_BOOL, { 
.i64 = -1 }, -1, 2, VE },


This is no more a bool.


  { "coder", "Coder type", OFFSET(ac), AV_OPT_TYPE_INT,
  { .i64 = 0 }, -2, 2, VE, .unit = "coder" },
  { "rice", "Golomb rice", 0, AV_OPT_TYPE_CONST,



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/ffv1enc: Prevent generation of files with broken slices

2024-10-11 Thread Lynne via ffmpeg-devel

On 01/10/2024 22:31, Michael Niedermayer wrote:

Fixes: Ticket5548

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
  libavcodec/ffv1.c| 7 +++
  libavcodec/ffv1.h| 1 +
  libavcodec/ffv1enc.c | 4 
  3 files changed, 12 insertions(+)

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 56a36e479fc..2b8564c2f56 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -119,6 +119,13 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
  return 0;
  }
  
+int ff_need_new_slices(int width, int num_h_slices, int chroma_shift) {


Wrong coding style.


+int mpw = 1<

Same, leave a space.


+int i = width * (int64_t)(num_h_slices - 1) / num_h_slices;
+
+return width % mpw && (width - i) % mpw == 0;


Would a check (if height < (subsampling ? 3 : 1)) would have been 
enough? This isn't really readable nor understandable.


Furthermore, this function is called with both width and height, yet all 
variables are named with the assumption that only width is used.


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/mediacodecdec_common: Workaround MTK broken crop implementation

2024-10-11 Thread Zhao Zhili
From: Zhao Zhili 

MediaTek SOC return broken crop info, e.g.,
width: int32(3840) height: int32(2160) crop: Rect(0, 0, 318, 238)

It will notify the right crop info with infoOutputFormatChanged, but
too late.
---
 libavcodec/mediacodecdec_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index b1ee8b609a..84c34ac270 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -593,7 +593,8 @@ static int mediacodec_dec_parse_video_format(AVCodecContext 
*avctx, MediaCodecDe
 AMEDIAFORMAT_GET_INT32(s->crop_right,  "crop-right",  0);
 
 // Try "crop" for NDK
-if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec)
+// MediaTek SOC return some default value like Rect(0, 0, 318, 238)
+if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec && 
!strstr(s->codec_name, ".mtk."))
 ff_AMediaFormat_getRect(s->format, "crop", &s->crop_left, 
&s->crop_top, &s->crop_right, &s->crop_bottom);
 
 if (s->crop_right && s->crop_bottom) {
-- 
2.46.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 5/5] [RFC] libavcodec/ffv1enc: Support storing LSB raw

2024-10-11 Thread Jerome Martinez

Le 10/10/2024 à 22:45, Michael Niedermayer a écrit :

This makes a 16bit RGB raw sample 25% faster at a 2% loss of compression with 
rawlsb=4

Please test and comment, especially if you are an archivist caring about 
compression and speed
Id like to know if this is a direction (that is trading compression against 
speed) that
is wanted


This is something I was having in mind for a long time but never spent 
the time to implement it, great that this is done!

Definitely something useful as lsb at 16-bit can not really be compressed.



[...]
+// put_symbol(c, state, f->rawlsb, 0);


I was having in mind to add the count of zeroed lsb and to not store them, 
sometimes the lsb are upscale with zeroes but we need to keep the hint that it 
is 16-bit.



[...]


In practice the 16-bit version of the compressor could be used also for 
16-bit RGB content, it may be a bit faster especially on huge frames 
with a bit less memory usage, but this adaptation can be made in a later 
step.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH, v3] avcodec/amfenc: increase precision of Sleep() on Windows

2024-10-11 Thread Araz Iusubov
From: Cameron Gutman 

This commit increase precision of Sleep() function on Windows.
This fix reduces the sleep time on Windows to improve AMF encoding
performance on low resolution input videos.

Fix for issue #10622

Co-authored-by: Araz Iusubov 
---
 libavcodec/amfenc.c  | 21 ++---
 libavcodec/amfenc.h  |  3 +++
 libavcodec/amfenc_av1.c  |  5 +
 libavcodec/amfenc_h264.c |  5 +
 libavcodec/amfenc_hevc.c |  5 +
 5 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 225fb9df27..03d75031f5 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -426,6 +426,8 @@ static int amf_init_encoder(AVCodecContext *avctx)
 res = ctx->factory->pVtbl->CreateComponent(ctx->factory, ctx->context, 
codec_id, &ctx->encoder);
 AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_ENCODER_NOT_FOUND, 
"CreateComponent(%ls) failed with error %d\n", codec_id, res);
 
+ctx->submitted_frame = 0;
+
 return 0;
 }
 
@@ -541,7 +543,6 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket 
*pkt, AMFBuffer *buff
 if ((ctx->max_b_frames > 0 || ((ctx->pa_adaptive_mini_gop == 1) ? true : 
false)) && ctx->dts_delay == 0) {
 int64_t timestamp_last = AV_NOPTS_VALUE;
 size_t can_read = av_fifo_can_read(ctx->timestamp_list);
-
 AMF_RETURN_IF_FALSE(ctx, can_read > 0, AVERROR_UNKNOWN,
 "timestamp_list is empty while max_b_frames = %d\n", 
avctx->max_b_frames);
 av_fifo_peek(ctx->timestamp_list, ×tamp_last, 1, can_read - 1);
@@ -826,6 +827,13 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 
 av_frame_unref(frame);
 ret = av_fifo_write(ctx->timestamp_list, &pts, 1);
+
+if (ctx->submitted_frame == 0)
+{
+ctx->use_b_frame = (ctx->max_b_frames > 0 || 
((ctx->pa_adaptive_mini_gop == 1) ? true : false));
+}
+ctx->submitted_frame++;
+
 if (ret < 0)
 return ret;
 }
@@ -835,7 +843,7 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 do {
 block_and_wait = 0;
 // poll data
-if (!avpkt->data && !avpkt->buf) {
+if (!avpkt->data && !avpkt->buf && (ctx->use_b_frame ? 
(ctx->submitted_frame >= 2) : true) ) {
 res_query = ctx->encoder->pVtbl->QueryOutput(ctx->encoder, &data);
 if (data) {
 // copy data to packet
@@ -845,6 +853,7 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 data->pVtbl->QueryInterface(data, &guid, (void**)&buffer); // 
query for buffer interface
 ret = amf_copy_buffer(avctx, avpkt, buffer);
 
+ctx->submitted_frame++;
 buffer->pVtbl->Release(buffer);
 
 if (data->pVtbl->HasProperty(data, L"av_frame_ref")) {
@@ -884,6 +893,7 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 av_frame_unref(ctx->delayed_frame);
 AMF_RETURN_IF_FALSE(ctx, res_resubmit == AMF_OK, 
AVERROR_UNKNOWN, "Repeated SubmitInput() failed with error %d\n", res_resubmit);
 
+ctx->submitted_frame++;
 ret = av_fifo_write(ctx->timestamp_list, &pts, 1);
 if (ret < 0)
 return ret;
@@ -902,7 +912,12 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket 
*avpkt)
 if (query_output_data_flag == 0) {
 if (res_resubmit == AMF_INPUT_FULL || ctx->delayed_drain || 
(ctx->eof && res_query != AMF_EOF) || (ctx->hwsurfaces_in_queue >= 
ctx->hwsurfaces_in_queue_max)) {
 block_and_wait = 1;
-av_usleep(1000);
+
+// Only sleep if the driver doesn't support waiting in 
QueryOutput()
+// or if we already have output data so we will skip calling 
it.
+if (!ctx->query_timeout_supported || avpkt->data || 
avpkt->buf) {
+av_usleep(1000);
+}
 }
 }
 } while (block_and_wait);
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 0f2abcbd82..d83ee5bf1c 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -68,6 +68,7 @@ typedef struct AmfContext {
 
 int hwsurfaces_in_queue;
 int hwsurfaces_in_queue_max;
+int query_timeout_supported;
 
 // helpers to handle async calls
 int delayed_drain;
@@ -77,6 +78,8 @@ typedef struct AmfContext {
 // shift dts back by max_b_frames in timing
 AVFifo *timestamp_list;
 int64_t dts_delay;
+int submitted_frame;
+amf_booluse_b_frame;
 
 // common encoder option options
 
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index b40d54f70c..e63979f62a 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av

Re: [FFmpeg-devel] [PATCH 08/21] swscale/output: add VYU444 output support

2024-10-11 Thread Michael Niedermayer
On Tue, Oct 08, 2024 at 07:50:13PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libswscale/output.c  | 124 +++
>  libswscale/utils.c   |   2 +-
>  tests/ref/fate/filter-pixdesc-vyu444 |   1 +
>  tests/ref/fate/filter-pixfmts-copy   |   1 +
>  tests/ref/fate/filter-pixfmts-crop   |   1 +
>  tests/ref/fate/filter-pixfmts-field  |   1 +
>  tests/ref/fate/filter-pixfmts-fieldorder |   1 +
>  tests/ref/fate/filter-pixfmts-hflip  |   1 +
>  tests/ref/fate/filter-pixfmts-il |   1 +
>  tests/ref/fate/filter-pixfmts-null   |   1 +
>  tests/ref/fate/filter-pixfmts-pad|   1 +
>  tests/ref/fate/filter-pixfmts-scale  |   1 +
>  tests/ref/fate/filter-pixfmts-transpose  |   1 +
>  tests/ref/fate/filter-pixfmts-vflip  |   1 +
>  14 files changed, 137 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/fate/filter-pixdesc-vyu444

if it cannot be cleanly factored with anything then LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 09/21] swscale/output: add V30X output support

2024-10-11 Thread Michael Niedermayer
On Tue, Oct 08, 2024 at 07:50:14PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libswscale/output.c  | 31 
>  libswscale/utils.c   |  2 +-
>  tests/ref/fate/filter-pixdesc-v30xle |  1 +
>  tests/ref/fate/filter-pixfmts-copy   |  1 +
>  tests/ref/fate/filter-pixfmts-crop   |  1 +
>  tests/ref/fate/filter-pixfmts-field  |  1 +
>  tests/ref/fate/filter-pixfmts-fieldorder |  1 +
>  tests/ref/fate/filter-pixfmts-hflip  |  1 +
>  tests/ref/fate/filter-pixfmts-il |  1 +
>  tests/ref/fate/filter-pixfmts-null   |  1 +
>  tests/ref/fate/filter-pixfmts-scale  |  1 +
>  tests/ref/fate/filter-pixfmts-transpose  |  1 +
>  tests/ref/fate/filter-pixfmts-vflip  |  1 +
>  13 files changed, 43 insertions(+), 1 deletion(-)
>  create mode 100644 tests/ref/fate/filter-pixdesc-v30xle

should be ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 10/21] avformat/riff: map y408 fourcc to RAWVIDEO decoder

2024-10-11 Thread Michael Niedermayer
On Tue, Oct 08, 2024 at 07:50:15PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/raw.c | 1 +
>  libavformat/riff.c   | 1 +
>  tests/ref/fate/filter-pixdesc-ayuv   | 2 +-
>  tests/ref/fate/filter-pixfmts-copy   | 2 +-
>  tests/ref/fate/filter-pixfmts-crop   | 2 +-
>  tests/ref/fate/filter-pixfmts-field  | 2 +-
>  tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
>  tests/ref/fate/filter-pixfmts-hflip  | 2 +-
>  tests/ref/fate/filter-pixfmts-il | 2 +-
>  tests/ref/fate/filter-pixfmts-null   | 2 +-
>  tests/ref/fate/filter-pixfmts-pad| 2 +-
>  tests/ref/fate/filter-pixfmts-scale  | 2 +-
>  tests/ref/fate/filter-pixfmts-transpose  | 2 +-
>  tests/ref/fate/filter-pixfmts-vflip  | 2 +-
>  14 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/libavcodec/raw.c b/libavcodec/raw.c
> index b73b80e5fd..acdd79ded8 100644
> --- a/libavcodec/raw.c
> +++ b/libavcodec/raw.c
> @@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
>  { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
>  { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
>  { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 
> 8 Bit */
> +{ AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
>  { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
>  { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
>  { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') },
> diff --git a/libavformat/riff.c b/libavformat/riff.c
> index ca81b4837a..b079b00f6c 100644
> --- a/libavformat/riff.c
> +++ b/libavformat/riff.c
> @@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
>  { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
>  { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
>  { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
> +{ AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
>  { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
>  { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
>  { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
> diff --git a/tests/ref/fate/filter-pixdesc-ayuv 
> b/tests/ref/fate/filter-pixdesc-ayuv
> index 178e847222..aed45638ef 100644
> --- a/tests/ref/fate/filter-pixdesc-ayuv
> +++ b/tests/ref/fate/filter-pixdesc-ayuv
> @@ -1 +1 @@
> -pixdesc-ayuva21ac760efdec0065bcf605f4ed75f7f
> +pixdesc-ayuv31b8e3c2e1f027af001f774e8a6feae4
> diff --git a/tests/ref/fate/filter-pixfmts-copy 
> b/tests/ref/fate/filter-pixfmts-copy
> index bf2eaaf23e..4910c1b9ed 100644
> --- a/tests/ref/fate/filter-pixfmts-copy
> +++ b/tests/ref/fate/filter-pixfmts-copy
> @@ -2,7 +2,7 @@
>  0rgb527ef3d164c8fd0700493733959689c2
>  abgr023ecf6396d324edb113e4a483b79ba2
>  argbf003b555ef429222005d33844cca9325
> -ayuveb7e43cfbb961d1e369311d0f58b9f52
> +ayuv631859cdc018cd9671482e435a87becc

The commit message should explain the reason for the change in fate test 
checksums
especially as its slightly hard to tell from the md5 checksums ;)

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 10/21] avformat/riff: map y408 fourcc to RAWVIDEO decoder

2024-10-11 Thread James Almer

On 10/11/2024 7:51 PM, Michael Niedermayer wrote:

On Tue, Oct 08, 2024 at 07:50:15PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  libavcodec/raw.c | 1 +
  libavformat/riff.c   | 1 +
  tests/ref/fate/filter-pixdesc-ayuv   | 2 +-
  tests/ref/fate/filter-pixfmts-copy   | 2 +-
  tests/ref/fate/filter-pixfmts-crop   | 2 +-
  tests/ref/fate/filter-pixfmts-field  | 2 +-
  tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
  tests/ref/fate/filter-pixfmts-hflip  | 2 +-
  tests/ref/fate/filter-pixfmts-il | 2 +-
  tests/ref/fate/filter-pixfmts-null   | 2 +-
  tests/ref/fate/filter-pixfmts-pad| 2 +-
  tests/ref/fate/filter-pixfmts-scale  | 2 +-
  tests/ref/fate/filter-pixfmts-transpose  | 2 +-
  tests/ref/fate/filter-pixfmts-vflip  | 2 +-
  14 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index b73b80e5fd..acdd79ded8 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
  { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
  { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
  { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
+{ AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
  { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
  { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
  { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index ca81b4837a..b079b00f6c 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
  { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
  { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
  { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
  { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
  { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
  { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
diff --git a/tests/ref/fate/filter-pixdesc-ayuv 
b/tests/ref/fate/filter-pixdesc-ayuv
index 178e847222..aed45638ef 100644
--- a/tests/ref/fate/filter-pixdesc-ayuv
+++ b/tests/ref/fate/filter-pixdesc-ayuv
@@ -1 +1 @@
-pixdesc-ayuva21ac760efdec0065bcf605f4ed75f7f
+pixdesc-ayuv31b8e3c2e1f027af001f774e8a6feae4
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index bf2eaaf23e..4910c1b9ed 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -2,7 +2,7 @@
  0rgb527ef3d164c8fd0700493733959689c2
  abgr023ecf6396d324edb113e4a483b79ba2
  argbf003b555ef429222005d33844cca9325
-ayuveb7e43cfbb961d1e369311d0f58b9f52
+ayuv631859cdc018cd9671482e435a87becc


The commit message should explain the reason for the change in fate test 
checksums
especially as its slightly hard to tell from the md5 checksums ;)


Will mention that the nut container now contains the string rawvideo as 
encoder instead of v408.




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/21] swscale/output: add AYUV output support

2024-10-11 Thread James Almer

On 10/11/2024 7:46 PM, Michael Niedermayer wrote:

On Tue, Oct 08, 2024 at 07:50:11PM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  libswscale/output.c  | 323 ---
  libswscale/utils.c   |   2 +-
  tests/ref/fate/filter-pixdesc-ayuv   |   1 +
  tests/ref/fate/filter-pixfmts-copy   |   1 +
  tests/ref/fate/filter-pixfmts-crop   |   1 +
  tests/ref/fate/filter-pixfmts-field  |   1 +
  tests/ref/fate/filter-pixfmts-fieldorder |   1 +
  tests/ref/fate/filter-pixfmts-hflip  |   1 +
  tests/ref/fate/filter-pixfmts-il |   1 +
  tests/ref/fate/filter-pixfmts-null   |   1 +
  tests/ref/fate/filter-pixfmts-pad|   1 +
  tests/ref/fate/filter-pixfmts-scale  |   1 +
  tests/ref/fate/filter-pixfmts-transpose  |   1 +
  tests/ref/fate/filter-pixfmts-vflip  |   1 +
  14 files changed, 183 insertions(+), 154 deletions(-)
  create mode 100644 tests/ref/fate/filter-pixdesc-ayuv

diff --git a/libswscale/output.c b/libswscale/output.c
index c9dfd6f60a..328b108089 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2668,165 +2668,177 @@ yuv2xv36le_X_c(SwsContext *c, const int16_t 
*lumFilter,
  }
  }
  
-static void

-yuv2vuyX_1_c(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf0, uint8_t *dest, int dstW,
- int uvalpha, int y)
-{
-int hasAlpha = !!abuf0;
-int i;
-
-if (uvalpha < 2048) {
-for (i = 0; i < dstW; i++) {
-int Y = (buf0[i] + 64) >> 7;
-int U = (ubuf[0][i] + 64) >> 7;
-int V = (vbuf[0][i] + 64) >> 7;
-int A = 255;
-
-if (Y & 0x100)
-Y = av_clip_uint8(Y);
-if (U & 0x100)
-U = av_clip_uint8(U);
-if (V & 0x100)
-V = av_clip_uint8(V);
-
-if (hasAlpha) {
-A = (abuf0[i] + 64) >> 7;
-if (A & 0x100)
-A = av_clip_uint8(A);
-}
-
-dest[4 * i] = V;
-dest[4 * i + 1] = U;
-dest[4 * i + 2] = Y;
-dest[4 * i + 3] = A;
-}
-} else {
-for (i = 0; i < dstW; i++) {
-int Y = (buf0[i] + 64) >> 7;
-int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8;
-int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8;
-int A = 255;
-
-if (Y & 0x100)
-Y = av_clip_uint8(Y);
-if (U & 0x100)
-U = av_clip_uint8(U);
-if (V & 0x100)
-V = av_clip_uint8(V);
-
-if (hasAlpha) {
-A = (abuf0[i] + 64) >> 7;
-if (A & 0x100)
-A = av_clip_uint8(A);
-}
-
-dest[4 * i] = V;
-dest[4 * i + 1] = U;
-dest[4 * i + 2] = Y;
-dest[4 * i + 3] = A;
-}
-}
+#define AYUV_1_WRAPPER(fmt, C0, C1, C2, C3)\
+static void\
+yuv2 ## fmt ##_1_c(SwsContext *c, const int16_t *buf0, \
+   const int16_t *ubuf[2], const int16_t *vbuf[2], \
+   const int16_t *abuf0, uint8_t *dest, int dstW,  \
+   int uvalpha, int y) \
+{  \
+int hasAlpha = !!abuf0;\
+int i; \
+   \
+if (uvalpha < 2048) {  \
+for (i = 0; i < dstW; i++) {   \
+int Y = (buf0[i] + 64) >> 7;   \
+int U = (ubuf[0][i] + 64) >> 7;\
+int V = (vbuf[0][i] + 64) >> 7;\
+int A = 255;   \
+   \
+if (Y & 0x100) \
+Y = av_clip_uint8(Y);  \
+if (U & 0x100) \
+U = av_clip_uint8(U);  \
+if (V & 0x100) \
+V = av_clip_uint8(V);  \
+   \
+if (hasAlpha) {\
+A = (abuf0[i] + 64) >> 7;  \
+if (A & 0x100) \
+A = av_clip_uint8(A);  \
+} 

Re: [FFmpeg-devel] [PATCH] Check codec_whitelist before reinitializing AVCtx.priv_data.

2024-10-11 Thread Cameron Gutman
On Sun, Sep 1, 2024 at 5:43 AM Anton Khirnov  wrote:
>
> Quoting Dale Curtis (2024-08-01 01:18:14)
> > diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> > index 214dca4566..f189263ff9 100644
> > --- a/libavcodec/avcodec.c
> > +++ b/libavcodec/avcodec.c
> > @@ -174,6 +174,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> > *avctx, const AVCodec *code
> >  if (avctx->extradata_size < 0 || avctx->extradata_size >= 
> > FF_MAX_EXTRADATA_SIZE)
> >  return AVERROR(EINVAL);
> >
> > +if ((ret = av_opt_set_dict(avctx, options)) < 0)
> > +return AVERROR(EINVAL);
>
> Should be return ret;
>
> Pushed with that change and a reworded commit message to make it clearer
> what the issue is.
>
> Sorry for the delay.
>

This change caused a codec options regression in FFmpeg 7.1 because we're
now matching the provided options against the AVCodecContext options list
_before_ the codec's options list. This breaks codec options that overlap
with AVCodecContext option names (NVENC's "delay", AMF's "skip_frame", and
the codec-specific "profile" and "level" options that many encoders have).

Can we just check for "codec_whitelist" instead of applying the entire set
of options here?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] avcodec/vaapi_encode: fix compilation without CONFIG_VAAPI_1

2024-10-11 Thread Xiang, Haihao
On Wo, 2024-10-09 at 04:48 +0200, Ingo Brückl wrote:
> FFmpeg 7.1 as well as the latest development branch do not compile:
> 
>   In function 'vaapi_encode_h264_init_picture_params':
>   libavcodec/vaapi_encode_h264.c:470:9: error: 'ctx' undeclared

LGTM, applied

Thanks
Haihao

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 3/3] avformat/dashdec: format open_demux_for_component()

2024-10-11 Thread Steven Liu
Marth64  于2024年10月11日周五 15:07写道:
>
> Signed-off-by: Marth64 
> ---
>  libavformat/dashdec.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index cd1b3da3a2..a1d274f2f0 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1932,11 +1932,10 @@ static int open_demux_for_component(AVFormatContext 
> *s, struct representation *p
>  int i;
>
>  pls->parent = s;
> -pls->cur_seq_no  = calc_cur_seg_no(s, pls);
> +pls->cur_seq_no = calc_cur_seg_no(s, pls);
>
> -if (!pls->last_seq_no) {
> +if (!pls->last_seq_no)
>  pls->last_seq_no = calc_max_seg_no(pls, s->priv_data);
> -}
>
>  ret = reopen_demux_for_component(s, pls);
>  if (ret < 0)
> --
> 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


lgtm
Thanks
Steven
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/7] hwcontext_vulkan: add support for AV_PIX_FMT_RGBA32

2024-10-11 Thread James Almer

On 10/10/2024 2:32 AM, Lynne via ffmpeg-devel wrote:

---
  libavutil/hwcontext_vulkan.c |  1 +
  libavutil/vulkan.c   | 11 ++-
  2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 1fb0481fa7..24aafcba07 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -320,6 +320,7 @@ static const struct FFVkFormatEntry {
  { VK_FORMAT_R8G8B8A8_UNORM,   AV_PIX_FMT_RGB0,
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R8G8B8A8_UNORM   } },
  { VK_FORMAT_A2R10G10B10_UNORM_PACK32, AV_PIX_FMT_X2RGB10, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_A2R10G10B10_UNORM_PACK32 } },
  { VK_FORMAT_A2B10G10R10_UNORM_PACK32, AV_PIX_FMT_X2BGR10, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_A2B10G10R10_UNORM_PACK32 } },
+{ VK_FORMAT_R32G32B32A32_UINT,AV_PIX_FMT_RGBA32,  
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32A32_UINT} },
  { VK_FORMAT_R32G32B32A32_SFLOAT,  AV_PIX_FMT_RGBAF32, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32A32_SFLOAT  } },
  
  /* Planar RGB */

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 4cd180f54c..1ad3b3feb5 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -1282,7 +1282,7 @@ int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
  pix_fmt == AV_PIX_FMT_BGR565 || pix_fmt == AV_PIX_FMT_BGR0   ||
  pix_fmt == AV_PIX_FMT_0BGR   || pix_fmt == AV_PIX_FMT_RGB0   ||
  pix_fmt == AV_PIX_FMT_X2RGB10 || pix_fmt == AV_PIX_FMT_X2BGR10 ||
-pix_fmt == AV_PIX_FMT_RGBAF32)
+pix_fmt == AV_PIX_FMT_RGBAF32 || pix_fmt == AV_PIX_FMT_RGBA32)
  return 1;
  return 0;
  }
@@ -1366,6 +1366,15 @@ const char *ff_vk_shader_rep_fmt(enum AVPixelFormat 
pix_fmt,
  };
  return rep_tab[rep_fmt];
  }
+case AV_PIX_FMT_RGBA32: {
+const char *rep_tab[] = {
+[FF_VK_REP_NATIVE] = "rgba32ui",
+[FF_VK_REP_FLOAT] = NULL,
+[FF_VK_REP_INT] = "rgba32i",
+[FF_VK_REP_UINT] = "rgba32ui",
+};
+return rep_tab[rep_fmt];
+};
  case AV_PIX_FMT_GRAY8:
  case AV_PIX_FMT_GBRAP: {
  const char *rep_tab[] = {


What does this accomplish if you don't add input and/or output support 
to libsws? Assuming Vulkan driver outputs this, nothing but 
av_read_image_line() and av_write_image_line() will be able to do 
anything with it.




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/21] swscale/output: add AYUV output support

2024-10-11 Thread Michael Niedermayer
On Tue, Oct 08, 2024 at 07:50:11PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libswscale/output.c  | 323 ---
>  libswscale/utils.c   |   2 +-
>  tests/ref/fate/filter-pixdesc-ayuv   |   1 +
>  tests/ref/fate/filter-pixfmts-copy   |   1 +
>  tests/ref/fate/filter-pixfmts-crop   |   1 +
>  tests/ref/fate/filter-pixfmts-field  |   1 +
>  tests/ref/fate/filter-pixfmts-fieldorder |   1 +
>  tests/ref/fate/filter-pixfmts-hflip  |   1 +
>  tests/ref/fate/filter-pixfmts-il |   1 +
>  tests/ref/fate/filter-pixfmts-null   |   1 +
>  tests/ref/fate/filter-pixfmts-pad|   1 +
>  tests/ref/fate/filter-pixfmts-scale  |   1 +
>  tests/ref/fate/filter-pixfmts-transpose  |   1 +
>  tests/ref/fate/filter-pixfmts-vflip  |   1 +
>  14 files changed, 183 insertions(+), 154 deletions(-)
>  create mode 100644 tests/ref/fate/filter-pixdesc-ayuv
> 
> diff --git a/libswscale/output.c b/libswscale/output.c
> index c9dfd6f60a..328b108089 100644
> --- a/libswscale/output.c
> +++ b/libswscale/output.c
> @@ -2668,165 +2668,177 @@ yuv2xv36le_X_c(SwsContext *c, const int16_t 
> *lumFilter,
>  }
>  }
>  
> -static void
> -yuv2vuyX_1_c(SwsContext *c, const int16_t *buf0,
> - const int16_t *ubuf[2], const int16_t *vbuf[2],
> - const int16_t *abuf0, uint8_t *dest, int dstW,
> - int uvalpha, int y)
> -{
> -int hasAlpha = !!abuf0;
> -int i;
> -
> -if (uvalpha < 2048) {
> -for (i = 0; i < dstW; i++) {
> -int Y = (buf0[i] + 64) >> 7;
> -int U = (ubuf[0][i] + 64) >> 7;
> -int V = (vbuf[0][i] + 64) >> 7;
> -int A = 255;
> -
> -if (Y & 0x100)
> -Y = av_clip_uint8(Y);
> -if (U & 0x100)
> -U = av_clip_uint8(U);
> -if (V & 0x100)
> -V = av_clip_uint8(V);
> -
> -if (hasAlpha) {
> -A = (abuf0[i] + 64) >> 7;
> -if (A & 0x100)
> -A = av_clip_uint8(A);
> -}
> -
> -dest[4 * i] = V;
> -dest[4 * i + 1] = U;
> -dest[4 * i + 2] = Y;
> -dest[4 * i + 3] = A;
> -}
> -} else {
> -for (i = 0; i < dstW; i++) {
> -int Y = (buf0[i] + 64) >> 7;
> -int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8;
> -int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8;
> -int A = 255;
> -
> -if (Y & 0x100)
> -Y = av_clip_uint8(Y);
> -if (U & 0x100)
> -U = av_clip_uint8(U);
> -if (V & 0x100)
> -V = av_clip_uint8(V);
> -
> -if (hasAlpha) {
> -A = (abuf0[i] + 64) >> 7;
> -if (A & 0x100)
> -A = av_clip_uint8(A);
> -}
> -
> -dest[4 * i] = V;
> -dest[4 * i + 1] = U;
> -dest[4 * i + 2] = Y;
> -dest[4 * i + 3] = A;
> -}
> -}
> +#define AYUV_1_WRAPPER(fmt, C0, C1, C2, C3)\
> +static void\
> +yuv2 ## fmt ##_1_c(SwsContext *c, const int16_t *buf0, \
> +   const int16_t *ubuf[2], const int16_t *vbuf[2], \
> +   const int16_t *abuf0, uint8_t *dest, int dstW,  \
> +   int uvalpha, int y) \
> +{  \
> +int hasAlpha = !!abuf0;\
> +int i; \
> +   \
> +if (uvalpha < 2048) {  \
> +for (i = 0; i < dstW; i++) {   \
> +int Y = (buf0[i] + 64) >> 7;   \
> +int U = (ubuf[0][i] + 64) >> 7;\
> +int V = (vbuf[0][i] + 64) >> 7;\
> +int A = 255;   \
> +   \
> +if (Y & 0x100) \
> +Y = av_clip_uint8(Y);  \
> +if (U & 0x100) \
> +U = av_clip_uint8(U);  \
> +if (V & 0x100) \
> +V = av_clip_uint8(V);  \
> +   \
> +if (hasAlpha) {\
> +A = (abuf0[i] + 64) >> 7;  \
> +i

Re: [FFmpeg-devel] [PATCH 1/7] lavu/pixfmt: add AV_PIX_FMT_RGBA32

2024-10-11 Thread James Almer

On 10/11/2024 6:19 PM, Lynne via ffmpeg-devel wrote:

On 11/10/2024 23:06, Michael Niedermayer wrote:

On Thu, Oct 10, 2024 at 07:32:45AM +0200, Lynne via ffmpeg-devel wrote:

This format is useful for doing certain lossless transforms on images,
RCT in particular, which require you to escalate the size from 16 to
32 bits to avoid overflows.

APIchanges will be done alongside when comitting.
---
  libavutil/pixdesc.c | 27 +++
  libavutil/pixfmt.h  |  4 
  2 files changed, 31 insertions(+)


this needs at least am update to fate:
also iam not sure about the name rgba32 instead of rgba128


Yeah, me neither. The thing is, the float equivalent of the format is 
RBGAF32.

I don't mind RGBA128, but are there any other suggestions?


We have RGB48 (packed RGB 16:16:16, 48bpp) and RGBA64 (packed RGBA 
16:16:16:16, 64bpp), so this new format can't be called RGBA32, lest we 
want to make things confusing. So make it RGBA128 for now, and if 
someone suggest something better then it can be considered.




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 06/21] swscale/output: add AYUV output support

2024-10-11 Thread Michael Niedermayer
On Fri, Oct 11, 2024 at 07:54:48PM -0300, James Almer wrote:
> On 10/11/2024 7:46 PM, Michael Niedermayer wrote:
> > On Tue, Oct 08, 2024 at 07:50:11PM -0300, James Almer wrote:
> > > Signed-off-by: James Almer 
> > > ---
> > >   libswscale/output.c  | 323 ---
> > >   libswscale/utils.c   |   2 +-
> > >   tests/ref/fate/filter-pixdesc-ayuv   |   1 +
> > >   tests/ref/fate/filter-pixfmts-copy   |   1 +
> > >   tests/ref/fate/filter-pixfmts-crop   |   1 +
> > >   tests/ref/fate/filter-pixfmts-field  |   1 +
> > >   tests/ref/fate/filter-pixfmts-fieldorder |   1 +
> > >   tests/ref/fate/filter-pixfmts-hflip  |   1 +
> > >   tests/ref/fate/filter-pixfmts-il |   1 +
> > >   tests/ref/fate/filter-pixfmts-null   |   1 +
> > >   tests/ref/fate/filter-pixfmts-pad|   1 +
> > >   tests/ref/fate/filter-pixfmts-scale  |   1 +
> > >   tests/ref/fate/filter-pixfmts-transpose  |   1 +
> > >   tests/ref/fate/filter-pixfmts-vflip  |   1 +
> > >   14 files changed, 183 insertions(+), 154 deletions(-)
> > >   create mode 100644 tests/ref/fate/filter-pixdesc-ayuv
> > > 
> > > diff --git a/libswscale/output.c b/libswscale/output.c
> > > index c9dfd6f60a..328b108089 100644
> > > --- a/libswscale/output.c
> > > +++ b/libswscale/output.c
> > > @@ -2668,165 +2668,177 @@ yuv2xv36le_X_c(SwsContext *c, const int16_t 
> > > *lumFilter,
> > >   }
> > >   }
> > > -static void
> > > -yuv2vuyX_1_c(SwsContext *c, const int16_t *buf0,
> > > - const int16_t *ubuf[2], const int16_t *vbuf[2],
> > > - const int16_t *abuf0, uint8_t *dest, int dstW,
> > > - int uvalpha, int y)
> > > -{
> > > -int hasAlpha = !!abuf0;
> > > -int i;
> > > -
> > > -if (uvalpha < 2048) {
> > > -for (i = 0; i < dstW; i++) {
> > > -int Y = (buf0[i] + 64) >> 7;
> > > -int U = (ubuf[0][i] + 64) >> 7;
> > > -int V = (vbuf[0][i] + 64) >> 7;
> > > -int A = 255;
> > > -
> > > -if (Y & 0x100)
> > > -Y = av_clip_uint8(Y);
> > > -if (U & 0x100)
> > > -U = av_clip_uint8(U);
> > > -if (V & 0x100)
> > > -V = av_clip_uint8(V);
> > > -
> > > -if (hasAlpha) {
> > > -A = (abuf0[i] + 64) >> 7;
> > > -if (A & 0x100)
> > > -A = av_clip_uint8(A);
> > > -}
> > > -
> > > -dest[4 * i] = V;
> > > -dest[4 * i + 1] = U;
> > > -dest[4 * i + 2] = Y;
> > > -dest[4 * i + 3] = A;
> > > -}
> > > -} else {
> > > -for (i = 0; i < dstW; i++) {
> > > -int Y = (buf0[i] + 64) >> 7;
> > > -int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8;
> > > -int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8;
> > > -int A = 255;
> > > -
> > > -if (Y & 0x100)
> > > -Y = av_clip_uint8(Y);
> > > -if (U & 0x100)
> > > -U = av_clip_uint8(U);
> > > -if (V & 0x100)
> > > -V = av_clip_uint8(V);
> > > -
> > > -if (hasAlpha) {
> > > -A = (abuf0[i] + 64) >> 7;
> > > -if (A & 0x100)
> > > -A = av_clip_uint8(A);
> > > -}
> > > -
> > > -dest[4 * i] = V;
> > > -dest[4 * i + 1] = U;
> > > -dest[4 * i + 2] = Y;
> > > -dest[4 * i + 3] = A;
> > > -}
> > > -}
> > > +#define AYUV_1_WRAPPER(fmt, C0, C1, C2, C3)\
> > > +static void\
> > > +yuv2 ## fmt ##_1_c(SwsContext *c, const int16_t *buf0, \
> > > +   const int16_t *ubuf[2], const int16_t *vbuf[2], \
> > > +   const int16_t *abuf0, uint8_t *dest, int dstW,  \
> > > +   int uvalpha, int y) \
> > > +{  \
> > > +int hasAlpha = !!abuf0;\
> > > +int i; \
> > > +   \
> > > +if (uvalpha < 2048) {  \
> > > +for (i = 0; i < dstW; i++) {   \
> > > +int Y = (buf0[i] + 64) >> 7;   \
> > > +int U = (ubuf[0][i] + 64) >> 7;\
> > > +int V = (vbuf[0][i] + 64) >> 7;\
> > > +int A = 255;   \
> > > +   \
> > > +if (Y & 0x100) \
> > > +Y = av_clip_uint8(Y); 

Re: [FFmpeg-devel] [PATCH 1/7] lavu/pixfmt: add AV_PIX_FMT_RGBA32

2024-10-11 Thread Timo Rothenpieler

On 11.10.2024 23:19, Lynne via ffmpeg-devel wrote:

On 11/10/2024 23:06, Michael Niedermayer wrote:

On Thu, Oct 10, 2024 at 07:32:45AM +0200, Lynne via ffmpeg-devel wrote:

This format is useful for doing certain lossless transforms on images,
RCT in particular, which require you to escalate the size from 16 to
32 bits to avoid overflows.

APIchanges will be done alongside when comitting.
---
  libavutil/pixdesc.c | 27 +++
  libavutil/pixfmt.h  |  4 
  2 files changed, 31 insertions(+)


this needs at least am update to fate:
also iam not sure about the name rgba32 instead of rgba128


Yeah, me neither. The thing is, the float equivalent of the format is 
RBGAF32.

I don't mind RGBA128, but are there any other suggestions?


It'd definitely be confusing to have RGB32 and RGBA32 to be something so 
completely different.
The Float-One can kinda get away with it by the nature of being float 
and different from the get go, though it's definitely also a bit confusing.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/7] lavu/pixfmt: add AV_PIX_FMT_RGB32

2024-10-11 Thread James Almer


On 10/10/2024 3:58 AM, Lynne via ffmpeg-devel wrote:

On 10/10/2024 07:32, Lynne wrote:

---
  libavutil/pixdesc.c | 24 
  libavutil/pixfmt.h  |  4 
  2 files changed, 28 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 7174989072..a741d9bcb7 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2775,6 +2775,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {

  },
  .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
  },
+    [AV_PIX_FMT_RGB32BE] = {
+    .name = "rgb32be",
+    .nb_components = 3,
+    .log2_chroma_w = 0,
+    .log2_chroma_h = 0,
+    .comp = {
+    { 0, 12, 0, 0, 32 },   /* R */
+    { 0, 12, 4, 0, 32 },   /* G */
+    { 0, 12, 8, 0, 32 },   /* B */
+    },
+    .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+    },
+    [AV_PIX_FMT_RGB32LE] = {
+    .name = "rgb32le",
+    .nb_components = 3,
+    .log2_chroma_w = 0,
+    .log2_chroma_h = 0,
+    .comp = {
+    { 0, 12, 0, 0, 32 },   /* R */
+    { 0, 12, 4, 0, 32 },   /* G */
+    { 0, 12, 8, 0, 32 },   /* B */
+    },
+    .flags = AV_PIX_FMT_FLAG_RGB,
+    },
  [AV_PIX_FMT_RGBAF32BE] = {
  .name = "rgbaf32be",
  .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index af06d8dcac..99a78304bf 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -451,6 +451,9 @@ enum AVPixelFormat {
  AV_PIX_FMT_RGBA32BE,    ///< packed RGBA 32:32:32:32, 128bpp, 
RGBARGBA..., big-endian
  AV_PIX_FMT_RGBA32LE,    ///< packed RGBA 32:32:32:32, 128bpp, 
RGBARGBA..., little-endian
+    AV_PIX_FMT_RGB32BE, ///< packed RGBA 32:32:32, 96bpp, 
RGBRGB..., big-endian
+    AV_PIX_FMT_RGB32LE, ///< packed RGBA 32:32:32, 96bpp, 
RGBRGB..., little-endian

+
  AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE 
THIS if you want to link with shared libav* because the number of 
formats might differ between versions

  };
@@ -560,6 +563,7 @@ enum AVPixelFormat {
  #define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
  #define AV_PIX_FMT_RGBAF32    AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
+#define AV_PIX_FMT_RGB32  AV_PIX_FMT_NE(RGB32BE, RGB32LE)
  #define AV_PIX_FMT_RGBA32 AV_PIX_FMT_NE(RGBA32BE, RGBA32LE)
  /**


Ignore this patch, it doesn't exist.


Patch 5/7 depends on it, so you'd need to drop it too.



OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/4] lavu/pixfmt: add AV_PIX_FMT_RGBA128

2024-10-11 Thread Lynne via ffmpeg-devel
This format is useful for doing certain lossless transforms on images,
RCT in particular, which require you to escalate the size from 16 to
32 bits to avoid overflows.

APIchanges will be done alongside when comitting.
---
 libavutil/pixdesc.c | 27 +++
 libavutil/pixfmt.h  |  5 +
 2 files changed, 32 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 43b9c08e14..8736e4f47d 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2803,6 +2803,33 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT |
  AV_PIX_FMT_FLAG_ALPHA,
 },
+[AV_PIX_FMT_RGBA128BE] = {
+.name = "rgba128be",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 16,  0, 0, 32 },  /* R */
+{ 0, 16,  4, 0, 32 },  /* G */
+{ 0, 16,  8, 0, 32 },  /* B */
+{ 0, 16, 12, 0, 32 },  /* A */
+},
+.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB |
+ AV_PIX_FMT_FLAG_ALPHA,
+},
+[AV_PIX_FMT_RGBA128LE] = {
+.name = "rgba128le",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 16,  0, 0, 32 },  /* R */
+{ 0, 16,  4, 0, 32 },  /* G */
+{ 0, 16,  8, 0, 32 },  /* B */
+{ 0, 16, 12, 0, 32 },  /* A */
+},
+.flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+},
 [AV_PIX_FMT_P212BE] = {
 .name = "p212be",
 .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 3caa183ba0..f03e4d701d 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -448,6 +448,9 @@ enum AVPixelFormat {
 AV_PIX_FMT_V30XBE,  ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 
10Y 10U 2X(lsb), big-endian
 AV_PIX_FMT_V30XLE,  ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 
10Y 10U 2X(lsb), little-endian
 
+AV_PIX_FMT_RGBA128BE,   ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., 
big-endian
+AV_PIX_FMT_RGBA128LE,   ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., 
little-endian
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
@@ -558,6 +561,8 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
 #define AV_PIX_FMT_RGBAF32AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
 
+#define AV_PIX_FMT_RGBA128AV_PIX_FMT_NE(RGBA128BE, RGBA128LE)
+
 /**
   * Chromaticity coordinates of the source primaries.
   * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 
and ITU-T H.273.
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/4] vulkan: add support for AV_PIX_FMT_RGBA128

2024-10-11 Thread Lynne via ffmpeg-devel
---
 libavutil/hwcontext_vulkan.c |  1 +
 libavutil/vulkan.c   | 12 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 47e21fda83..98c25da1c1 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -323,6 +323,7 @@ static const struct FFVkFormatEntry {
 { VK_FORMAT_A2B10G10R10_UNORM_PACK32, AV_PIX_FMT_X2BGR10, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_A2B10G10R10_UNORM_PACK32 } },
 { VK_FORMAT_R32G32B32_SFLOAT, AV_PIX_FMT_RGBF32,  
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32_SFLOAT } },
 { VK_FORMAT_R32G32B32A32_SFLOAT,  AV_PIX_FMT_RGBAF32, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32A32_SFLOAT  } },
+{ VK_FORMAT_R32G32B32A32_UINT,AV_PIX_FMT_RGBA128, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32A32_UINT} },
 
 /* Planar RGB */
 { VK_FORMAT_R8_UNORM,   AV_PIX_FMT_GBRAP,VK_IMAGE_ASPECT_COLOR_BIT, 1, 
4, 4, { VK_FORMAT_R8_UNORM,   VK_FORMAT_R8_UNORM,   VK_FORMAT_R8_UNORM,   
VK_FORMAT_R8_UNORM   } },
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 661b2627c9..2ab485a83b 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -1282,7 +1282,8 @@ int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
 pix_fmt == AV_PIX_FMT_BGR565 || pix_fmt == AV_PIX_FMT_BGR0   ||
 pix_fmt == AV_PIX_FMT_0BGR   || pix_fmt == AV_PIX_FMT_RGB0   ||
 pix_fmt == AV_PIX_FMT_X2RGB10 || pix_fmt == AV_PIX_FMT_X2BGR10 ||
-pix_fmt == AV_PIX_FMT_RGBAF32 || pix_fmt == AV_PIX_FMT_RGBF32)
+pix_fmt == AV_PIX_FMT_RGBAF32 || pix_fmt == AV_PIX_FMT_RGBF32 ||
+pix_fmt == AV_PIX_FMT_RGBA128)
 return 1;
 return 0;
 }
@@ -1342,6 +1343,15 @@ const char *ff_vk_shader_rep_fmt(enum AVPixelFormat 
pix_fmt,
 };
 return rep_tab[rep_fmt];
 }
+case AV_PIX_FMT_RGBA128: {
+const char *rep_tab[] = {
+[FF_VK_REP_NATIVE] = "rgba32ui",
+[FF_VK_REP_FLOAT] = NULL,
+[FF_VK_REP_INT] = "rgba32i",
+[FF_VK_REP_UINT] = "rgba32ui",
+};
+return rep_tab[rep_fmt];
+}
 case AV_PIX_FMT_GRAY8:
 case AV_PIX_FMT_GBRAP:
 case AV_PIX_FMT_YUV420P:
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/4] lavu/pixfmt: add AV_PIX_FMT_RGB96

2024-10-11 Thread Lynne via ffmpeg-devel
---
 libavutil/pixdesc.c | 24 
 libavutil/pixfmt.h  |  4 
 2 files changed, 28 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 8736e4f47d..26ed941aea 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2775,6 +2775,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
 },
+[AV_PIX_FMT_RGB96BE] = {
+.name = "rgb96be",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 12, 0, 0, 32 },   /* R */
+{ 0, 12, 4, 0, 32 },   /* G */
+{ 0, 12, 8, 0, 32 },   /* B */
+},
+.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+},
+[AV_PIX_FMT_RGB96LE] = {
+.name = "rgb96le",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 12, 0, 0, 32 },   /* R */
+{ 0, 12, 4, 0, 32 },   /* G */
+{ 0, 12, 8, 0, 32 },   /* B */
+},
+.flags = AV_PIX_FMT_FLAG_RGB,
+},
 [AV_PIX_FMT_RGBAF32BE] = {
 .name = "rgbaf32be",
 .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index f03e4d701d..56df1e1a77 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -451,6 +451,9 @@ enum AVPixelFormat {
 AV_PIX_FMT_RGBA128BE,   ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., 
big-endian
 AV_PIX_FMT_RGBA128LE,   ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., 
little-endian
 
+AV_PIX_FMT_RGB96BE, ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., 
big-endian
+AV_PIX_FMT_RGB96LE, ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., 
little-endian
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
@@ -561,6 +564,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
 #define AV_PIX_FMT_RGBAF32AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
 
+#define AV_PIX_FMT_RGB96  AV_PIX_FMT_NE(RGB96BE, RGB96LE)
 #define AV_PIX_FMT_RGBA128AV_PIX_FMT_NE(RGBA128BE, RGBA128LE)
 
 /**
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/4] vulkan: add support for AV_PIX_FMT_RGB96

2024-10-11 Thread Lynne via ffmpeg-devel
---
 libavutil/hwcontext_vulkan.c | 1 +
 libavutil/vulkan.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 98c25da1c1..0555f0e670 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -323,6 +323,7 @@ static const struct FFVkFormatEntry {
 { VK_FORMAT_A2B10G10R10_UNORM_PACK32, AV_PIX_FMT_X2BGR10, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_A2B10G10R10_UNORM_PACK32 } },
 { VK_FORMAT_R32G32B32_SFLOAT, AV_PIX_FMT_RGBF32,  
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32_SFLOAT } },
 { VK_FORMAT_R32G32B32A32_SFLOAT,  AV_PIX_FMT_RGBAF32, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32A32_SFLOAT  } },
+{ VK_FORMAT_R32G32B32_UINT,   AV_PIX_FMT_RGB96,   
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32_UINT   } },
 { VK_FORMAT_R32G32B32A32_UINT,AV_PIX_FMT_RGBA128, 
VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32G32B32A32_UINT} },
 
 /* Planar RGB */
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 2ab485a83b..bd7a7ef102 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -1283,7 +1283,7 @@ int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
 pix_fmt == AV_PIX_FMT_0BGR   || pix_fmt == AV_PIX_FMT_RGB0   ||
 pix_fmt == AV_PIX_FMT_X2RGB10 || pix_fmt == AV_PIX_FMT_X2BGR10 ||
 pix_fmt == AV_PIX_FMT_RGBAF32 || pix_fmt == AV_PIX_FMT_RGBF32 ||
-pix_fmt == AV_PIX_FMT_RGBA128)
+pix_fmt == AV_PIX_FMT_RGBA128 || pix_fmt == AV_PIX_FMT_RGB96)
 return 1;
 return 0;
 }
@@ -1343,6 +1343,7 @@ const char *ff_vk_shader_rep_fmt(enum AVPixelFormat 
pix_fmt,
 };
 return rep_tab[rep_fmt];
 }
+case AV_PIX_FMT_RGB96:
 case AV_PIX_FMT_RGBA128: {
 const char *rep_tab[] = {
 [FF_VK_REP_NATIVE] = "rgba32ui",
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/3] avformat/dashdec: return ret directly in open_demux_for_component()

2024-10-11 Thread Steven Liu
Marth64  于2024年10月11日周五 15:06写道:
>
> Signed-off-by: Marth64 
> ---
>  libavformat/dashdec.c | 15 ++-
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 99ac6197be..9ce23aec65 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1939,16 +1939,15 @@ static int open_demux_for_component(AVFormatContext 
> *s, struct representation *p
>  }
>
>  ret = reopen_demux_for_component(s, pls);
> -if (ret < 0) {
> -goto fail;
> -}
> +if (ret < 0)
> +return ret;
> +
>  for (i = 0; i < pls->ctx->nb_streams; i++) {
>  AVStream *st = avformat_new_stream(s, NULL);
>  AVStream *ist = pls->ctx->streams[i];
> -if (!st) {
> -ret = AVERROR(ENOMEM);
> -goto fail;
> -}
> +if (!st)
> +return AVERROR(ENOMEM);
> +
>  st->id = i;
>  avcodec_parameters_copy(st->codecpar, ist->codecpar);
>  avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
> ist->time_base.den);
> @@ -1958,8 +1957,6 @@ static int open_demux_for_component(AVFormatContext *s, 
> struct representation *p
>  }
>
>  return 0;
> -fail:
> -return ret;
>  }
>
>  static int is_common_init_section_exist(struct representation **pls, int 
> n_pls)
> --
> 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".

LGTM

Thanks
Steven
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/3] avformat/dashdec: check return code of avcodec_parameters_copy()

2024-10-11 Thread Steven Liu
Marth64  于2024年10月11日周五 15:13写道:
>
> Signed-off-by: Marth64 
> ---
>  libavformat/dashdec.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 9ce23aec65..cd1b3da3a2 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1949,7 +1949,11 @@ static int open_demux_for_component(AVFormatContext 
> *s, struct representation *p
>  return AVERROR(ENOMEM);
>
>  st->id = i;
> -avcodec_parameters_copy(st->codecpar, ist->codecpar);
> +
> +ret = avcodec_parameters_copy(st->codecpar, ist->codecpar);
> +if (ret < 0)
> +return ret;
> +
>  avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
> ist->time_base.den);
>
>  // copy disposition
> --
> 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".

lgtm

Thanks
Steven
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v11 1/3] libavcodec/dnxucdec: DNxUncompressed decoder

2024-10-11 Thread Michael Niedermayer
Hi Martin

On Fri, Oct 11, 2024 at 04:12:54PM +0200, Martin Schitter wrote:
> On 11.10.24 10:57, Anton Khirnov wrote:
[...]
> But I immediately stumbled again over another nasty swscale related bug! :(
> 
> Just try it yourself:
> 
> First make a simple test with my last posted patch set:
> 
>   ./ffmpeg_g -i ./fate-suite/dnxuc/cb_rgb_float.mxf -c:v prores /tmp/out.mov
> 
> everything should simply work as expected
> 
> And now change line 348 of dnxucdec.c for float32 sub-format:
> 
> 
>  case MKTAG(' ','r','g','f'):
> -ret = fmt_frame(avctx, frame, avpkt, AV_PIX_FMT_GBRPF32LE, 96,
> float2planes);
> +ret = fmt_frame(avctx, frame, avpkt, AV_PIX_FMT_RGBF32LE, 96,
> pass_through);

If you look at format_entries in libswscale/utils.c
you will see that
[AV_PIX_FMT_GBRPF32LE]   = { 1, 1 },
[AV_PIX_FMT_GBRPF32BE]   = { 1, 1 },
Is supported, but AV_PIX_FMT_RGBF* is nowhere in the table of supported formats

Theres also sws_isSupportedInput() and sws_isSupportedOutput() that should show 
this

If you look at some of the recently posted patches by james, you can see
how new formats can be added to swscale

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [Uncompressed MP4] RFC - Draft Encoder

2024-10-11 Thread Michael Niedermayer
On Wed, Oct 09, 2024 at 07:38:43AM -0600, Devon Sookhoo wrote:
> With this patch, I was able to use the following command to generate an
> uncompressed mp4:
> $ ffmpeg  -i input.mp4   -c:v rawvideo   -pix_fmt rgb24   -tag:v uncv
>  out.mp4
> 
> The output file successfully played in GPAC.
> 
> My first question is whether to reuse the existing AV_CODEC_ID_RAWVIDEO, or
> if a brand new codec should be created specifically for handling
> uncompressed MP4 files. For those not familiar with ISO/IEC 23001-17:2024,
> this uncompressed codec has many input parameters, making it configurable
> enough to handle just about any type of data. A complete
> implementation would be quite involved which is why I'm questioning if
> "-c:v rawvideo" is the correct choice.
> 
> Any feedback would be greatly appreciated.

>  libavcodec/rawenc.c  |   18 ++
>  libavformat/movenc.c |   88 
> +++
>  2 files changed, 106 insertions(+)
> 84f6e16f8e6ae76bdbeb9517e94576a930fa4d01  
> 0001-Encode-RGB-interleaved-8-bit-uncompressed-mp4.patch
> From 62b59527bd25d7759b374fb47b398140df740946 Mon Sep 17 00:00:00 2001
> From: dukesook 
> Date: Tue, 24 Sep 2024 12:27:31 -0600
> Subject: [PATCH] Encode RGB interleaved 8 bit uncompressed mp4

breaks:
fate-mov-vfr

--- -   2024-10-11 22:55:50.346184682 +0200
+++ tests/data/fate/mov-vfr 2024-10-11 22:55:50.338195434 +0200
@@ -1 +1 @@
-1558b4a9398d8635783c93f84eb5a60d
+73f24e1cfcbbf1e6da06ff8658424df2
TESTshortest
TESTffmpeg-filter-in-eof
Test mov-vfr failed. Look at tests/data/fate/mov-vfr.err for details.
TESTffmpeg-streamcopy-t
make: *** [tests/Makefile:311: fate-mov-vfr] Error 1
make: *** Waiting for unfinished jobs

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/7] lavu/pixfmt: add AV_PIX_FMT_RGBA32

2024-10-11 Thread Michael Niedermayer
On Thu, Oct 10, 2024 at 07:32:45AM +0200, Lynne via ffmpeg-devel wrote:
> This format is useful for doing certain lossless transforms on images,
> RCT in particular, which require you to escalate the size from 16 to
> 32 bits to avoid overflows.
> 
> APIchanges will be done alongside when comitting.
> ---
>  libavutil/pixdesc.c | 27 +++
>  libavutil/pixfmt.h  |  4 
>  2 files changed, 31 insertions(+)

this needs at least am update to fate:
also iam not sure about the name rgba32 instead of rgba128

thx

TESTsws-pixdesc-query
--- ./tests/ref/fate/sws-pixdesc-query  2024-10-10 18:40:54.406975861 +0200
+++ tests/data/fate/sws-pixdesc-query   2024-10-11 23:01:16.276711814 +0200
@@ -178,6 +178,7 @@
   rgb48be
   rgb555be
   rgb565be
+  rgba32be
   rgba64be
   rgbaf16be
   rgbaf32be
@@ -538,6 +539,8 @@
   rgb565be
   rgb565le
   rgb8
+  rgba32be
+  rgba32le
   rgba64be
   rgba64le
   rgbaf16be
@@ -696,6 +699,8 @@
   rgb565be
   rgb565le
   rgb8
+  rgba32be
+  rgba32le
   rgba64be
   rgba64le
   rgbaf16be
@@ -731,6 +736,8 @@
   pal8
   rgb32
   rgb32_1
+  rgba32be
+  rgba32le
   rgba64be
   rgba64le
   rgbaf16be
@@ -821,6 +828,8 @@
   rgb565be
   rgb565le
   rgb8
+  rgba32be
+  rgba32le
   rgba64be
   rgba64le
   rgbaf16be
@@ -1025,6 +1034,8 @@
   rgb565be
   rgb565le
   rgb8
+  rgba32be
+  rgba32le
   rgba64be
   rgba64le
   rgbaf16be
Test sws-pixdesc-query failed. Look at tests/data/fate/sws-pixdesc-query.err 
for details.
make: *** [tests/Makefile:315: fate-sws-pixdesc-query] Error 1


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] libavcodec/Makefile: add a makefile for Vulkan shaders

2024-10-11 Thread Lynne via ffmpeg-devel
---
 libavcodec/Makefile| 10 +-
 libavcodec/vulkan/Makefile | 10 ++
 2 files changed, 11 insertions(+), 9 deletions(-)
 create mode 100644 libavcodec/vulkan/Makefile

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5df4b7cfc3..dd5d0de898 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -70,6 +70,7 @@ include $(SRC_PATH)/libavcodec/aac/Makefile
 include $(SRC_PATH)/libavcodec/hevc/Makefile
 include $(SRC_PATH)/libavcodec/opus/Makefile
 include $(SRC_PATH)/libavcodec/vvc/Makefile
+include $(SRC_PATH)/libavcodec/vulkan/Makefile
 -include $(SRC_PATH)/libavcodec/$(ARCH)/vvc/Makefile
 OBJS-$(CONFIG_AANDCTTABLES)+= aandcttab.o
 OBJS-$(CONFIG_AC3DSP)  += ac3dsp.o ac3.o ac3tab.o
@@ -1376,12 +1377,3 @@ $(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h
 $(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h
 $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
 endif
-
-clean::
-   $(RM) $(CLEANSUFFIXES:%=libavcodec/vulkan/%)
-
-VULKAN = $(subst $(SRC_PATH)/,,$(wildcard 
$(SRC_PATH)/libavcodec/vulkan/*.comp))
-.SECONDARY: $(VULKAN:.comp=.c)
-libavcodec/vulkan/%.c: TAG = VULKAN
-libavcodec/vulkan/%.c: $(SRC_PATH)/libavcodec/vulkan/%.comp
-   $(M)$(SRC_PATH)/tools/source2c $< $@
diff --git a/libavcodec/vulkan/Makefile b/libavcodec/vulkan/Makefile
new file mode 100644
index 00..96b4de0092
--- /dev/null
+++ b/libavcodec/vulkan/Makefile
@@ -0,0 +1,10 @@
+GEN_CLEANSUFFIXES = *.o *.c *.d
+
+clean::
+   $(RM) $(GEN_CLEANSUFFIXES:%=libavcodec/vulkan/%)
+
+VULKAN = $(subst $(SRC_PATH)/,,$(wildcard 
$(SRC_PATH)/libavcodec/vulkan/*.comp))
+.SECONDARY: $(VULKAN:.comp=.c)
+libavcodec/vulkan/%.c: TAG = VULKAN
+libavcodec/vulkan/%.c: $(SRC_PATH)/libavcodec/vulkan/%.comp
+   $(M)$(SRC_PATH)/tools/source2c $< $@
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/7] lavu/pixfmt: add AV_PIX_FMT_RGBA32

2024-10-11 Thread Lynne via ffmpeg-devel

On 11/10/2024 23:06, Michael Niedermayer wrote:

On Thu, Oct 10, 2024 at 07:32:45AM +0200, Lynne via ffmpeg-devel wrote:

This format is useful for doing certain lossless transforms on images,
RCT in particular, which require you to escalate the size from 16 to
32 bits to avoid overflows.

APIchanges will be done alongside when comitting.
---
  libavutil/pixdesc.c | 27 +++
  libavutil/pixfmt.h  |  4 
  2 files changed, 31 insertions(+)


this needs at least am update to fate:
also iam not sure about the name rgba32 instead of rgba128


Yeah, me neither. The thing is, the float equivalent of the format is 
RBGAF32.

I don't mind RGBA128, but are there any other suggestions?


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] lavc/hevcdec: unbreak WPP/progress2 code

2024-10-11 Thread Anton Khirnov
The "progress2" API in pthread_slice.c currently associates a progress
value with a thread rather than a job, relying on the broken assumption
that a job's thread number is equal to its job number modulo thread
count.

This removes this API entirely, and changes hevcdec to use a
ThreadProgress-based implementation that associates a
mutex/cond/progress value with every job.

Fixes races and deadlocks in hevdec with slice threading, e.g. some of
those mentioned in #11221.
---
Compared to the previous patch, this uses the ThreadProgress API instead
of duplicating it in pthread_slice.
---
 libavcodec/hevc/hevcdec.c  |  57 -
 libavcodec/hevc/hevcdec.h  |   3 ++
 libavcodec/pthread_slice.c | 102 -
 libavcodec/thread.h|   4 --
 libavcodec/utils.c |  19 ---
 5 files changed, 46 insertions(+), 139 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 0dc24f82f8..4e3fa39e49 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -54,6 +54,7 @@
 #include "progressframe.h"
 #include "refstruct.h"
 #include "thread.h"
+#include "threadprogress.h"
 
 static const uint8_t hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 
3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };
 
@@ -2751,6 +2752,8 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, 
void *hevc_lclist,
 const uint8_t *data  = s->data + s->sh.offset[ctb_row];
 const size_t   data_size = s->sh.size[ctb_row];
 
+int progress = 0;
+
 int ret;
 
 if (ctb_row)
@@ -2762,13 +2765,15 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, 
void *hevc_lclist,
 
 hls_decode_neighbour(lc, l, pps, sps, x_ctb, y_ctb, ctb_addr_ts);
 
-ff_thread_await_progress2(s->avctx, ctb_row, thread, SHIFT_CTB_WPP);
+if (ctb_row)
+ff_thread_progress_await(&s->wpp_progress[ctb_row - 1],
+ progress + SHIFT_CTB_WPP + 1);
 
 /* atomic_load's prototype requires a pointer to non-const atomic 
variable
  * (due to implementations via mutexes, where reads involve writes).
  * Of course, casting const away here is nevertheless safe. */
 if (atomic_load((atomic_int*)&s->wpp_err)) {
-ff_thread_report_progress2(s->avctx, ctb_row , thread, 
SHIFT_CTB_WPP);
+ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
 return 0;
 }
 
@@ -2792,19 +2797,19 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, 
void *hevc_lclist,
 ctb_addr_ts++;
 
 ff_hevc_save_states(lc, pps, ctb_addr_ts);
-ff_thread_report_progress2(s->avctx, ctb_row, thread, 1);
+ff_thread_progress_report(&s->wpp_progress[ctb_row], ++progress);
 ff_hevc_hls_filters(lc, l, pps, x_ctb, y_ctb, ctb_size);
 
 if (!more_data && (x_ctb+ctb_size) < sps->width && ctb_row != 
s->sh.num_entry_point_offsets) {
 /* Casting const away here is safe, because it is an atomic 
operation. */
 atomic_store((atomic_int*)&s->wpp_err, 1);
-ff_thread_report_progress2(s->avctx, ctb_row ,thread, 
SHIFT_CTB_WPP);
+ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
 return 0;
 }
 
 if ((x_ctb+ctb_size) >= sps->width && (y_ctb+ctb_size) >= sps->height 
) {
 ff_hevc_hls_filter(lc, l, pps, x_ctb, y_ctb, ctb_size);
-ff_thread_report_progress2(s->avctx, ctb_row , thread, 
SHIFT_CTB_WPP);
+ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
 return ctb_addr_ts;
 }
 ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts];
@@ -2814,17 +2819,43 @@ static int hls_decode_entry_wpp(AVCodecContext *avctx, 
void *hevc_lclist,
 break;
 }
 }
-ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
+ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
 
 return 0;
 error:
 l->tab_slice_address[ctb_addr_rs] = -1;
 /* Casting const away here is safe, because it is an atomic operation. */
 atomic_store((atomic_int*)&s->wpp_err, 1);
-ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
+ff_thread_progress_report(&s->wpp_progress[ctb_row], INT_MAX);
 return ret;
 }
 
+static int wpp_progress_init(HEVCContext *s, unsigned count)
+{
+if (s->nb_wpp_progress < count) {
+void *tmp = av_realloc_array(s->wpp_progress, count,
+ sizeof(*s->wpp_progress));
+if (!tmp)
+return AVERROR(ENOMEM);
+
+s->wpp_progress = tmp;
+memset(s->wpp_progress + s->nb_wpp_progress, 0,
+   (count - s->nb_wpp_progress) * sizeof(*s->wpp_progress));
+
+for (int i = s->nb_wpp_progress; i < count; i++) {
+int ret = ff_thread_progress_init(&s->wpp_progress[i], 1);
+if

Re: [FFmpeg-devel] [PATCH v11 1/3] libavcodec/dnxucdec: DNxUncompressed decoder

2024-10-11 Thread Martin Schitter




On 11.10.24 10:57, Anton Khirnov wrote:
 It seems rather obvious to me - you're making a demuxer export something

that IS raw video, yet you're tagging it as a new codec ID with a new
decoder that (for these specific pixel format) duplicates what the
rawvideo decoder does.

Just to be clear, I'm not saying the entirety of your decoder should be
handled in the demuxer - just those pixel formats that can be. That
would also have the advantage that the remainder of your decoder could
now enable direct rendering.


**Wherever it is possible** I simply set the correct pixel format found 
by the  dnxuc_parser in avcontext and use a simple pass_through() 
routine to transfer the raw packet data without any further processing 
as frame data!


That's more or less the same mechanism as used in 
libavcodec/bitpacked_dec.c for uyvy422 data.


But if you look at the central dispatcher in my decoder, you'll see, 
that this pass_through solution can be only used in 2 cases of the 8 
already supported kinds of payload. For all other types of data there is 
simply no exact fitting ffmpeg pixel format available or it doesn't work 
satisfying in practice.


In the case of all 10 and 12bit variants DNxUncmpressed uses a very 
uncommon kind of line-based bitpacking, which you will hardly find 
somewhere else. This has to be preprocessed and translated into more 
common binary arrangements by this decoder.


But in case of the float variants I had to fight missing support and 
disappointing defects in swscaler.



+static int float2planes(AVCodecContext *avctx, AVFrame *frame, const AVPacket 
*pkt)
+{
+int lw;
+const size_t sof = 4;
+
+lw = frame->width;
+
+for(int y = 0; y < frame->height; y++){
+for(int x = 0; x < frame->width; x++){
+memcpy(&frame->data[2][sof*(lw*y + x)], &pkt->data[sof* 3*(lw*y + 
x)], sof);
+memcpy(&frame->data[0][sof*(lw*y + x)], &pkt->data[sof*(3*(lw*y + 
x) + 1)], sof);
+memcpy(&frame->data[1][sof*(lw*y + x)], &pkt->data[sof*(3*(lw*y + 
x) + 2)], sof);
+}
+}


Same here, deinterleaving packed to planar is a job for swscale.


Do you really think, I'm a stupid idiot and didn't try to handle it in 
this much more simple unmodified manner first?


Sure, I did!!
But I immediately stumbled again over another nasty swscale related bug! :(

Just try it yourself:

First make a simple test with my last posted patch set:

  ./ffmpeg_g -i ./fate-suite/dnxuc/cb_rgb_float.mxf -c:v prores 
/tmp/out.mov


everything should simply work as expected

And now change line 348 of dnxucdec.c for float32 sub-format:


 case MKTAG(' ','r','g','f'):
-ret = fmt_frame(avctx, frame, avpkt, AV_PIX_FMT_GBRPF32LE, 
96, float2planes);
+ret = fmt_frame(avctx, frame, avpkt, AV_PIX_FMT_RGBF32LE, 
96, pass_through);


Now it's using the pass_through() mechanism and utilizes unmodified 
packed float input data instead of this clumsy rearrangement, but the 
same simple test command as before will not work anymore!


You'll get an error report, that ffmpeg couldn't figure out any working 
pipeline resp. pixel format transformation to connect the input data 
with anything else...


[vist#0:0/dnxuc @ 0x55e980fd7a00] [dec:dnxuc @ 0x55e981460f40] Decoder 
thread received EOF packet
[graph -1 input from stream 0:0 @ 0x7fb644002380] w:512 h:256 
pixfmt:rgbf32le tb:1/24 fr:24/1 sar:1/1 csp:bt709 range:unknown
[format @ 0x7fb6440029c0] Setting 'pix_fmts' to value 
'yuv422p10le|yuv444p10le|yuva444p10le'

[format @ 0x7fb6440029c0] Setting 'color_ranges' to value 'tv'
[auto_scale_0 @ 0x7fb644004340] w:iw h:ih flags:'' interl:0
[format @ 0x7fb6440029c0] auto-inserting filter 'auto_scale_0' between 
the filter 'Parsed_null_0' and the filter 'format'
Impossible to convert between the formats supported by the filter 
'Parsed_null_0' and the filter 'auto_scale_0'


That's why I had to add this crazy workaround in this particular case!

But I already told you about all these really disappointing experiences:


Some of these rather inefficient interleave<->planar conversions where
just necessary in practice, because swscale wasn't able to figure out a
working pipeline construction otherwise, although in theory the affected
pixel format closer to the data input should be supported and work as
well!:(

At the end I just looked for something that simply works in real world, too!


But we do have a packed RGBF32 pixel format, how is it different from
this?


Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/5] lavc/vvc_mc: R-V V put_pixels

2024-10-11 Thread uk7b
From: sunyuechi 

  k230   
banana_f3
put_chroma_pixels_8_4x4_c:  61.5 ( 1.00x)69.5 ( 
1.00x)
put_chroma_pixels_8_4x4_rvv_i32:33.8 ( 1.82x)38.2 ( 
1.82x)
put_chroma_pixels_8_8x8_c: 219.1 ( 1.00x)246.5 
( 1.00x)
put_chroma_pixels_8_8x8_rvv_i32:70.8 ( 3.09x)59.2 ( 
4.16x)
put_chroma_pixels_8_16x16_c:   830.3 ( 1.00x)830.0 
( 1.00x)
put_chroma_pixels_8_16x16_rvv_i32: 181.8 ( 4.57x)142.5 
( 5.82x)
put_chroma_pixels_8_32x32_c:  3246.8 ( 1.00x)3247.0 
( 1.00x)
put_chroma_pixels_8_32x32_rvv_i32: 506.1 ( 6.42x)330.0 
( 9.84x)
put_chroma_pixels_8_64x64_c: 13616.8 ( 1.00x)
12967.0 ( 1.00x)
put_chroma_pixels_8_64x64_rvv_i32:1672.5 ( 8.14x)996.8 
(13.01x)
put_chroma_pixels_8_128x128_c:   54263.6 ( 1.00x)
52002.2 ( 1.00x)
put_chroma_pixels_8_128x128_rvv_i32:  9181.8 ( 5.91x)3611.8 
(14.40x)
put_luma_pixels_8_4x4_c:61.5 ( 1.00x)69.8 ( 
1.00x)
put_luma_pixels_8_4x4_rvv_i32:  33.8 ( 1.82x)28.0 ( 
2.49x)
put_luma_pixels_8_8x8_c:   219.1 ( 1.00x)226.0 
( 1.00x)
put_luma_pixels_8_8x8_rvv_i32:  80.3 ( 2.73x)59.2 ( 
3.81x)
put_luma_pixels_8_16x16_c: 830.3 ( 1.00x)830.2 
( 1.00x)
put_luma_pixels_8_16x16_rvv_i32:   181.8 ( 4.57x)142.5 
( 5.83x)
put_luma_pixels_8_32x32_c:3256.1 ( 1.00x)3247.2 
( 1.00x)
put_luma_pixels_8_32x32_rvv_i32:   506.1 ( 6.43x)361.2 
( 8.99x)
put_luma_pixels_8_64x64_c:   14042.5 ( 1.00x)
12977.2 ( 1.00x)
put_luma_pixels_8_64x64_rvv_i32:  1681.8 ( 8.35x)1007.0 
(12.89x)
put_luma_pixels_8_128x128_c: 54291.3 ( 1.00x)
53700.5 ( 1.00x)
put_luma_pixels_8_128x128_rvv_i32:   10700.0 ( 5.07x)3684.8 
(14.57x)
---
 libavcodec/riscv/vvc/vvc_mc_rvv.S  | 61 ++
 libavcodec/riscv/vvc/vvcdsp_init.c | 22 +++
 2 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S 
b/libavcodec/riscv/vvc/vvc_mc_rvv.S
index 2c634af48f..7300889430 100644
--- a/libavcodec/riscv/vvc/vvc_mc_rvv.S
+++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S
@@ -158,7 +158,7 @@
 .endm
 
 
-.macro AVG_JMP_TABLE id, vlen
+.macro POW2_JMP_TABLE id, vlen
 const jmp_table_\id\vlen
 .4byte \id\()2\vlen\()f - jmp_table_\id\vlen
 .4byte \id\()4\vlen\()f - jmp_table_\id\vlen
@@ -170,8 +170,8 @@ const jmp_table_\id\vlen
 endconst
 .endm
 
-.macro AVG_J vlen, id
-clz   t1, a4
+.macro POW2_J vlen, id, w
+clz   t1, \w
 neg   t1, t1
 lla   t5, jmp_table_\id\vlen
 sh2addt1, t1, t5
@@ -183,9 +183,9 @@ endconst
 .macro func_avg vlen
 func ff_vvc_avg_8_rvv_\vlen\(), zve32x, zbb, zba
 lpad0
-AVG_JMP_TABLE 1, \vlen
+POW2_JMP_TABLE1, \vlen
 csrwi vxrm, 0
-AVG_J \vlen, 1
+POW2_J\vlen, 1, a4
 .irp w,2,4,8,16,32,64,128
 avg   \w, \vlen, 1
 .endr
@@ -265,7 +265,7 @@ func_avg 256
 .macro func_w_avg vlen
 func ff_vvc_w_avg_8_rvv_\vlen\(), zve32x, zbb, zba
 lpad0
-AVG_JMP_TABLE 2, \vlen
+POW2_JMP_TABLE2, \vlen
 csrwi vxrm, 0
 addi  t6, a6, 7
 ldt3, (sp)
@@ -275,7 +275,7 @@ func ff_vvc_w_avg_8_rvv_\vlen\(), zve32x, zbb, zba
 add   t4, t4, t5
 addi  t5, t6, -1  // shift - 1
 sll   t4, t4, t5
-AVG_J \vlen, 2
+POW2_J\vlen, 2, a4
 .irp w,2,4,8,16,32,64,128
 w_avg \w, \vlen, 2
 .endr
@@ -405,3 +405,50 @@ func_dmvr \vlen, dmvr_h
 func_dmvr \vlen, dmvr_v
 func_dmvr \vlen, dmvr_hv
 .endr
+
+.macro put_pixels w, vlen, id
+\id\w\vlen:
+vsetvlstatic16\w, \vlen
+.if \w == 128 && \vlen == 128
+1:
+addi  t0, a1, 64
+addi  t1, a0, 64*2
+vle8.vv0, (a1)
+vle8.vv16, (t0)
+vzext.vf2 v8, v0
+vzext.vf2 v24, v16
+vsll.vi   v8, v8, 6
+vsll.vi   v24, v24, 6
+vse16.v   v8, (a0)
+vse16.v   v24, (t1)
+add   a1, a1, a2
+addi  a3, a3, -1
+addi  a0, a0, 128*2
+bnez  a3, 1b
+.else
+1:
+vle8.v   

[FFmpeg-devel] [PATCH 4/5] lavc/hevc: R-V V pel_uni(pow2)

2024-10-11 Thread uk7b
From: sunyuechi 

  k230   
banana_f3
put_hevc_pel_uni_pixels4_8_c:  126.3 ( 1.00x)90.5 ( 
1.00x)
put_hevc_pel_uni_pixels4_8_rvv_i32: 24.6 ( 5.14x)17.5 ( 
5.18x)
put_hevc_pel_uni_pixels8_8_c:  293.1 ( 1.00x)153.0 
( 1.00x)
put_hevc_pel_uni_pixels8_8_rvv_i32: 34.1 ( 8.60x)38.5 ( 
3.98x)
put_hevc_pel_uni_pixels16_8_c:1172.6 ( 1.00x)288.2 
( 1.00x)
put_hevc_pel_uni_pixels16_8_rvv_i32:61.6 (19.04x)48.7 ( 
5.92x)
put_hevc_pel_uni_pixels32_8_c:1135.8 ( 1.00x)517.5 
( 1.00x)
put_hevc_pel_uni_pixels32_8_rvv_i32:   209.8 ( 5.41x)121.7 
( 4.25x)
put_hevc_pel_uni_pixels64_8_c:2617.1 ( 1.00x)1257.0 
( 1.00x)
put_hevc_pel_uni_pixels64_8_rvv_i32:   709.6 ( 3.69x)486.2 
( 2.59x)
---
 libavcodec/hevc/dsp.c   |  2 +
 libavcodec/hevc/dsp.h   |  1 +
 libavcodec/riscv/Makefile   |  2 +
 libavcodec/riscv/hevcdsp.h  | 32 +
 libavcodec/riscv/hevcdsp_init.c | 80 +
 5 files changed, 117 insertions(+)
 create mode 100644 libavcodec/riscv/hevcdsp.h
 create mode 100644 libavcodec/riscv/hevcdsp_init.c

diff --git a/libavcodec/hevc/dsp.c b/libavcodec/hevc/dsp.c
index 60f059292c..c2e72cd0f5 100644
--- a/libavcodec/hevc/dsp.c
+++ b/libavcodec/hevc/dsp.c
@@ -265,6 +265,8 @@ int i = 0;
 ff_hevc_dsp_init_arm(hevcdsp, bit_depth);
 #elif ARCH_PPC
 ff_hevc_dsp_init_ppc(hevcdsp, bit_depth);
+#elif ARCH_RISCV
+ff_hevc_dsp_init_riscv(hevcdsp, bit_depth);
 #elif ARCH_X86
 ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
 #elif ARCH_MIPS
diff --git a/libavcodec/hevc/dsp.h b/libavcodec/hevc/dsp.h
index 02b8e0e8e2..6d77a470ff 100644
--- a/libavcodec/hevc/dsp.h
+++ b/libavcodec/hevc/dsp.h
@@ -133,6 +133,7 @@ extern const int8_t ff_hevc_qpel_filters[4][16];
 void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth);
+void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth);
diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 1f1fa03329..a80d2fa2e7 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -35,6 +35,8 @@ RVV-OBJS-$(CONFIG_H264DSP) += riscv/h264addpx_rvv.o 
riscv/h264dsp_rvv.o \
   riscv/h264idct_rvv.o
 OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_init.o
 RVV-OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_rvv.o
+OBJS-$(CONFIG_HEVC_DECODER) += riscv/hevcdsp_init.o
+RVV-OBJS-$(CONFIG_HEVC_DECODER)  += riscv/h26x/h2656_inter_rvv.o
 OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o
 RVV-OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_rvv.o
 OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
diff --git a/libavcodec/riscv/hevcdsp.h b/libavcodec/riscv/hevcdsp.h
new file mode 100644
index 00..7b42e49f41
--- /dev/null
+++ b/libavcodec/riscv/hevcdsp.h
@@ -0,0 +1,32 @@
+/*
+ * HEVC video decoder
+ *
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_RISCV_HEVCDSP_H
+#define AVCODEC_RISCV_HEVCDSP_H
+
+#include 
+#include 
+
+void ff_hevc_put_hevc_pel_uni_pixels_8_rvv_256(uint8_t *dst, ptrdiff_t 
dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, 
intptr_t my,int width);
+void ff_hevc_put_hevc_pel_uni_pixels_8_rvv_128(uint8_t *dst, ptrdiff_t 
dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, 
intptr_t my,int width);
+
+#endif // AVCODEC_RISCV_HEVCDSP_H
diff --git a/libavcodec/riscv/hevcdsp_init.c b/libavcodec/riscv/hevcdsp_init.c
new file mode 100644
index 00..c00cf016a5
--- /dev/null
+++ b/libavcodec/riscv/hevcdsp_init.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (

[FFmpeg-devel] [PATCH 2/5] lavc/riscv: Move VVC macro to h26x

2024-10-11 Thread uk7b
From: sunyuechi 

---
 libavcodec/riscv/h26x/asm.S   | 127 ++
 libavcodec/riscv/vvc/vvc_mc_rvv.S | 109 +
 2 files changed, 128 insertions(+), 108 deletions(-)
 create mode 100644 libavcodec/riscv/h26x/asm.S

diff --git a/libavcodec/riscv/h26x/asm.S b/libavcodec/riscv/h26x/asm.S
new file mode 100644
index 00..1b8453d825
--- /dev/null
+++ b/libavcodec/riscv/h26x/asm.S
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/riscv/asm.S"
+
+.macro vsetvlstatic8 w, vlen
+.if \w == 2 && \vlen == 128
+vsetivlizero, \w, e8, mf8, ta, ma
+.elseif \w <= 4 && \vlen == 128
+vsetivlizero, \w, e8, mf4, ta, ma
+.elseif \w <= 8 && \vlen == 128
+vsetivlizero, \w, e8, mf2, ta, ma
+.elseif \w <= 16 && \vlen == 128
+vsetivlizero, \w, e8, m1, ta, ma
+.elseif \w <= 32 && \vlen == 128
+li  t0, \w
+vsetvli zero, t0, e8, m2, ta, ma
+.elseif \w <= 4 && \vlen == 256
+vsetivlizero, \w, e8, mf8, ta, ma
+.elseif \w <= 8 && \vlen == 256
+vsetivlizero, \w, e8, mf4, ta, ma
+.elseif \w <= 16 && \vlen == 256
+vsetivlizero, \w, e8, mf2, ta, ma
+.elseif \w <= 32 && \vlen == 256
+li  t0, \w
+vsetvli zero, t0, e8, m1, ta, ma
+.elseif \w <= 64 && \vlen == 256
+li  t0, \w
+vsetvli zero, t0, e8, m2, ta, ma
+.else
+li  t0, \w
+vsetvli zero, t0, e8, m4, ta, ma
+.endif
+.endm
+
+.macro vsetvlstatic16 w, vlen
+.if \w == 2 && \vlen == 128
+vsetivlizero, \w, e16, mf4, ta, ma
+.elseif \w <= 4 && \vlen == 128
+vsetivlizero, \w, e16, mf2, ta, ma
+.elseif \w <= 8 && \vlen == 128
+vsetivlizero, \w, e16, m1, ta, ma
+.elseif \w <= 16 && \vlen == 128
+vsetivlizero, \w, e16, m2, ta, ma
+.elseif \w <= 32 && \vlen == 128
+li  t0, \w
+vsetvli zero, t0, e16, m4, ta, ma
+.elseif \w <= 4 && \vlen == 256
+vsetivlizero, \w, e16, mf4, ta, ma
+.elseif \w <= 8 && \vlen == 256
+vsetivlizero, \w, e16, mf2, ta, ma
+.elseif \w <= 16 && \vlen == 256
+vsetivlizero, \w, e16, m1, ta, ma
+.elseif \w <= 32 && \vlen == 256
+li  t0, \w
+vsetvli zero, t0, e16, m2, ta, ma
+.elseif \w <= 64 && \vlen == 256
+li  t0, \w
+vsetvli zero, t0, e16, m4, ta, ma
+.else
+li  t0, \w
+vsetvli zero, t0, e16, m8, ta, ma
+.endif
+.endm
+
+.macro vsetvlstatic32 w, vlen
+.if \w == 2
+vsetivlizero, \w, e32, mf2, ta, ma
+.elseif \w <= 4 && \vlen == 128
+vsetivlizero, \w, e32, m1, ta, ma
+.elseif \w <= 8 && \vlen == 128
+vsetivlizero, \w, e32, m2, ta, ma
+.elseif \w <= 16 && \vlen == 128
+vsetivlizero, \w, e32, m4, ta, ma
+.elseif \w <= 4 && \vlen == 256
+vsetivlizero, \w, e32, mf2, ta, ma
+.elseif \w <= 8 && \vlen == 256
+vsetivlizero, \w, e32, m1, ta, ma
+.elseif \w <= 16 && \vlen == 256
+vsetivlizero, \w, e32, m2, ta, ma
+.elseif \w <= 32 && \vlen == 256
+li  t0, \w
+vsetvli zero, t0, e32, m4, ta, ma
+.else
+li  t0, \w
+vsetvli zero, t0, e32, m8, ta, ma
+.endif
+.endm
+
+.macro POW2_JMP_TABLE id, vlen
+const jmp_table_\id\vlen
+.4b

[FFmpeg-devel] [PATCH 3/5] lavc/vvc_mc: R-V V put_uni_pixels

2024-10-11 Thread uk7b
From: sunyuechi 

  k230   
banana_f3
put_uni_pixels_chroma_8_4x4_c: 128.3 ( 1.00x)90.5 ( 
1.00x)
put_uni_pixels_chroma_8_4x4_rvv_i32:17.6 ( 7.30x)17.4 ( 
5.18x)
put_uni_pixels_chroma_8_8x8_c: 295.1 ( 1.00x)163.2 
( 1.00x)
put_uni_pixels_chroma_8_8x8_rvv_i32:35.8 ( 8.24x)27.9 ( 
5.84x)
put_uni_pixels_chroma_8_16x16_c:   619.3 ( 1.00x)267.4 
( 1.00x)
put_uni_pixels_chroma_8_16x16_rvv_i32:  72.8 ( 8.50x)48.7 ( 
5.49x)
put_uni_pixels_chroma_8_32x32_c:  1433.8 ( 1.00x)538.2 
( 1.00x)
put_uni_pixels_chroma_8_32x32_rvv_i32: 230.3 ( 6.23x)236.2 
( 2.28x)
put_uni_pixels_chroma_8_64x64_c:  3517.3 ( 1.00x)1455.0 
( 1.00x)
put_uni_pixels_chroma_8_64x64_rvv_i32: 813.6 ( 4.32x)590.2 
( 2.47x)
put_uni_pixels_chroma_8_128x128_c:   10174.6 ( 1.00x)5798.7 
( 1.00x)
put_uni_pixels_chroma_8_128x128_rvv_i32:  2989.3 ( 3.40x)2371.4 
( 2.45x)
put_uni_pixels_luma_8_4x4_c:   128.6 ( 1.00x)90.5 ( 
1.00x)
put_uni_pixels_luma_8_4x4_rvv_i32:  17.3 ( 7.42x)17.4 ( 
5.18x)
put_uni_pixels_luma_8_8x8_c:   295.1 ( 1.00x)142.4 
( 1.00x)
put_uni_pixels_luma_8_8x8_rvv_i32:  26.6 (11.10x)27.9 ( 
5.10x)
put_uni_pixels_luma_8_16x16_c: 600.6 ( 1.00x)277.7 
( 1.00x)
put_uni_pixels_luma_8_16x16_rvv_i32:82.1 ( 7.32x)48.7 ( 
5.70x)
put_uni_pixels_luma_8_32x32_c:1406.1 ( 1.00x)528.0 
( 1.00x)
put_uni_pixels_luma_8_32x32_rvv_i32:   230.3 ( 6.10x)131.9 
( 4.00x)
put_uni_pixels_luma_8_64x64_c:4600.6 ( 1.00x)1309.2 
( 1.00x)
put_uni_pixels_luma_8_64x64_rvv_i32:  1073.1 ( 4.29x)382.2 
( 3.43x)
put_uni_pixels_luma_8_128x128_c: 11350.3 ( 1.00x)3506.9 
( 1.00x)
put_uni_pixels_luma_8_128x128_rvv_i32:3119.1 ( 3.64x)2017.5 
( 1.74x)
---
 libavcodec/riscv/h26x/h2656_inter_rvv.S | 53 +
 libavcodec/riscv/h26x/h2656dsp.h| 33 +++
 libavcodec/riscv/vvc/Makefile   |  3 +-
 libavcodec/riscv/vvc/vvcdsp_init.c  |  5 +++
 4 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/riscv/h26x/h2656_inter_rvv.S
 create mode 100644 libavcodec/riscv/h26x/h2656dsp.h

diff --git a/libavcodec/riscv/h26x/h2656_inter_rvv.S 
b/libavcodec/riscv/h26x/h2656_inter_rvv.S
new file mode 100644
index 00..6692e33acf
--- /dev/null
+++ b/libavcodec/riscv/h26x/h2656_inter_rvv.S
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavcodec/riscv/h26x/asm.S"
+
+.macro put_uni_pixels w, vlen, id
+\id\w\vlen:
+.if \w == 128 && \vlen == 128
+lit0, \w
+vsetvli   zero, t0, e8, m8, ta, ma
+.else
+vsetvlstatic8 \w, \vlen
+.endif
+1:
+vle8.vv0, (a2)
+addi  a4, a4, -1
+vse8.vv0, (a0)
+add   a2, a2, a3
+add   a0, a0, a1
+bnez  a4, 1b
+ret
+.endm
+
+.macro func_put_uni_pixels vlen
+func ff_h2656_put_uni_pixels_8_rvv_\vlen\(), zve32x, zbb, zba
+lpad0
+POW2_JMP_TABLE4, \vlen
+POW2_J\vlen, 4, a7
+.irp w,2,4,8,16,32,64,128
+put_uni_pixels\w, \vlen, 4
+.endr
+endfunc
+.endm
+
+func_put_uni_pixels 256
+func_put_uni_pixels 128
diff --git a/libavcodec/riscv/h26x/h2656dsp.h b/libavcodec/riscv/h26x/h2656dsp.h
new file mode 100644
index 00..41ba6bc331
--- /dev/null
+++ b/libavcodec/riscv/h26x/h2656dsp.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms o

[FFmpeg-devel] [PATCH 5/5] lavc/vvc_mc: R-V V sad

2024-10-11 Thread uk7b
From: sunyuechi 

k230   banana_f3
sad_8x16_c:  385.9 ( 1.00x)403.1 ( 1.00x)
sad_8x16_rvv_i32:108.1 ( 3.57x)100.8 ( 4.00x)
sad_16x8_c:  376.6 ( 1.00x)392.6 ( 1.00x)
sad_16x8_rvv_i32: 89.3 ( 4.21x)69.5 ( 5.64x)
sad_16x16_c: 746.6 ( 1.00x)757.3 ( 1.00x)
sad_16x16_rvv_i32:   135.8 ( 5.50x)121.5 ( 6.23x)
---
 libavcodec/riscv/vvc/Makefile  |  1 +
 libavcodec/riscv/vvc/vvc_sad_rvv.S | 58 ++
 libavcodec/riscv/vvc/vvcdsp_init.c |  7 
 3 files changed, 66 insertions(+)
 create mode 100644 libavcodec/riscv/vvc/vvc_sad_rvv.S

diff --git a/libavcodec/riscv/vvc/Makefile b/libavcodec/riscv/vvc/Makefile
index ec116aebc1..0778947b63 100644
--- a/libavcodec/riscv/vvc/Makefile
+++ b/libavcodec/riscv/vvc/Makefile
@@ -1,3 +1,4 @@
 OBJS-$(CONFIG_VVC_DECODER) += riscv/vvc/vvcdsp_init.o
 RVV-OBJS-$(CONFIG_VVC_DECODER) += riscv/vvc/vvc_mc_rvv.o \
+  riscv/vvc/vvc_sad_rvv.o \
   riscv/h26x/h2656_inter_rvv.o
diff --git a/libavcodec/riscv/vvc/vvc_sad_rvv.S 
b/libavcodec/riscv/vvc/vvc_sad_rvv.S
new file mode 100644
index 00..acdc78d20d
--- /dev/null
+++ b/libavcodec/riscv/vvc/vvc_sad_rvv.S
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavcodec/riscv/h26x/asm.S"
+
+.macro func_sad vlen
+func ff_vvc_sad_rvv_\vlen, zve32x, zbb, zba
+lpad0
+slli  t2, a3, 7  // dy * 128
+lit1, 4*128+4
+add   t0, t2, a2 // dy * 128 + dx
+sub   t1, t1, t2
+sub   t1, t1, a2
+sh1adda0, t0, a0
+sh1adda1, t1, a1
+vsetvlstatic321, \vlen
+lit0, 16
+vmv.s.x   v0, zero
+beq   a4, t0, SAD\vlen\()16
+.irp w,8,16
+SAD\vlen\w:
+vsetvlstatic16\w, \vlen
+addi  a5, a5, -2
+vle16.v   v8, (a0)
+vle16.v   v16, (a1)
+vwsub.vv  v24, v8, v16
+vsetvlstatic32\w, \vlen
+vneg.vv16, v24
+addi  a0, a0, 2 * 128 * 2
+vmax.vv   v24, v24, v16
+vredsum.vsv0, v24, v0
+addi  a1, a1, 2 * 128 * 2
+bnez  a5, SAD\vlen\w
+vmv.x.s   a0, v0
+ret
+.endr
+endfunc
+.endm
+
+func_sad 256
+func_sad 128
diff --git a/libavcodec/riscv/vvc/vvcdsp_init.c 
b/libavcodec/riscv/vvc/vvcdsp_init.c
index 5b189a9497..019b252fcb 100644
--- a/libavcodec/riscv/vvc/vvcdsp_init.c
+++ b/libavcodec/riscv/vvc/vvcdsp_init.c
@@ -59,6 +59,9 @@ DMVR_PROTOTYPES(8, rvv_256)
 c->inter.dmvr[1][1]   = ff_vvc_dmvr_hv_##bd##_##opt;   \
 } while (0)
 
+int ff_vvc_sad_rvv_128(const int16_t *src0, const int16_t *src1, int dx, int 
dy, int block_w, int block_h);
+int ff_vvc_sad_rvv_256(const int16_t *src0, const int16_t *src1, int dx, int 
dy, int block_w, int block_h);
+
 #define PUT_PIXELS_PROTOTYPES2(bd, opt)
  \
 void bf(ff_vvc_put_pixels, bd, opt)(int16_t *dst,  
  \
 const uint8_t *_src, const ptrdiff_t _src_stride,  
  \
@@ -98,6 +101,8 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const int 
bd)
 FUNCS(LUMA, rvv_256);
 FUNCS(CHROMA, rvv_256);
 break;
+case 10:
+c->inter.sad  = ff_vvc_sad_rvv_256;
 default:
 break;
 }
@@ -113,6 +118,8 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const 
int bd)
 FUNCS(LUMA, rvv_128);
 FUNCS(CHROMA, rvv_128);
 break;
+case 10:
+c->inter.sad  = ff_vvc_sad_rvv_128;
 default:
 break;
 }
-- 
2.47.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmp

Re: [FFmpeg-devel] [PATCH 2/2] lavc/vvc_mc: R-V V dmvr

2024-10-11 Thread flow gg
ping. ([PATCH 1/5] lavc/vvc_mc: R-V V put_pixels is after this)

 于2024年9月29日周日 00:47写道:

> From: sunyuechi 
>
>  k230   banana_f3
> dmvr_8_12x20_c:   619.3 ( 1.00x)624.1 ( 1.00x)
> dmvr_8_12x20_rvv_i32: 128.6 ( 4.82x)103.4 ( 6.04x)
> dmvr_8_20x12_c:   610.0 ( 1.00x)665.6 ( 1.00x)
> dmvr_8_20x12_rvv_i32: 137.6 ( 4.44x)92.9 ( 7.17x)
> dmvr_8_20x20_c:  1008.0 ( 1.00x)1082.7 ( 1.00x)
> dmvr_8_20x20_rvv_i32: 221.1 ( 4.56x)155.4 ( 6.97x)
> dmvr_h_8_12x20_c:2008.0 ( 1.00x)2009.7 ( 1.00x)
> dmvr_h_8_12x20_rvv_i32:   239.6 ( 8.38x)186.7 (10.77x)
> dmvr_h_8_20x12_c:1989.5 ( 1.00x)2009.4 ( 1.00x)
> dmvr_h_8_20x12_rvv_i32:   230.3 ( 8.64x)155.4 (12.93x)
> dmvr_h_8_20x20_c:3304.1 ( 1.00x)3342.9 ( 1.00x)
> dmvr_h_8_20x20_rvv_i32:   378.3 ( 8.73x)248.9 (13.43x)
> dmvr_hv_8_12x20_c:   3609.8 ( 1.00x)3603.4 ( 1.00x)
> dmvr_hv_8_12x20_rvv_i32:  369.1 ( 9.78x)322.1 (11.19x)
> dmvr_hv_8_20x12_c:   3628.3 ( 1.00x)3624.2 ( 1.00x)
> dmvr_hv_8_20x12_rvv_i32:  322.8 (11.24x)238.7 (15.19x)
> dmvr_hv_8_20x20_c:   5933.8 ( 1.00x)5936.6 ( 1.00x)
> dmvr_hv_8_20x20_rvv_i32:  526.5 (11.27x)374.1 (15.87x)
> dmvr_v_8_12x20_c:2156.3 ( 1.00x)2155.4 ( 1.00x)
> dmvr_v_8_12x20_rvv_i32:   239.6 ( 9.00x)176.2 (12.24x)
> dmvr_v_8_20x12_c:2137.6 ( 1.00x)2165.9 ( 1.00x)
> dmvr_v_8_20x12_rvv_i32:   230.3 ( 9.28x)155.2 (13.96x)
> dmvr_v_8_20x20_c:4183.8 ( 1.00x)3592.9 ( 1.00x)
> dmvr_v_8_20x20_rvv_i32:   369.3 (11.33x)249.2 (14.42x)
> ---
>  libavcodec/riscv/vvc/vvc_mc_rvv.S  | 120 +
>  libavcodec/riscv/vvc/vvcdsp_init.c |  22 ++
>  2 files changed, 142 insertions(+)
>
> diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S
> b/libavcodec/riscv/vvc/vvc_mc_rvv.S
> index 18532616d9..2c634af48f 100644
> --- a/libavcodec/riscv/vvc/vvc_mc_rvv.S
> +++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S
> @@ -285,3 +285,123 @@ endfunc
>  func_w_avg 128
>  func_w_avg 256
>  #endif
> +
> +func dmvr zve32x, zbb, zba
> +lpad0
> +lit0, 4
> +1:
> +add   t1, a1, a2
> +addi  t4, a0, 128*2
> +vle8.vv0, (a1)
> +vle8.vv4, (t1)
> +addi  a3, a3, -2
> +vwmulu.vx v16, v0, t0
> +vwmulu.vx v20, v4, t0
> +vse16.v   v16, (a0)
> +vse16.v   v20, (t4)
> +sh1adda1, a2, a1
> +add   a0, a0, 128*2*2
> +bnez  a3, 1b
> +ret
> +endfunc
> +
> +.macro dmvr_h_v mn, type, w, vlen
> +dmvr_\type\vlen\w:
> +lla   t4, ff_vvc_inter_luma_dmvr_filters
> +sh1addt4, \mn, t4
> +lbu   t5, (t4)
> +lbu   t6, 1(t4)
> +1:
> +vsetvlstatic8 \w, \vlen
> +.ifc \type,h
> +addi  t0, a1, 1
> +addi  t1, a1, 2
> +.else
> +add   t0, a1, a2
> +add   t1, t0, a2
> +.endif
> +vle8.vv0, (a1)
> +vle8.vv4, (t0)
> +vle8.vv8, (t1)
> +addi  a3, a3, -2
> +addi  t2, a0, 128*2
> +vwmulu.vx v12, v0, t5
> +vwmulu.vx v24, v4, t5
> +vwmaccu.vxv12, t6, v4
> +vwmaccu.vxv24, t6, v8
> +vsetvlstatic16\w, \vlen
> +vssrl.vi  v12, v12, 2
> +vssrl.vi  v24, v24, 2
> +vse16.v   v12, (a0)
> +vse16.v   v24, (t2)
> +add   a0, a0, 128*4
> +sh1adda1, a2, a1
> +bnez  a3, 1b
> +ret
> +.endm
> +
> +.macro dmvr_load_h dst, filter0, filter1, w, vlen
> +vsetvlstatic8 \w, \vlen
> +addi  a6, a1, 1
> +vle8.v\dst, (a1)
> +vle8.vv2, (a6)
> +vwmulu.vx v4, \dst, \filter0
> +vwmaccu.vxv4, \filter1, v2
> +vsetvlstatic16\w, \vlen
> +vssrl.vi  \dst, v4, 2
> +.endm
> +
> +.macro dmvr_hv w, vlen
> +dmvr_hv\vlen\w:
> +lla   t0, ff_vvc_inter_luma_dmvr_filters
> +sh1addt1, a4, t0
> +sh1addt2, a5, t0
> +lbu   t3, (t1)  // filter[mx][0]
> +lbu   t4, 1(t1) // filter[mx][1]
> +lbu   t5, (t2)  // filter[my][0]
> +lbu   t6,

[FFmpeg-devel] [PATCH] vulkan_decode: remove yuv sampler for DPB images

2024-10-11 Thread Benjamin Cheng via ffmpeg-devel
The YCbCr sampler is only required for multi-plane images if the image
is created with SAMPLED usage, and the image view is created with
aspectMask = COLOR. For DPB images, it is expected that some
implementations will have opaque DPBs (i.e. they do not support
SAMPLED/TRANSFER/STORAGE usages).

Since ffmpeg doesn't use DPB images in a shader anyways, the SAMPLED
usage was not necessary.

A run with this change did not introduce any new validation errors on
RADV.
---
 libavcodec/vulkan_decode.c | 3 +--
 libavcodec/vulkan_video.c  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 7d7295e05e..12472b5cb4 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -1191,8 +1191,7 @@ int ff_vk_decode_init(AVCodecContext *avctx)

VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
 dpb_hwfc->format[0]= s->hwfc->format[0];
 dpb_hwfc->tiling   = VK_IMAGE_TILING_OPTIMAL;
-dpb_hwfc->usage= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR |
- VK_IMAGE_USAGE_SAMPLED_BIT; /* Shuts 
validator up. */
+dpb_hwfc->usage= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
 
 if (ctx->common.layered_dpb)
 dpb_hwfc->nb_layers = ctx->caps.maxDpbSlots;
diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c
index 3a04d60d68..2acbbfa05e 100644
--- a/libavcodec/vulkan_video.c
+++ b/libavcodec/vulkan_video.c
@@ -292,7 +292,7 @@ int ff_vk_create_view(FFVulkanContext *s, FFVkVideoCommon 
*common,
 };
 VkImageViewCreateInfo img_view_create_info = {
 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
-.pNext = &yuv_sampler_info,
+.pNext = common->layered_dpb && is_dpb ? NULL : &yuv_sampler_info,
 .viewType = common->layered_dpb && is_dpb ?
 VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D,
 .format = vkf,
-- 
2.47.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Added support to enable VBV-End feature with x265 encode

2024-10-11 Thread Michael Niedermayer
On Wed, Oct 09, 2024 at 01:58:13PM +0530, Yaswanth Sastry wrote:
> From 5cd8272ccf9902a4eb5451fed583909c63941fb7 Mon Sep 17 00:00:00 2001
> From: From: yaswanthsastry 
> Date: Wed, 9 Oct 2024 13:44:54 +0530
> Subject: [PATCH] Added support to enable VBV-End feature with x265 encode
> 
> ---
>  fftools/ffmpeg_enc.c | 2 ++
>  libavcodec/avcodec.h | 1 +
>  libavcodec/libx265.c | 3 +++
>  3 files changed, 6 insertions(+)

breaks build on ubuntu:

libavcodec/libx265.c: In function ‘libx265_encode_frame’:
libavcodec/libx265.c:791:21: error: ‘x265_api’ {aka ‘const struct x265_api’} 
has no member named ‘configure_vbv_end’
  791 | 
ctx->api->configure_vbv_end(ctx->encoder,&x265pic,(avctx->duration/100));
  | ^~
make: *** [ffbuild/common.mak:81: libavcodec/libx265.o] Error 1
make: *** Waiting for unfinished jobs

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What is money laundering? Its paying someone and not telling the government.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/2] lavc/vvc_mc: R-V V dmvr

2024-10-11 Thread Rémi Denis-Courmont
Hi,

This fails to assemble here (binutils 2.43.1).

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/5] lavc/hevc: R-V V pel_uni(pow2)

2024-10-11 Thread uk7b
From: sunyuechi 

  k230   
banana_f3
put_hevc_pel_uni_pixels4_8_c:  126.3 ( 1.00x)90.5 ( 
1.00x)
put_hevc_pel_uni_pixels4_8_rvv_i32: 24.6 ( 5.14x)17.5 ( 
5.18x)
put_hevc_pel_uni_pixels8_8_c:  293.1 ( 1.00x)153.0 
( 1.00x)
put_hevc_pel_uni_pixels8_8_rvv_i32: 34.1 ( 8.60x)38.5 ( 
3.98x)
put_hevc_pel_uni_pixels16_8_c:1172.6 ( 1.00x)288.2 
( 1.00x)
put_hevc_pel_uni_pixels16_8_rvv_i32:61.6 (19.04x)48.7 ( 
5.92x)
put_hevc_pel_uni_pixels32_8_c:1135.8 ( 1.00x)517.5 
( 1.00x)
put_hevc_pel_uni_pixels32_8_rvv_i32:   209.8 ( 5.41x)121.7 
( 4.25x)
put_hevc_pel_uni_pixels64_8_c:2617.1 ( 1.00x)1257.0 
( 1.00x)
put_hevc_pel_uni_pixels64_8_rvv_i32:   709.6 ( 3.69x)486.2 
( 2.59x)
---
 libavcodec/hevc/dsp.c   |  2 +
 libavcodec/hevc/dsp.h   |  1 +
 libavcodec/riscv/Makefile   |  2 +
 libavcodec/riscv/hevcdsp.h  | 32 +
 libavcodec/riscv/hevcdsp_init.c | 82 +
 5 files changed, 119 insertions(+)
 create mode 100644 libavcodec/riscv/hevcdsp.h
 create mode 100644 libavcodec/riscv/hevcdsp_init.c

diff --git a/libavcodec/hevc/dsp.c b/libavcodec/hevc/dsp.c
index 60f059292c..c2e72cd0f5 100644
--- a/libavcodec/hevc/dsp.c
+++ b/libavcodec/hevc/dsp.c
@@ -265,6 +265,8 @@ int i = 0;
 ff_hevc_dsp_init_arm(hevcdsp, bit_depth);
 #elif ARCH_PPC
 ff_hevc_dsp_init_ppc(hevcdsp, bit_depth);
+#elif ARCH_RISCV
+ff_hevc_dsp_init_riscv(hevcdsp, bit_depth);
 #elif ARCH_X86
 ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
 #elif ARCH_MIPS
diff --git a/libavcodec/hevc/dsp.h b/libavcodec/hevc/dsp.h
index 02b8e0e8e2..6d77a470ff 100644
--- a/libavcodec/hevc/dsp.h
+++ b/libavcodec/hevc/dsp.h
@@ -133,6 +133,7 @@ extern const int8_t ff_hevc_qpel_filters[4][16];
 void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth);
+void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth);
diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 1f1fa03329..a80d2fa2e7 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -35,6 +35,8 @@ RVV-OBJS-$(CONFIG_H264DSP) += riscv/h264addpx_rvv.o 
riscv/h264dsp_rvv.o \
   riscv/h264idct_rvv.o
 OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_init.o
 RVV-OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_rvv.o
+OBJS-$(CONFIG_HEVC_DECODER) += riscv/hevcdsp_init.o
+RVV-OBJS-$(CONFIG_HEVC_DECODER)  += riscv/h26x/h2656_inter_rvv.o
 OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o
 RVV-OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_rvv.o
 OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
diff --git a/libavcodec/riscv/hevcdsp.h b/libavcodec/riscv/hevcdsp.h
new file mode 100644
index 00..7b42e49f41
--- /dev/null
+++ b/libavcodec/riscv/hevcdsp.h
@@ -0,0 +1,32 @@
+/*
+ * HEVC video decoder
+ *
+ * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS).
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_RISCV_HEVCDSP_H
+#define AVCODEC_RISCV_HEVCDSP_H
+
+#include 
+#include 
+
+void ff_hevc_put_hevc_pel_uni_pixels_8_rvv_256(uint8_t *dst, ptrdiff_t 
dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, 
intptr_t my,int width);
+void ff_hevc_put_hevc_pel_uni_pixels_8_rvv_128(uint8_t *dst, ptrdiff_t 
dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, 
intptr_t my,int width);
+
+#endif // AVCODEC_RISCV_HEVCDSP_H
diff --git a/libavcodec/riscv/hevcdsp_init.c b/libavcodec/riscv/hevcdsp_init.c
new file mode 100644
index 00..61486fb533
--- /dev/null
+++ b/libavcodec/riscv/hevcdsp_init.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (

Re: [FFmpeg-devel] [PATCH 4/5] lavc/hevc: R-V V pel_uni(pow2)

2024-10-11 Thread flow gg
Fix init.

 于2024年10月12日周六 14:25写道:

> From: sunyuechi 
>
>   k230
>  banana_f3
> put_hevc_pel_uni_pixels4_8_c:  126.3 ( 1.00x)
> 90.5 ( 1.00x)
> put_hevc_pel_uni_pixels4_8_rvv_i32: 24.6 ( 5.14x)
> 17.5 ( 5.18x)
> put_hevc_pel_uni_pixels8_8_c:  293.1 ( 1.00x)
> 153.0 ( 1.00x)
> put_hevc_pel_uni_pixels8_8_rvv_i32: 34.1 ( 8.60x)
> 38.5 ( 3.98x)
> put_hevc_pel_uni_pixels16_8_c:1172.6 ( 1.00x)
> 288.2 ( 1.00x)
> put_hevc_pel_uni_pixels16_8_rvv_i32:61.6 (19.04x)
> 48.7 ( 5.92x)
> put_hevc_pel_uni_pixels32_8_c:1135.8 ( 1.00x)
> 517.5 ( 1.00x)
> put_hevc_pel_uni_pixels32_8_rvv_i32:   209.8 ( 5.41x)
> 121.7 ( 4.25x)
> put_hevc_pel_uni_pixels64_8_c:2617.1 ( 1.00x)
> 1257.0 ( 1.00x)
> put_hevc_pel_uni_pixels64_8_rvv_i32:   709.6 ( 3.69x)
> 486.2 ( 2.59x)
> ---
>  libavcodec/hevc/dsp.c   |  2 +
>  libavcodec/hevc/dsp.h   |  1 +
>  libavcodec/riscv/Makefile   |  2 +
>  libavcodec/riscv/hevcdsp.h  | 32 +
>  libavcodec/riscv/hevcdsp_init.c | 82 +
>  5 files changed, 119 insertions(+)
>  create mode 100644 libavcodec/riscv/hevcdsp.h
>  create mode 100644 libavcodec/riscv/hevcdsp_init.c
>
> diff --git a/libavcodec/hevc/dsp.c b/libavcodec/hevc/dsp.c
> index 60f059292c..c2e72cd0f5 100644
> --- a/libavcodec/hevc/dsp.c
> +++ b/libavcodec/hevc/dsp.c
> @@ -265,6 +265,8 @@ int i = 0;
>  ff_hevc_dsp_init_arm(hevcdsp, bit_depth);
>  #elif ARCH_PPC
>  ff_hevc_dsp_init_ppc(hevcdsp, bit_depth);
> +#elif ARCH_RISCV
> +ff_hevc_dsp_init_riscv(hevcdsp, bit_depth);
>  #elif ARCH_X86
>  ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
>  #elif ARCH_MIPS
> diff --git a/libavcodec/hevc/dsp.h b/libavcodec/hevc/dsp.h
> index 02b8e0e8e2..6d77a470ff 100644
> --- a/libavcodec/hevc/dsp.h
> +++ b/libavcodec/hevc/dsp.h
> @@ -133,6 +133,7 @@ extern const int8_t ff_hevc_qpel_filters[4][16];
>  void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth);
>  void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth);
>  void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth);
> +void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int bit_depth);
>  void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
>  void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth);
>  void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth);
> diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
> index 1f1fa03329..a80d2fa2e7 100644
> --- a/libavcodec/riscv/Makefile
> +++ b/libavcodec/riscv/Makefile
> @@ -35,6 +35,8 @@ RVV-OBJS-$(CONFIG_H264DSP) += riscv/h264addpx_rvv.o
> riscv/h264dsp_rvv.o \
>riscv/h264idct_rvv.o
>  OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_init.o
>  RVV-OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_rvv.o
> +OBJS-$(CONFIG_HEVC_DECODER) += riscv/hevcdsp_init.o
> +RVV-OBJS-$(CONFIG_HEVC_DECODER)  += riscv/h26x/h2656_inter_rvv.o
>  OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o
>  RVV-OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_rvv.o
>  OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o
> diff --git a/libavcodec/riscv/hevcdsp.h b/libavcodec/riscv/hevcdsp.h
> new file mode 100644
> index 00..7b42e49f41
> --- /dev/null
> +++ b/libavcodec/riscv/hevcdsp.h
> @@ -0,0 +1,32 @@
> +/*
> + * HEVC video decoder
> + *
> + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences
> (ISCAS).
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> + */
> +
> +#ifndef AVCODEC_RISCV_HEVCDSP_H
> +#define AVCODEC_RISCV_HEVCDSP_H
> +
> +#include 
> +#include 
> +
> +void ff_hevc_put_hevc_pel_uni_pixels_8_rvv_256(uint8_t *dst, ptrdiff_t
> dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t
> mx, intptr_t my,int width);
> +void ff_hevc_put_hevc_pel_uni_pixels_8_rvv_128(uint8_t *dst, ptrdiff_t
> dststride,const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t
> mx, intptr_t my,int width);
> +
> +#endif // AVCODEC_RISCV_HEVCDSP_H
> diff 

Re: [FFmpeg-devel] [PATCH] riscv/vvc: fix UNDEF whilst initialising DSP

2024-10-11 Thread Martin Storsjö

On Sat, 12 Oct 2024, Rémi Denis-Courmont wrote:


The current triggers an illegal instruction if the CPU does not support
vectors.
---
libavcodec/riscv/vvc/vvcdsp_init.c | 12 +++-
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/riscv/vvc/vvcdsp_init.c 
b/libavcodec/riscv/vvc/vvcdsp_init.c
index 0a9f393259..30e8f59a58 100644
--- a/libavcodec/riscv/vvc/vvcdsp_init.c
+++ b/libavcodec/riscv/vvc/vvcdsp_init.c
@@ -41,10 +41,13 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const 
int bd)
{
#if HAVE_RVV
const int flags = av_get_cpu_flags();
-int vlenb = ff_get_rv_vlenb();
+int vlenb;

-if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB) &&
-vlenb >= 32) {
+if (!(flags & AV_CPU_FLAG_RVV_I32) || !(flags & AV_CPU_FLAG_RVB))
+return;
+
+vlenb = ff_get_rv_vlenb();
+if (vlenb >= 32) {
switch (bd) {
case 8:
c->inter.avg= ff_vvc_avg_8_rvv_256;
@@ -55,8 +58,7 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const int 
bd)
default:
break;
}
-} else if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB) &&
-   vlenb >= 16) {
+} else if (vlenb >= 16) {
switch (bd) {
case 8:
c->inter.avg= ff_vvc_avg_8_rvv_128;
--
2.45.2


LGTM

// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] riscv/vvc: fix UNDEF whilst initialising DSP

2024-10-11 Thread flow gg
LGTM

Rémi Denis-Courmont  于2024年10月12日周六 13:38写道:

> The current triggers an illegal instruction if the CPU does not support
> vectors.
> ---
>  libavcodec/riscv/vvc/vvcdsp_init.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/riscv/vvc/vvcdsp_init.c
> b/libavcodec/riscv/vvc/vvcdsp_init.c
> index 0a9f393259..30e8f59a58 100644
> --- a/libavcodec/riscv/vvc/vvcdsp_init.c
> +++ b/libavcodec/riscv/vvc/vvcdsp_init.c
> @@ -41,10 +41,13 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c,
> const int bd)
>  {
>  #if HAVE_RVV
>  const int flags = av_get_cpu_flags();
> -int vlenb = ff_get_rv_vlenb();
> +int vlenb;
>
> -if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB) &&
> -vlenb >= 32) {
> +if (!(flags & AV_CPU_FLAG_RVV_I32) || !(flags & AV_CPU_FLAG_RVB))
> +return;
> +
> +vlenb = ff_get_rv_vlenb();
> +if (vlenb >= 32) {
>  switch (bd) {
>  case 8:
>  c->inter.avg= ff_vvc_avg_8_rvv_256;
> @@ -55,8 +58,7 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const
> int bd)
>  default:
>  break;
>  }
> -} else if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)
> &&
> -   vlenb >= 16) {
> +} else if (vlenb >= 16) {
>  switch (bd) {
>  case 8:
>  c->inter.avg= ff_vvc_avg_8_rvv_128;
> --
> 2.45.2
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".