[Cin] another 10 bit encoding patch

Terje J. Hanssen terjejhanssen at gmail.com
Fri Nov 15 13:31:07 CET 2024




Den 15.11.2024 09:10, skrev Andrew Randrianasulu:
>
>
> On Fri, Nov 15, 2024 at 9:31 AM Andrew Randrianasulu 
> <randrianasulu at gmail.com> wrote:
>
>
>
>     пт, 15 нояб. 2024 г., 03:21 Terje J. Hanssen
>     <terjejhanssen at gmail.com>:
>
>
>
>
>         Den 14.11.2024 22:21, skrev Andrew Randrianasulu:
>>
>>
>>         чт, 14 нояб. 2024 г., 23:41 Terje J. Hanssen
>>         <terjejhanssen at gmail.com>:
>>
>>
>>
>>
>>             Den 14.11.2024 18:38, skrev Andrew Randrianasulu:
>>>
>>>
>>>             чт, 14 нояб. 2024 г., 20:27 Terje J. Hanssen
>>>             <terjejhanssen at gmail.com>:
>>>
>>>                 Thank you for the patch.
>>>
>>>                 A few clarification questions in between before I start:
>>>
>>>                 Den 14.11.2024 14:21, skrev Andrew Randrianasulu:
>>>
>>>                 > you need to reset your git tree,
>>>                 >
>>>                 > something like
>>>                 >
>>>                 > git reset
>>>                 --hard 2037bf63cdf25462ca606f4a28636e12df77c2a0
>>>
>>>                 I did use "git reset --hard" without number at the
>>>                 end for the previous
>>>                 patch
>>>
>>>                 What number here, should I find mine somewhere in my
>>>                 git tree?
>>>
>>>
>>>
>>>             you can fig them in 'git log' screen, you should have
>>>             two more patches on top of "ORIGIN" line
>>
>>             Sorry, I'm still a bit confused by the latter "you should
>>             have two more patches on top of "ORIGIN" line"
>>             Here is the top from my git log" output:
>>
>>                 commit 68eb98be2183738684f1f4da2729d1ff9989ad16
>>                 Author: Andrew Randrianasulu
>>                 <randrianasulu at gmail.com>
>>                 <mailto:randrianasulu at gmail.com>
>>                 Date:   Sun Oct 27 19:43:06 2024 +0300
>>
>>                     Experimental: try 10bit vaapi encoding
>>
>>                 commit e5a5a6da907dbcd40d8612bdbfeea1a2a0ae6cc8
>>                 Author: Andrew Randrianasulu
>>                 <randrianasulu at gmail.com>
>>                 <mailto:randrianasulu at gmail.com>
>>                 Date:   Fri Oct 18 10:07:33 2024 +0300
>>
>>                     Add onevpl support to build system
>>
>>                 commit 8681d13675f32e870ab3632eaf89105415fb3961
>>                 Author: Andrew Randrianasulu
>>                 <randrianasulu at gmail.com>
>>                 <mailto:randrianasulu at gmail.com>
>>                 Date:   Wed Oct 23 16:36:19 2024 +0300
>>
>>                     Add DESCRIPTION
>>
>>                 commit 90138debee46e0b91adeb5d8a400158b131b0d61
>>                 Author: Andrew Randrianasulu
>>                 <randrianasulu at gmail.com>
>>                 <mailto:randrianasulu at gmail.com>
>>                 Date:   Wed Oct 23 16:29:58 2024 +0300
>>
>>                     Add BUGS
>>
>>                 commit 318c884532617e32904d6f4ec05a2b73832f418e
>>                 Author: Andrew Randrianasulu
>>                 <randrianasulu at gmail.com>
>>                 <mailto:randrianasulu at gmail.com>
>>                 Date:   Wed Oct 23 16:22:58 2024 +0300
>>
>>                     Update README build instructions
>>
>>
>>         ah.
>>
>>         you can just git reset --hard
>>         e5a5a6da907dbcd40d8612bdbfeea1a2a0ae6cc8
>>
>>
>>         inother words just reset tree to state without old 10bit patch.
>>
>>         then apply new.
>>
>>         if you can't see line with
>>
>>         (origin/master, origin/HEAD)
>>
>>         you can scroll down (by cursor arrows)
>>
>>         or search by pressing "/" and typing your search word and
>>         pressing enter.
>>
>>         but I think you can just reset tree to "add onevpl" commit.
>
>         Sorry, if I lost something - because it does not change
>         something so far:
>         All three attempts result all in yuv422p10le as the previous
>         10bit hack did.
>
>         My summary follows:
>
>         /Cin
>
>         # git reset --hard e5a5a6da907dbcd40d8612bdbfeea1a2a0ae6cc8
>         HEAD is now at e5a5a6da Add onevpl support to build system
>
>         # git am 0001-yet-another-10bit-attempt.patch
>         Applying: yet another 10bit attempt
>
>
>         I didn't undestand Cingg should be recompiled additional after
>         this patch(?)
>
>
>     yes.
>


Thanks, after recompiling Cingg with the latest patch, hevc_vaapi 
encoding works individually for each pixel format.
You should try to wire it?

Attach my customized presets for hevc_vaapi_8b420.m4, hevc_vaapi_10b420 
and hevc_vaapi_10b422.mp4
with output from my latest test runs as follows:

===========================

/Cin # CIN_10BIT_ENC=nv12 bin/cin
Cinelerra Infinity - built: Nov 15 2024 10:13:33

hevc_vaapi_8b420.mp4
     cin_hw_dev=vaapi
     format=nv12,hwupload
     profile=main
     # global_quality=22

** rendered 1780 frames in 42.010 secs, 42.371 fps


ffprobe -hide_banner hd01_hevc_vaapi_8b420.mp4
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, bt709/unknown/unknown, top coded first (swapped)), 1920x1080 
[SAR 1:1 DAR 16:9], 11377 kb/s, 25 fps, 25 tbr, 12800 tbn (default)

------------------------

global_quality=22
** rendered 1780 frames in 38.741 secs, 45.946 fps

ffprobe -hide_banner hd01_hevc_vaapi_8b420_gq22.mp4
   Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), 
yuv420p(tv, bt709/unknown/unknown, top coded first (swapped)), 1920x1080 
[SAR 1:1 DAR 16:9], 16643 kb/s, 25 fps, 25 tbr, 12800 tbn (default)


================================

Cin # CIN_10BIT_ENC=p010le bin/cin


hevc_vaapi_10b420.mp4
     cin_hw_dev=vaapi
     format=p010le,hwupload
     profile=main 10
     # global_quality=22

** rendered 1780 frames in 42.292 secs, 42.088 fps


ffprobe -hide_banner hd01_hevc_vaapi_10b420.mp4
   Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), 
yuv420p10le(tv, bt709/unknown/unknown, top coded first (swapped)), 
1920x1080 [SAR 1:1 DAR 16:9], 11752 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)

---------------

global_quality=22
** rendered 1780 frames in 39.585 secs, 44.967 fps

ffprobe -hide_banner hd01_hevc_vaapi_10b420_gq22.mp4
   Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), 
yuv420p10le(tv, bt709/unknown/unknown, top coded first (swapped)), 
1920x1080 [SAR 1:1 DAR 16:9], 17038 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)

===================================

/Cin # CIN_10BIT_ENC=y210le bin/cin

hevc_vaapi_10b422.mp4
     cin_hw_dev=vaapi
     format=y210le,hwupload
     profile=4
     # global_quality=22

** rendered 1780 frames in 41.599 secs, 42.789 fps


ffprobe -hide_banner hd01_hevc_vaapi_10b422.mp4
   Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 / 0x31766568), 
yuv422p10le(tv, bt709/unknown/unknown, top coded first (swapped)), 
1920x1080 [SAR 1:1 DAR 16:9], 13432 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)

----------------

global_quality=22
** rendered 1780 frames in 41.923 secs, 42.459 fps

ffprobe -hide_banner hd01_hevc_vaapi_10b422_gq22.mp4
   Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 / 0x31766568), 
yuv422p10le(tv, bt709/unknown/unknown, top coded first (swapped)), 
1920x1080 [SAR 1:1 DAR 16:9], 17992 kb/s, 25 fps, 25 tbr, 12800 tbn 
(default)

===================================


>
>
> Just recompiled cin  with this patch and (after adding logleve=debug 
> to bin/ffmpeg/encode.opts ) I have:
>
> bash-5.1$ bin/cin
> Cinelerra Infinity - built: Nov 15 2024 10:55:42
> git://git.cinelerra-gg.org/goodguy/cinelerra.git 
> <http://git.cinelerra-gg.org/goodguy/cinelerra.git>
> (c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
> 2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy
> 2003-2017 mods for Cinelerra-CV by CinelerraCV team
> 2015-2024 mods for Cinelerra-GG by Cinelerra-GG team
>
> Libav version: Lavc61.3.100
>
> Cinelerra is free software, covered by the GNU General Public License,
> and you are welcome to change it and/or distribute copies of it under
> certain conditions. There is absolutely no warranty for Cinelerra.
>
> RenderFarmClient::main_loop: client started
> [AVHWDeviceContext @ 0xd7b03740] Trying to use DRM render node for 
> device 0.
> [AVHWDeviceContext @ 0xd7b03740] libva: VA-API version 1.19.0
> [AVHWDeviceContext @ 0xd7b03740] libva: Trying to open 
> /usr/lib/dri/nouveau_drv_video.so
> [AVHWDeviceContext @ 0xd7b03740] libva: Found init function 
> __vaDriverInit_1_19
> [AVHWDeviceContext @ 0xd7b03740] libva: va_openDriver() returns 0
> [AVHWDeviceContext @ 0xd7b03740] Initialised VAAPI connection: version 
> 1.19
> [AVHWDeviceContext @ 0xd7b03740] Format 0x3231564e -> nv12.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x30313050 -> p010le.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x36313050 -> unknown.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x30323449 -> yuv420p.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x32315659 -> yuv420p.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x56595559 -> unknown.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x32595559 -> yuyv422.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x59565955 -> uyvy422.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x41524742 -> bgra.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x41424752 -> rgba.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x58524742 -> bgr0.
> [AVHWDeviceContext @ 0xd7b03740] Format 0x58424752 -> rgb0.
> [AVHWDeviceContext @ 0xd7b03740] VAAPI driver: Mesa Gallium driver 
> 22.1.7 for NV106.
> [AVHWDeviceContext @ 0xd7b03740] Driver not found in known nonstandard 
> list, using standard behaviour.
> [AVHWFramesContext @ 0xd7b30900] Created surface 0x1.
> [AVHWFramesContext @ 0xd7b30900] Direct mapping disabled: deriving 
> image does not work: 1 (operation failed).
> [hevc_vaapi @ 0xd7b0ca40] Input surface format is nv12.
> [hevc_vaapi @ 0xd7b0ca40] Compatible profile VAProfileHEVCMain (17) is 
> not supported by driver.
> [hevc_vaapi @ 0xd7b0ca40] Compatible profile VAProfileHEVCMain (17) is 
> not supported by driver.
> [hevc_vaapi @ 0xd7b0ca40] No usable encoding profile found.
> FFMPEG::open_encoder  err: Function not implemented
> int FFMPEG::open_encoder(const char*, const char*):
> open failed hevc_vaapi:/dev/shm/vaapi-test.mp4
> Render::render_single: Session finished.
> Total excess of backups: -50
> [AVIOContext @ 0xf4139c40] Statistics: 196608 bytes read, 0 seeks
> [AVIOContext @ 0xf413a680] Statistics: 196608 bytes read, 0 seeks
> [AVIOContext @ 0xda276c00] Statistics: 294912 bytes read, 0 seeks
> [AVIOContext @ 0xda2e6dc0] Statistics: 196608 bytes read, 0 seeks
> [AVIOContext @ 0xe4ed3e80] Statistics: 18991217 bytes read, 18 seeks
> [AVIOContext @ 0xe4e0a280] Statistics: 196608 bytes read, 0 seeks
> Session time: 0:00:29
> Cpu time: user: 0:00:14.957 sys: 0:00:01.831
>
> note that it says HevcMain
>
> bash-5.1$ CIN_10BIT_ENC=p010le bin/cin
> Cinelerra Infinity - built: Nov 15 2024 10:55:42
> git://git.cinelerra-gg.org/goodguy/cinelerra.git 
> <http://git.cinelerra-gg.org/goodguy/cinelerra.git>
> (c) 2006-2019 Heroine Virtual Ltd. by Adam Williams
> 2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguy
> 2003-2017 mods for Cinelerra-CV by CinelerraCV team
> 2015-2024 mods for Cinelerra-GG by Cinelerra-GG team
>
> Libav version: Lavc61.3.100
>
> Cinelerra is free software, covered by the GNU General Public License,
> and you are welcome to change it and/or distribute copies of it under
> certain conditions. There is absolutely no warranty for Cinelerra.
>
> RenderFarmClient::main_loop: client started
> [AVHWDeviceContext @ 0xd4bfd880] Trying to use DRM render node for 
> device 0.
> [AVHWDeviceContext @ 0xd4bfd880] libva: VA-API version 1.19.0
> [AVHWDeviceContext @ 0xd4bfd880] libva: Trying to open 
> /usr/lib/dri/nouveau_drv_video.so
> [AVHWDeviceContext @ 0xd4bfd880] libva: Found init function 
> __vaDriverInit_1_19
> [AVHWDeviceContext @ 0xd4bfd880] libva: va_openDriver() returns 0
> [AVHWDeviceContext @ 0xd4bfd880] Initialised VAAPI connection: version 
> 1.19
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x3231564e -> nv12.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x30313050 -> p010le.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x36313050 -> unknown.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x30323449 -> yuv420p.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x32315659 -> yuv420p.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x56595559 -> unknown.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x32595559 -> yuyv422.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x59565955 -> uyvy422.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x41524742 -> bgra.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x41424752 -> rgba.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x58524742 -> bgr0.
> [AVHWDeviceContext @ 0xd4bfd880] Format 0x58424752 -> rgb0.
> [AVHWDeviceContext @ 0xd4bfd880] VAAPI driver: Mesa Gallium driver 
> 22.1.7 for NV106.
> [AVHWDeviceContext @ 0xd4bfd880] Driver not found in known nonstandard 
> list, using standard behaviour.
> [AVHWFramesContext @ 0xce249500] Created surface 0x1.
> [AVHWFramesContext @ 0xce249500] Direct mapping possible.
> [hevc_vaapi @ 0xce2a60c0] Input surface format is p010le.
> [hevc_vaapi @ 0xce2a60c0] Compatible profile VAProfileHEVCMain10 (18) 
> is not supported by driver.
> [hevc_vaapi @ 0xce2a60c0] Compatible profile VAProfileHEVCMain10 (18) 
> is not supported by driver.
> [hevc_vaapi @ 0xce2a60c0] No usable encoding profile found.
> FFMPEG::open_encoder  err: Function not implemented
> int FFMPEG::open_encoder(const char*, const char*):
> open failed hevc_vaapi:/dev/shm/vaapi-test.mp4
> Render::render_single: Session finished.
> Total excess of backups: -50
> [AVIOContext @ 0xd6e988c0] Statistics: 196608 bytes read, 0 seeks
> [AVIOContext @ 0xf403aa40] Statistics: 196608 bytes read, 0 seeks
> [AVIOContext @ 0xe4e86ec0] Statistics: 294912 bytes read, 0 seeks
> [AVIOContext @ 0xe4ed9cc0] Statistics: 196608 bytes read, 0 seeks
> [AVIOContext @ 0xef74cfc0] Statistics: 18991217 bytes read, 18 seeks
> [AVIOContext @ 0xef709c00] Statistics: 196608 bytes read, 0 seeks
> Session time: 0:00:24
> Cpu time: user: 0:00:15.011 sys: 0:00:01.294
>
>
> note what it says HevcMain10 ofc those are 'dry runs' because I do not 
> have hardware ...
>
>
>
>
>
>         --------------------------
>
>         My third Cin test using nv12
>
>         /Cin
>
>         # CIN_10BIT_ENC=nv12 bin/cin
>         Cinelerra Infinity - built: Nov 13 2024 20:54:33
>
>         hevc_vaapi_8b420.mp4
>             cin_hw_dev=vaapi
>             format=nv12,hwupload
>             # profile=main
>             # global_quality=22
>
>         ** rendered 1780 frames in 41.675 secs, 42.711 fps
>         FFMPEG::open_decoder: some stream times estimated:
>         /Videoklipp/Cineform/cfhd01.mkv
>
>
>         ffprobe -hide_banner hd01_hevc_vaapi_8b420.mp4
>           Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 /
>         0x31766568), yuv422p10le(tv, bt709/unknown/unknown, top coded
>         first (swapped)), 1920x1080 [SAR 1:1 DAR 16:9], 24375 kb/s, 25
>         fps, 25 tbr, 12800 tbn (default)
>
>         ===========================
>
>         Some output for verification:
>
>         /Cin/cinelerra # egrep -i "10bit|tenbit|nv12|p010|y210" ffmpeg.C
>         GET_HW_PIXFMT(nv12,  AV_PIX_FMT_NV12)
>                 case AV_PIX_FMT_NV12: ctx->get_format = get_hw_nv12; 
>         return *p;
>             const char *tenbit_enc = getenv("CIN_10BIT_ENC");
>                 frames_ctx->sw_format = AV_PIX_FMT_NV12;
>                 if(tenbit_enc)
>                 frames_ctx->sw_format = av_get_pix_fmt(tenbit_enc);
>                 picture->format = AV_PIX_FMT_NV12;
>
>         ----------------------
>
>         git log 2>&1 | tee git_log_after_another_10bit_patch
>
>         Top of the output:
>
>         commit 4d42448cc128d7d18e34eb97d4234e73b9acb360
>         Author: Andrew Randrianasulu <randrianasulu at gmail.com>
>         <mailto:randrianasulu at gmail.com>
>         Date:   Thu Nov 14 16:18:24 2024 +0300
>
>             yet another 10bit attempt
>
>         commit e5a5a6da907dbcd40d8612bdbfeea1a2a0ae6cc8
>         Author: Andrew Randrianasulu <randrianasulu at gmail.com>
>         <mailto:randrianasulu at gmail.com>
>         Date:   Fri Oct 18 10:07:33 2024 +0300
>
>             Add onevpl support to build system
>
>         =========================
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/85095a76/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_vaapi_8b420.mp4
Type: video/mp4
Size: 86 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/85095a76/attachment-0003.mp4>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_vaapi_10b420.mp4
Type: video/mp4
Size: 85 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/85095a76/attachment-0004.mp4>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hevc_vaapi_10b422.mp4
Type: video/mp4
Size: 85 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241115/85095a76/attachment-0005.mp4>


More information about the Cin mailing list