mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-24 18:18:06 +00:00
More exception catches and fix for boost
This commit is contained in:
parent
c9df86c9f0
commit
3d3f092b1a
1 changed files with 19 additions and 14 deletions
27
av1an.py
27
av1an.py
|
@ -550,19 +550,24 @@ class Av1an:
|
|||
|
||||
def boost(self, command: str, br_geom, new_cq=0):
|
||||
"""Based on average brightness of video decrease(boost) Quantize value for encoding."""
|
||||
cq = self.man_cq(command, -1)
|
||||
if not new_cq:
|
||||
if br_geom < 128:
|
||||
new_cq = cq - round((128 - br_geom) / 128 * self.d.get('br'))
|
||||
try:
|
||||
cq = self.man_cq(command, -1)
|
||||
if not new_cq:
|
||||
if br_geom < 128:
|
||||
new_cq = cq - round((128 - br_geom) / 128 * self.d.get('boost_range'))
|
||||
|
||||
# Cap on boosting
|
||||
if new_cq < self.d.get('bl'):
|
||||
new_cq = self.d.get('bl')
|
||||
else:
|
||||
new_cq = cq
|
||||
cmd = self.man_cq(command, new_cq)
|
||||
# Cap on boosting
|
||||
if new_cq < self.d.get('boost_limit'):
|
||||
new_cq = self.d.get('boost_limit')
|
||||
else:
|
||||
new_cq = cq
|
||||
cmd = self.man_cq(command, new_cq)
|
||||
|
||||
return cmd, new_cq
|
||||
return cmd, new_cq
|
||||
|
||||
except Exception as e:
|
||||
_, _, exc_tb = sys.exc_info()
|
||||
print(f'Error in encoding loop {e}\nAt line {exc_tb.tb_lineno}')
|
||||
|
||||
def plot_vmaf(self):
|
||||
with open(self.d.get('temp') / 'vmaf.txt', 'r') as f:
|
||||
|
|
Loading…
Reference in a new issue