Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrea paz via Cin
> Is really /usr/lib/pkgconfig/zimg.pc the right place?

In Arch, /usr/lib64 is a symlink to /usr/lib. Do you think that could
be the problem? But why only with zimg?
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Georgy Salnikov via Cin
On Sun, 11 May 2025, Andrea paz via Cin wrote:

> I have done many attempts, but always with the same error:
>
> ERROR: zimg >= 2.7.0 not found using pkg-config
>
> In Arch, the zimg package files are as follows:
>
> /usr/lib/pkgconfig/zimg.pc

Is really /usr/lib/pkgconfig/zimg.pc the right place? By me it would be
/usr/lib64/pkgconfig/zimg.pc═if I am under 64-bit system
(/usr/lib/pkgconfig/zimg.pc would be compatibility lib for 32-bit
applications).
___

Georgy Salnikov
NMR Group
Novosibirsk Institute of Organic Chemistry
Lavrentjeva, 9, 630090 Novosibirsk, Russia
Phone   +7-383-3307864
Email   s...@nmr.nioch.nsc.ru
___

-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrew Randrianasulu via Cin
вс, 11 мая 2025 г., 15:00 Andrea paz :

> I copied and pasted your line:
>
> EXTRA_LIBS=" -lOpenCL -lSvtAv1Enc -lvpl -ldav1d -lxvidcore -lass
> -lbluray -lsnappy -lzimg -lplacebo -lshaderc_shared"
>


strange, it was working with those TWO lines in Slackbuild:

EXTRA_LIBS=" -lOpenCL -lSvtAv1Enc -lvpl -ldav1d -lxvidcore -lass -lbluray
-lsnappy -lzimg -lplacebo -lshaderc_shared" \
 FFMPEG_EXTRA_CFG="
--enable-libvpl --disable-doc --enable-opencl --enable-libsvtav1
--enable-frei0r --enable-libdav1d --enable-libzimg --enable-libxvid
--enable-libass --enable-libbluray --enable-libsnappy --enable-libshaderc
--enable-libplacebo --enable-vulkan --disable-debug
--extra-cflags=-I/usr/local/include/vpl
--extra-cflags=-I/usr/include/svt-av1" \

be sure to export both?





> I have also tried just “-lzimg”.
> I have also tried several variations (along with or without your line) of:
>


You can't use something.pc in -L statement directly, it sets directory
where linker looks for libraries.

pkg-config is basically program (from system -  I saw it on Linux distros
and NetBSD's pkgsrc) that checks those *.pc files and helps to construct
include and libs lines.

-I is also sets include search *directory* and not a file, as far as I
understand.

But yeah, for example cmake sometimes mis-set those, so I tend to try and
fix this on my slightly non-standart system. Or just give up and symlink
few things into /usr



> export EXTRA_LDFLAGS=' -L/usr/lib/libzimg.so /usr/lib/libzimg.so.2
> /usr/lib/libzimg.so.2.0.0 -L/usr/lib/pkgconfig/zimg.pc'
> export EXTRA_CFLAGS=' -I/usr/include/zimg++.hpp /usr/include/zimg.h'
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrea paz via Cin
I copied and pasted your line:

EXTRA_LIBS=" -lOpenCL -lSvtAv1Enc -lvpl -ldav1d -lxvidcore -lass
-lbluray -lsnappy -lzimg -lplacebo -lshaderc_shared"

I have also tried just “-lzimg”.
I have also tried several variations (along with or without your line) of:

export EXTRA_LDFLAGS=' -L/usr/lib/libzimg.so /usr/lib/libzimg.so.2
/usr/lib/libzimg.so.2.0.0 -L/usr/lib/pkgconfig/zimg.pc'
export EXTRA_CFLAGS=' -I/usr/include/zimg++.hpp /usr/include/zimg.h'
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrew Randrianasulu via Cin
вс, 11 мая 2025 г., 14:42 Andrea paz :

> I find this:
>
> /usr/bin/ld: /tmp/ffconf.LBw6bqQB/test.o: in function
> `check_zimg_get_api_version':
> test.c:(.text+0x3): undefined reference to `zimg_get_api_version'
> collect2: error: ld returned 1 exit status
> ERROR: zimg >= 2.7.0 not found using pkg-config
>

Are you sure you added correct EXTRA_LIBS environment variable? Sometimes
typos ruin it May be throw -L with path to libzimg there too ...



> But here I stop for total incompetence.
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrea paz via Cin
I find this:

/usr/bin/ld: /tmp/ffconf.LBw6bqQB/test.o: in function
`check_zimg_get_api_version':
test.c:(.text+0x3): undefined reference to `zimg_get_api_version'
collect2: error: ld returned 1 exit status
ERROR: zimg >= 2.7.0 not found using pkg-config

But here I stop for total incompetence.
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrew Randrianasulu via Cin
вс, 11 мая 2025 г., 13:59 Andrea paz :

> I have done many attempts, but always with the same error:
>
> ERROR: zimg >= 2.7.0 not found using pkg-config
>


Check thirdparty/ffmpeg-7.0/ffbuild/config.log near the end .

>
> In Arch, the zimg package files are as follows:
>
> /usr/include/zimg++.hpp
> /usr/include/zimg.h
>
> /usr/lib/libzimg.so
> /usr/lib/libzimg.so.2
> /usr/lib/libzimg.so.2.0.0
> /usr/lib/pkgconfig/zimg.pc
>
> One question: what is “pkg-config”? A CinGG's script? A system script?
> I search this:
> https://people.freedesktop.org/~dbn/pkg-config-guide.html
>
> He seems to see the library:
> sudo pkg-config --list-all zimg | grep zimg
> zimg   zimg - Scaling, colorspace conversion,
> and dithering library
>
>
> sudo pkg-config --simulate zimg
> node 'virtual:world' {
> dependency 'zimg';
> };
> node 'zimg' {
> version = '3.0.5';
>
> I suppose pkg-config can't see the *.pc file in
> /usr/lib/pkgconfig/zimg.pc, and I tried editing
> /usr/lib/pkgconfig/zimg.pc by putting in:
>
> libdir=${exec_prefix}/lib/pkgconfig
>
> But I keep getting the same error. Any advice?
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-11 Thread Andrea paz via Cin
I have done many attempts, but always with the same error:

ERROR: zimg >= 2.7.0 not found using pkg-config

In Arch, the zimg package files are as follows:

/usr/include/zimg++.hpp
/usr/include/zimg.h

/usr/lib/libzimg.so
/usr/lib/libzimg.so.2
/usr/lib/libzimg.so.2.0.0
/usr/lib/pkgconfig/zimg.pc

One question: what is “pkg-config”? A CinGG's script? A system script?
I search this:
https://people.freedesktop.org/~dbn/pkg-config-guide.html

He seems to see the library:
sudo pkg-config --list-all zimg | grep zimg
zimg   zimg - Scaling, colorspace conversion,
and dithering library


sudo pkg-config --simulate zimg
node 'virtual:world' {
dependency 'zimg';
};
node 'zimg' {
version = '3.0.5';

I suppose pkg-config can't see the *.pc file in
/usr/lib/pkgconfig/zimg.pc, and I tried editing
/usr/lib/pkgconfig/zimg.pc by putting in:

libdir=${exec_prefix}/lib/pkgconfig

But I keep getting the same error. Any advice?
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-10 Thread Andrew Randrianasulu via Cin
сб, 10 мая 2025 г., 18:27 Andrea paz :

> > ...so you need to pass switch (
> > --enable-libzimg) to ffmpeg's configure script. And of course have zimg
> development files installed. (I tested on 3.0.4)
> Previously I had tried '--enable-libzimg' in configure but it was not
> recognized.
> Now I tried: export FFMPEG_EXTRA_CFG=' --enable-libzimg' and it was
> recognized. However, the compilation stops with this error:
>
> ERROR: zimg >= 2.7.0 not found using pkg-config
>
> I already had the zimg 3.0.5-1 package in the system.
>

I think I stepped on this landmine too while enabling Vulkan.

Be sure you also set

EXTRA_LIBS=" -lOpenCL -lSvtAv1Enc -lvpl -ldav1d -lxvidcore -lass -lbluray
-lsnappy -lzimg -lplacebo -lshaderc_shared" \

in addition to

FFMPEG_EXTRA_CFG=

before launching autogen.sh/configure/make


> I attach the entire cin.log.
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-10 Thread Andrew Randrianasulu via Cin
сб, 10 мая 2025 г., 16:46 Andrea paz via Cin :

> I wrote a theoretical introduction as a basis; but I still don't
> really understand how it works in CinGG. I guess I need to re-study
> the chapter “ffmpeg interactions”...
> Corrections and guidance are welcome.
>


I think it  is important to note somewhere that while vf_zscale is indeed
exist in mainline ffmpeg, it does not get build by default, so you need to
pass switch (
--enable-libzimg) to ffmpeg's configure script. And of course have zimg
development files installed. (I tested on 3.0.4)

-- 
> Cin mailing list
> Cin@lists.cinelerra-gg.org
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-10 Thread Andrea paz via Cin
I wrote a theoretical introduction as a basis; but I still don't
really understand how it works in CinGG. I guess I need to re-study
the chapter “ffmpeg interactions”...
Corrections and guidance are welcome.
ffmpeg embedded in CinGG has filters to perform good scaling and tonemapping of 
HDR sources (but not only). You can use the “zscale” and “tonemap” filters.

Introduction

zscale is based on the “zlib” library and acts not only on frame resolution 
(WxH, “rescaling”), but also performs color space conversion (“pixel format 
conversion”). Rescaling is generally a lossy process; pixel format conversion 
is lossy if the input and output color spaces are different. zscale is more 
efficient than “Scale” (based on libswscale) which is the standard for ffmpeg, 
but is considered to be of lower quality. See: 
http://underpop.online.fr/f/ffmpeg/help/zscale.htm.gz
Remember, however, that doing scale process in ffmpeg does not lead to optimal 
results:
- we recommend doing any image resizing outside of ffmpeg, especially if your 
sources are OpenEXR (Has no associated color space, that is, it is linear) and 
you are going to do a colorspace conversion, prior to encoding, this will 
ensure that the filtering is done in linear space, which will produce less 
artifacts. However the scaling algorithms can still get called when remapping 
chroma from 4:4:4 to 4:2:2 (or 4:2:0).
- Only converting from RGB or 4:4:4 to 4:2:2 or 4:2:0 is lossless, with no 
artifacts (But still with loss of color data, of course), all the other scaling 
options have artifacts of some form.

tonemap works only in linear and therefore needs zscale for linearization and 
then zscale again for final output. The workflow could be summarized in three 
theoretical next steps:

1) zscale to linearize the input.
2) tonemap to map HDR input to SDR.
3) zscale to export the output with the chosen SDR color space.
In the ffmpeg language this (and other) workflows are called “filter graphs” 
and are applied in a single line.


CinGG: HDR  -->  SDR

Let's take the example of wanting to work on an HDR source but, not having 
suitable hardware to support it, we have to reduce its values to SDR values by 
tonemapping. In this case the conversion is from a higher subsampling to a 
lower one and so, if we work well, we should have no loss of quality. It will 
have to be used zscale because it supports PQ/HLG (HDR) type transfer functions.
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-09 Thread Phyllis Smith via Cin
>
> I think we better to put those examples somewhere in manual before I
> forgot them/lost my opts files ;)
>
Agreed! Andrea, if you have time to do this that would be great! if not,
just let me know and I can do it.


On Fri, May 9, 2025 at 4:42 PM Andrew Randrianasulu via Cin <
cin@lists.cinelerra-gg.org> wrote:

>
>
> ср, 7 мая 2025 г., 18:38 Andrew Randrianasulu :
>
>> Using this page
>>
>> https://www.reddit.com/r/ffmpeg/comments/17ma3mm/hdr_tone_mapping_not_working/
>>
>> and our guide at
>>
>> https://cinelerra-gg.org/download/CinelerraGG_Manual/File_naming_convention.html
>>
>>
>> I come up with this (working) line to put in file.opts for HDR to SDR
>> bt 709 100 nits mapping:
>>
>>
>> video_filter=zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv444p
>>
>> But it only works with software decoding. At, like, 2.3 fps for full 4k
>> frame.
>>
>> And also you need to compile your ffmpeg used in cingg with z.img library.
>>
>
>
> Got it working with Vulkan hw decoding, not much faster, but leaves cingg
> a bit more responsive:
>
>
> video_filter=zscale=tin=smpte2084:min=bt2020nc:pin=bt2020:rin=tv:t=smpte2084:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:p=bt709:m=bt709
>
> monster line from
>
> https://forum.doom9.net/showpost.php?p=1898421&postcount=56
>
> I think we better to put those examples somewhere in manual before I
> forgot them/lost my opts files ;)
>
>
>
> --
> Cin mailing list
> Cin@lists.cinelerra-gg.org
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] zscale's tonemapping on input

2025-05-09 Thread Andrew Randrianasulu via Cin
ср, 7 мая 2025 г., 18:38 Andrew Randrianasulu :

> Using this page
>
> https://www.reddit.com/r/ffmpeg/comments/17ma3mm/hdr_tone_mapping_not_working/
>
> and our guide at
>
> https://cinelerra-gg.org/download/CinelerraGG_Manual/File_naming_convention.html
>
>
> I come up with this (working) line to put in file.opts for HDR to SDR
> bt 709 100 nits mapping:
>
>
> video_filter=zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv444p
>
> But it only works with software decoding. At, like, 2.3 fps for full 4k
> frame.
>
> And also you need to compile your ffmpeg used in cingg with z.img library.
>


Got it working with Vulkan hw decoding, not much faster, but leaves cingg a
bit more responsive:

video_filter=zscale=tin=smpte2084:min=bt2020nc:pin=bt2020:rin=tv:t=smpte2084:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:p=bt709:m=bt709

monster line from

https://forum.doom9.net/showpost.php?p=1898421&postcount=56

I think we better to put those examples somewhere in manual before I forgot
them/lost my opts files ;)
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin