Skip to content

Commit

Permalink
Add dav1d AV1 decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
charlie-ht committed Sep 4, 2023
1 parent 37cdca1 commit 2c2e48a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions fluster/decoders/av1_dav1d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Fluster - testing framework for decoders conformance
# Copyright (C) 2023, Igalia S.L.
# Author: Charlie Turner <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <https://www.gnu.org/licenses/>.

from fluster.codec import Codec, OutputFormat
from fluster.decoder import Decoder, register_decoder
from fluster.utils import file_checksum, run_command


@register_decoder
class AV1Dav1dDecoder(Decoder):
"""dav1d decoder implementation"""

name = "dav1d-AV1"
description = "dav1d AV1 decoder"
binary = "dav1d"
codec = Codec.AV1

def decode(
self,
input_filepath: str,
output_filepath: str,
output_format: OutputFormat,
timeout: int,
verbose: bool,
keep_files: bool,
) -> str:
"""Decodes input_filepath in output_filepath"""
fmt = "yuv"
run_command(
[self.binary, "--alllayers", "0", "--muxer", fmt, "-i", input_filepath, "-o", output_filepath],
timeout=timeout,
verbose=verbose,
)
return file_checksum(output_filepath)

0 comments on commit 2c2e48a

Please sign in to comment.