Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd January 2023, 12:37   #8961  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Quote:
Originally Posted by jpsdr View Post
@LeXXuz
For the same command line effect, you have to replace --sbrc --sbrc-aq5 --sbrc-hyst with --aq-auto 10 assuming you don't want the new sbrc (wich has totaly nothing to do with the first patch) and just keep the auto AQ feature.
(And still check with the log file )
Thank you jpsdr. Actually I'm not sure if I want or need the new sbrc as I don't fully understand what it does and if it is beneficial for my usage.

So with the latest version I just add "--aq-mode 5 --aq-auto 10", is that right?

EDIT: Btw the clang version shows "x265 [INFO]: build info [Windows][MSVC 1928][64 bit] 10bit", is that correct

Last edited by LeXXuz; 22nd January 2023 at 13:36.
LeXXuz is offline   Reply With Quote
Old 23rd January 2023, 06:17   #8962  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by LeXXuz View Post
So with the latest version I just add "--aq-mode 5 --aq-auto 10", is that right?
If you want to use the automatic AQ mode with AQ5 + hysteresis enabled, just use --aq-auto 10. --aq-auto 6 for HDR (enables auto mode + hysteresis, no AQ3 or AQ5 used since it's counterproductive).
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 23rd January 2023, 18:34   #8963  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
Quote:
Originally Posted by LeXXuz View Post
EDIT: Btw the clang version shows "x265 [INFO]: build info [Windows][MSVC 1928][64 bit] 10bit", is that correct
Yes, because it's build with llvm but still with Visual Studio (so using clang compiler instead).
__________________
My github.
jpsdr is offline   Reply With Quote
Old 30th January 2023, 05:59   #8964  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
@jpsdr: I've seen mentioned in some places that AQ mode 4 needs a bit lower aq-strength than other modes. Would it be possible to have a separate aq-strength parameter for it in case aq-auto is enabled?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 30th January 2023 at 06:10.
Boulder is offline   Reply With Quote
Old 30th January 2023, 21:22   #8965  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
@Boulder
Euh... I don't know. I'll see but absolutely not promises... Don't have time for now.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 31st January 2023, 05:57   #8966  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by jpsdr View Post
@Boulder
Euh... I don't know. I'll see but absolutely not promises... Don't have time for now.
Thank you

I was thinking that it might be as simple as adding the parameter and then conditionally using it as the base strength when the mode for the frame is either X265_AQ_EDGE or X265_AQ_EDGE_BIAS.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 31st January 2023, 18:29   #8967  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
@Boulder
For X265_AQ_EDGE the calcul is:
Code:
                            inclinedEdge = curFrame->m_lowres.edgeInclined[blockXY];
                            qp_adj = curFrame->m_lowres.qpCuTreeOffset[blockXY];
                            if(inclinedEdge && (qp_adj - avg_adj > 0))
                                qp_adj = ((strength + AQ_EDGE_BIAS) * (qp_adj - avg_adj));
                            else
                                qp_adj = strength * (qp_adj - avg_adj);
So, you want something that can change the value of strength when aq-auto is enabled ?
If it's that, 2 options. Somethings like strength2 = strength*coeff or strength2 = strength + bias with coeff=1 or bias=0 when aq-auto is disabled and use strength2 instead of strength in calcul.
And if i add some kind of AQ4 specific parameter, it can be applied to AQ 4 mode, with or without aq-auto enable, if default value keeps original behavior.
__________________
My github.

Last edited by jpsdr; 31st January 2023 at 18:44.
jpsdr is offline   Reply With Quote
Old 31st January 2023, 19:20   #8968  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
What I was thinking was basically that - having AQ 4 its own strength parameter. Maybe making it equal to aq-strength in case aq-auto is not enabled so any command line would work normally.

I was wondering if it would make sense to just change the calculation of 'strength' here, I haven't had the time to get the whole idea to work because the compiled exe won't accept my new parameters for some reason. What I did was just carbon copy the existing aq-strength and aq-bias-strength parameters in various files and adjust the variable names accordingly, but probably I've missed something. In this example there's also a different value for AQ 5 bias strength.

Code:
                    if (param->rc.aqMode == X265_AQ_EDGE || param->rc.aqMode == X265_AQ_EDGE_BIASED)
                        strength = param->rc.aqStrengthEdge * avg_adj;
                    else
                        strength = param->rc.aqStrength * avg_adj;
                    avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - modeTwoConst) / avg_adj;
                    if (param->rc.aqMode == X265_AQ_EDGE_BIASED)
                        bias_strength = param->rc.aqBiasStrengthEdge * param->rc.aqStrengthEdge;
                    else
                        bias_strength = param->rc.aqBiasStrength * param->rc.aqStrength;
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 1st February 2023 at 16:53.
Boulder is offline   Reply With Quote
Old 1st February 2023, 20:35   #8969  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
Is it what you want ?
https://github.com/jpsdr/x265/commit...6dc36cef1d1880
__________________
My github.
jpsdr is offline   Reply With Quote
Old 2nd February 2023, 05:51   #8970  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by jpsdr View Post
Yes, that looks exactly what I thought of doing Thank you so much, I really appreciate it
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 2nd February 2023, 14:21   #8971  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
I don't know when i'll be able to make a build (as it takes time), maybe this evening, maybe in few days, but you still can make your own build frommy github.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 2nd February 2023, 19:20   #8972  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by jpsdr View Post
I don't know when i'll be able to make a build (as it takes time), maybe this evening, maybe in few days, but you still can make your own build frommy github.
No worries, I created a diff file to use for patching in Media Autobuild Suite so I got a compiled exe to test. First impression looks good, so I believe it's working. I didn't do any frame by frame compares but just watched an encoded clip to see if anything's weird.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 2nd February 2023 at 19:27.
Boulder is offline   Reply With Quote
Old 5th February 2023, 11:43   #8973  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,316
If you have your own build, in that case, i'll realy take my time to make a new build...
__________________
My github.
jpsdr is offline   Reply With Quote
Old 5th February 2023, 11:55   #8974  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by jpsdr View Post
If you have your own build, in that case, i'll realy take my time to make a new build...
Yeah, no problem with that

If anyone wants to test the modifications, here's the build I made. 10-bit only, and optimized for Zen 3. I can also provide the patch file I used if needed.

https://drive.google.com/file/d/1WGi...usp=share_link
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 5th February 2023, 17:30   #8975  |  Link
vadlerg
Registered User
 
Join Date: May 2005
Posts: 15
Thank You for sharing the build.

--aq-auto 10 works. It is about 3% faster than --aq-mode 4 and may preserve a bit more detail.

When using --rd 4 --dynamic-rd 3 options I've got the warning
Quote:
x265 [WARN]: Dynamic-rd disabled, requires RD <= 4, VBV and aq-mode enabled
That seems to be not rational. There must be some typo in the source, the build itself is OK.
vadlerg is offline   Reply With Quote
Old 5th February 2023, 19:40   #8976  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by vadlerg View Post
Thank You for sharing the build.

--aq-auto 10 works. It is about 3% faster than --aq-mode 4 and may preserve a bit more detail.

When using --rd 4 --dynamic-rd 3 options I've got the warning


That seems to be not rational. There must be some typo in the source, the build itself is OK.
The error message is a bit bad English to me. Do you have VBV enabled as well? I believe the AQ-mode checks ok if AQ auto is enabled.

Code:
if (m_param->dynamicRd && (!bIsVbv || !p->rc.aqMode || p->rdLevel > 4))
    {
        p->dynamicRd = 0;
        x265_log(p, X265_LOG_WARNING, "Dynamic-rd disabled, requires RD <= 4, VBV and aq-mode enabled\n");
    }
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 6th February 2023, 08:07   #8977  |  Link
vadlerg
Registered User
 
Join Date: May 2005
Posts: 15
VBV is set automatically because of the parameters
Quote:
--crf 18 --preset slower --profile main10 --level-idc 52
.
aqMode should be 2 by default, but --aq-auto 10 sets it to
Quote:
AQ: mode / str(edg) / qg-size / cu-tree : auto-hyst-aq5 / 1.0(1.0) / 32 / 1
rdLevel is set to 4 and encoder still disabling dynamic-rd, even if I set --rd to 3.
In the INFO section I see
Quote:
x265 [INFO]: tools: rect amp limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
x265 [INFO]: tools: rskip mode=2 rskip-edge-threshold=0.03 limit-tu=4 signhide
x265 [INFO]: tools: tmvp b-intra strong-intra-smoothing deblock sao
x265 [INFO]: tools: selective-sao
vadlerg is offline   Reply With Quote
Old 6th February 2023, 09:06   #8978  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,729
Quote:
Originally Posted by vadlerg View Post
aqMode should be 2 by default
Then it must be because of --aq-auto. I'll take a look at it when I'm back home from work and adjust that check in the code accordingly to make it work again.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 6th February 2023, 09:35   #8979  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Quote:
Originally Posted by vadlerg View Post
aqMode should be 2 by default, but --aq-auto 10 sets it to
Isn't that what it is supposed to do?
https://forum.doom9.org/showthread.p...00#post1981600
LeXXuz is offline   Reply With Quote
Old 6th February 2023, 09:41   #8980  |  Link
vadlerg
Registered User
 
Join Date: May 2005
Posts: 15
Of course it is what it supposed to be but this should not disable dynamicRd.
vadlerg is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.