mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-25 02:29:40 +00:00
Update reuse first pass
This commit is contained in:
parent
b1b9703640
commit
3a955bbf16
2 changed files with 7 additions and 19 deletions
|
@ -49,20 +49,6 @@ class Chunk:
|
|||
encoder = Av1an.ENCODERS[args.encoder]
|
||||
self.pass_cmds = encoder.compose_1_pass(args, self) if args.passes == 1 else encoder.compose_2_pass(args, self)
|
||||
|
||||
def remove_first_pass_from_commands(self) -> None:
|
||||
"""
|
||||
Removes the first pass command from the list of commands.
|
||||
Used with first pass reuse
|
||||
|
||||
:return: None
|
||||
"""
|
||||
# just one pass to begin with, do nothing
|
||||
if len(self.pass_cmds) == 1:
|
||||
return
|
||||
|
||||
# passes >= 2, remove the command for first pass (pass_cmds[0])
|
||||
self.pass_cmds = self.pass_cmds[1:]
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""
|
||||
Converts this chunk to a dictionary for easy json serialization
|
||||
|
|
|
@ -163,18 +163,20 @@ def encode(chunk: Chunk, args: Args):
|
|||
if args.vmaf_target:
|
||||
target_vmaf_routine(args, chunk)
|
||||
|
||||
# remove first pass command if reusing
|
||||
if args.reuse_first_pass:
|
||||
chunk.remove_first_pass_from_commands()
|
||||
|
||||
# if vvc, we need to create a yuv file
|
||||
if args.encoder == 'vvc':
|
||||
log(f'Creating yuv for chunk {chunk.name}\n')
|
||||
vvc_yuv_file = Vvc.to_yuv(chunk)
|
||||
log(f'Created yuv for chunk {chunk.name}\n')
|
||||
|
||||
# skip first pass if reusing
|
||||
if args.reuse_first_pass and args.passes >= 2:
|
||||
start = 2
|
||||
else:
|
||||
start = 1
|
||||
|
||||
# Run all passes for this chunk
|
||||
for current_pass in range(1, args.passes + 1):
|
||||
for current_pass in range(start, args.passes + 1):
|
||||
tqdm_bar(args, chunk, args.encoder, args.counter, chunk_frames, args.passes, current_pass)
|
||||
|
||||
# if vvc, we need to delete the yuv file
|
||||
|
|
Loading…
Reference in a new issue