Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
@ 2025-02-04 13:31 James Almer
  2025-02-04 13:38 ` Martin Storsjö
  0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2025-02-04 13:31 UTC (permalink / raw)
  To: ffmpeg-devel

Fixes compilation when using API headers older than 12.0

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/nvenc.c | 2 ++
 libavcodec/nvenc.h | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index c359c2bc8a..eea3e8d703 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1462,7 +1462,9 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
         hevc->intraRefreshPeriod = cc->gopLength;
         hevc->intraRefreshCnt = cc->gopLength - 1;
         cc->gopLength = NVENC_INFINITE_GOPLENGTH;
+#ifdef NVENC_HAVE_OUTPUT_RECOVERY_POINT_SEI
         hevc->outputRecoveryPointSEI = 1;
+#endif
 #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
         hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh;
 #endif
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 341a242cf7..d395221870 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -78,6 +78,11 @@ typedef void ID3D11Device;
 #define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
 #endif
 
+// SDK 12.0 compile time feature checks
+#if NVENCAPI_CHECK_VERSION(12, 0)
+#define NVENC_HAVE_OUTPUT_RECOVERY_POINT_SEI
+#endif
+
 // SDK 12.1 compile time feature checks
 #if NVENCAPI_CHECK_VERSION(12, 1)
 #define NVENC_NO_DEPRECATED_RC
-- 
2.48.1

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 13:31 [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC James Almer
@ 2025-02-04 13:38 ` Martin Storsjö
  2025-02-04 13:41   ` James Almer
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Storsjö @ 2025-02-04 13:38 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, 4 Feb 2025, James Almer wrote:

> Fixes compilation when using API headers older than 12.0
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavcodec/nvenc.c | 2 ++
> libavcodec/nvenc.h | 5 +++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index c359c2bc8a..eea3e8d703 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -1462,7 +1462,9 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
>         hevc->intraRefreshPeriod = cc->gopLength;
>         hevc->intraRefreshCnt = cc->gopLength - 1;
>         cc->gopLength = NVENC_INFINITE_GOPLENGTH;
> +#ifdef NVENC_HAVE_OUTPUT_RECOVERY_POINT_SEI
>         hevc->outputRecoveryPointSEI = 1;
> +#endif
> #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
>         hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh;
> #endif
> diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
> index 341a242cf7..d395221870 100644
> --- a/libavcodec/nvenc.h
> +++ b/libavcodec/nvenc.h
> @@ -78,6 +78,11 @@ typedef void ID3D11Device;
> #define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
> #endif
>
> +// SDK 12.0 compile time feature checks
> +#if NVENCAPI_CHECK_VERSION(12, 0)
> +#define NVENC_HAVE_OUTPUT_RECOVERY_POINT_SEI
> +#endif
> +
> // SDK 12.1 compile time feature checks
> #if NVENCAPI_CHECK_VERSION(12, 1)
> #define NVENC_NO_DEPRECATED_RC
> -- 
> 2.48.1

Thanks, this does indeed seem to fix compilation in my setup.

// 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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 13:38 ` Martin Storsjö
@ 2025-02-04 13:41   ` James Almer
  2025-02-04 13:52     ` Martin Storsjö
  0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2025-02-04 13:41 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1749 bytes --]

On 2/4/2025 10:38 AM, Martin Storsjö wrote:
> On Tue, 4 Feb 2025, James Almer wrote:
> 
>> Fixes compilation when using API headers older than 12.0
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> libavcodec/nvenc.c | 2 ++
>> libavcodec/nvenc.h | 5 +++++
>> 2 files changed, 7 insertions(+)
>>
>> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
>> index c359c2bc8a..eea3e8d703 100644
>> --- a/libavcodec/nvenc.c
>> +++ b/libavcodec/nvenc.c
>> @@ -1462,7 +1462,9 @@ static av_cold int 
>> nvenc_setup_hevc_config(AVCodecContext *avctx)
>>         hevc->intraRefreshPeriod = cc->gopLength;
>>         hevc->intraRefreshCnt = cc->gopLength - 1;
>>         cc->gopLength = NVENC_INFINITE_GOPLENGTH;
>> +#ifdef NVENC_HAVE_OUTPUT_RECOVERY_POINT_SEI
>>         hevc->outputRecoveryPointSEI = 1;
>> +#endif
>> #ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
>>         hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh;
>> #endif
>> diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
>> index 341a242cf7..d395221870 100644
>> --- a/libavcodec/nvenc.h
>> +++ b/libavcodec/nvenc.h
>> @@ -78,6 +78,11 @@ typedef void ID3D11Device;
>> #define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
>> #endif
>>
>> +// SDK 12.0 compile time feature checks
>> +#if NVENCAPI_CHECK_VERSION(12, 0)
>> +#define NVENC_HAVE_OUTPUT_RECOVERY_POINT_SEI
>> +#endif
>> +
>> // SDK 12.1 compile time feature checks
>> #if NVENCAPI_CHECK_VERSION(12, 1)
>> #define NVENC_NO_DEPRECATED_RC
>> -- 
>> 2.48.1
> 
> Thanks, this does indeed seem to fix compilation in my setup.

Applied.

Why don't don't just update the headers? Is it a system package provided 
by your distro?


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 13:41   ` James Almer
@ 2025-02-04 13:52     ` Martin Storsjö
  2025-02-04 13:57       ` James Almer
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Storsjö @ 2025-02-04 13:52 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, 4 Feb 2025, James Almer wrote:

>> Thanks, this does indeed seem to fix compilation in my setup.
>
> Applied.
>
> Why don't don't just update the headers? Is it a system package provided by 
> your distro?

I guess I could, but as long as I don't have a pressing need to, just 
staying with the current version is easiest. Do the headers major version 
need to match the installed drivers/proprietary nvidia libs? (In my setup, 
the drivers/nvidia libs are distributed entirely separately - touching 
that bit is a lot of effort.)

// 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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 13:52     ` Martin Storsjö
@ 2025-02-04 13:57       ` James Almer
  2025-02-04 14:00         ` Martin Storsjö
  0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2025-02-04 13:57 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 969 bytes --]

On 2/4/2025 10:52 AM, Martin Storsjö wrote:
> On Tue, 4 Feb 2025, James Almer wrote:
> 
>>> Thanks, this does indeed seem to fix compilation in my setup.
>>
>> Applied.
>>
>> Why don't don't just update the headers? Is it a system package 
>> provided by your distro?
> 
> I guess I could, but as long as I don't have a pressing need to, just 
> staying with the current version is easiest. Do the headers major 
> version need to match the installed drivers/proprietary nvidia libs? (In 
> my setup, the drivers/nvidia libs are distributed entirely separately - 
> touching that bit is a lot of effort.)

No, they don't need to match afaik. The headers are meant to be ABI 
backwards compatible (hence all the reserved fields).

I was just wondering if the headers were provided by your distro or not 
(Given they are compile time deps and not runtime), and looking now at 
the package lists in some, i see they are, so disregard my question.


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 13:57       ` James Almer
@ 2025-02-04 14:00         ` Martin Storsjö
  2025-02-04 14:58           ` Zhao Zhili
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Storsjö @ 2025-02-04 14:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, 4 Feb 2025, James Almer wrote:

> No, they don't need to match afaik. The headers are meant to be ABI backwards 
> compatible (hence all the reserved fields).

Right, then there's probably less concern about updating them.

> I was just wondering if the headers were provided by your distro or not 
> (Given they are compile time deps and not runtime), and looking now at the 
> package lists in some, i see they are, so disregard my question.

In my case I actually don't use distro provided headers, I use a manually 
installed set, but I don't really touch it unless I need to.

// 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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 14:00         ` Martin Storsjö
@ 2025-02-04 14:58           ` Zhao Zhili
  2025-02-04 15:36             ` Timo Rothenpieler
  0 siblings, 1 reply; 8+ messages in thread
From: Zhao Zhili @ 2025-02-04 14:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: timo


> On Feb 4, 2025, at 22:00, Martin Storsjö <martin@martin.st> wrote:
> 
> On Tue, 4 Feb 2025, James Almer wrote:
> 
>> No, they don't need to match afaik. The headers are meant to be ABI backwards compatible (hence all the reserved fields).
> 
> Right, then there's probably less concern about updating them.
> 
>> I was just wondering if the headers were provided by your distro or not (Given they are compile time deps and not runtime), and looking now at the package lists in some, i see they are, so disregard my question.
> 
> In my case I actually don't use distro provided headers, I use a manually installed set, but I don't really touch it unless I need to.

How about put a copy of nv-codec-headers inside ffmpeg source tree?
So it can always up to date and easy to handle the dependency (I encountered some trouble on Unix path vs Window path with ffnvcodec.pc in msys environment).
What are the disadvantages of this method?

> 
> // 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-request@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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC
  2025-02-04 14:58           ` Zhao Zhili
@ 2025-02-04 15:36             ` Timo Rothenpieler
  0 siblings, 0 replies; 8+ messages in thread
From: Timo Rothenpieler @ 2025-02-04 15:36 UTC (permalink / raw)
  To: Zhao Zhili, FFmpeg development discussions and patches

On 04/02/2025 15:58, Zhao Zhili wrote:
> 
>> On Feb 4, 2025, at 22:00, Martin Storsjö <martin@martin.st> wrote:
>>
>> On Tue, 4 Feb 2025, James Almer wrote:
>>
>>> No, they don't need to match afaik. The headers are meant to be ABI backwards compatible (hence all the reserved fields).
>>
>> Right, then there's probably less concern about updating them.
>>
>>> I was just wondering if the headers were provided by your distro or not (Given they are compile time deps and not runtime), and looking now at the package lists in some, i see they are, so disregard my question.
>>
>> In my case I actually don't use distro provided headers, I use a manually installed set, but I don't really touch it unless I need to.
> 
> How about put a copy of nv-codec-headers inside ffmpeg source tree?
> So it can always up to date and easy to handle the dependency (I encountered some trouble on Unix path vs Window path with ffnvcodec.pc in msys environment).
> What are the disadvantages of this method?

That's how it's been in the past, and I have no plans to go back to that.
It forces everyone to use bleeding edge drivers whenever we bump the 
headers, which in some distros is outright impossible.

Outsourcing the headers enabled us to build modern FFmpeg with support 
for old drivers, just sacrificing modern features.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-02-04 15:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-04 13:31 [FFmpeg-devel] [PATCH] avcodec/nvenc: add compile time check for outputRecoveryPointSEI for HEVC James Almer
2025-02-04 13:38 ` Martin Storsjö
2025-02-04 13:41   ` James Almer
2025-02-04 13:52     ` Martin Storsjö
2025-02-04 13:57       ` James Almer
2025-02-04 14:00         ` Martin Storsjö
2025-02-04 14:58           ` Zhao Zhili
2025-02-04 15:36             ` Timo Rothenpieler

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git