From bf3e50ffa0bb829c3486a44a0a858e9968f67b9a Mon Sep 17 00:00:00 2001 From: Ynse Hoornenborg Date: Tue, 5 Nov 2024 20:48:40 +0100 Subject: [PATCH] Add some SVT references --- .../Heif/Av1/Pipeline/Av1FrameDecoder.cs | 19 +++-- .../Heif/Av1/Pipeline/Av1FrameEncoder.cs | 74 +++++++++++++++++++ 2 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameEncoder.cs diff --git a/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameDecoder.cs b/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameDecoder.cs index 77c69df3f7..06946271af 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameDecoder.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameDecoder.cs @@ -39,7 +39,11 @@ internal class Av1FrameDecoder bool doLoopFilterFlag = false; bool doLoopRestoration = false; bool doUpscale = false; - this.DecodeLoopFilterForFrame(doLoopFilterFlag); + if (doLoopFilterFlag) + { + this.DecodeLoopFilterForFrame(); + } + if (doLoopRestoration) { // LoopRestorationSaveBoundaryLines(false); @@ -56,6 +60,9 @@ internal class Av1FrameDecoder // PadPicture(); } + /// + /// SVT: decode_tile + /// private void DecodeFrameTiles(int tileColumn) { int tileRowCount = this.frameHeader.TilesInfo.TileRowCount; @@ -74,6 +81,9 @@ internal class Av1FrameDecoder } } + /// + /// SVT: decode_tile_row + /// private void DecodeTileRow(int tileRow, int tileColumn, int modeInfoRow, int superblockRow) { int superblockModeInfoSizeLog2 = this.sequenceHeader.SuperblockSizeLog2 - Av1Constants.ModeInfoSizeLog2; @@ -122,13 +132,8 @@ internal class Av1FrameDecoder } } - private void DecodeLoopFilterForFrame(bool doLoopFilterFlag) + private void DecodeLoopFilterForFrame() { - if (!doLoopFilterFlag) - { - return; - } - int superblockSizeLog2 = this.sequenceHeader.SuperblockSizeLog2; int pictureWidthInSuperblocks = Av1Math.DivideLog2Ceiling(this.frameHeader.FrameSize.FrameWidth, this.sequenceHeader.SuperblockSizeLog2); int pictureHeightInSuperblocks = Av1Math.DivideLog2Ceiling(this.frameHeader.FrameSize.FrameHeight, this.sequenceHeader.SuperblockSizeLog2); diff --git a/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameEncoder.cs b/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameEncoder.cs new file mode 100644 index 0000000000..90529ab1fd --- /dev/null +++ b/src/ImageSharp/Formats/Heif/Av1/Pipeline/Av1FrameEncoder.cs @@ -0,0 +1,74 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using SixLabors.ImageSharp.Formats.Heif.Av1.Tiling; + +namespace SixLabors.ImageSharp.Formats.Heif.Av1.Pipeline; + +internal class Av1FrameEncoder +{ + private readonly Av1FrameBuffer frameBuffer; + + public Av1FrameEncoder(Av1FrameBuffer frameBuffer) + { + this.frameBuffer = frameBuffer; + } + + /// + /// SVT: svt_av1_enc_init + /// + public static void Encode() + { + /************************************ + * Thread Handles + ************************************/ + + // Resource Coordination + // Single thread calling svt_aom_resource_coordination_kernel with context enc_handle_ptr->resource_coordination_context_ptr + // Multiple threads calling svt_aom_picture_analysis_kernel, with context enc_handle_ptr->picture_analysis_context_ptr_array + + // Picture Decision + // Single thread calling svt_aom_picture_decision_kernel with context enc_handle_ptr->picture_decision_context_ptr + + // Motion Estimation + // Multiple threads calling svt_aom_motion_estimation_kernel with context enc_handle_ptr->motion_estimation_context_ptr_array + + // Initial Rate Control + // Single thread calling svt_aom_initial_rate_control_kernel with context enc_handle_ptr->initial_rate_control_context_ptr + + // Source Based Oprations + // source_based_operations_context_ptr_array + + // TPL dispenser + // Multiple threads calling svt_aom_tpl_disp_kernel with context enc_handle_ptr->tpl_disp_context_ptr_array + + // Picture Manager + // Single thread calling svt_aom_picture_manager_kernel with context enc_handle_ptr->picture_manager_context_ptr + + // Rate Control + // Single thread calling svt_aom_rate_control_kernel with context enc_handle_ptr->rate_control_context_ptr + + // Mode Decision Configuration Process + // Multiple threads calling svt_aom_mode_decision_configuration_kernel with context enc_handle_ptr->mode_decision_configuration_context_ptr_array + + // EncDec Process + // Multiple threads calling svt_aom_mode_decision_kernel enc_handle_ptr->enc_dec_context_ptr_array + + // Dlf Process + // Multiple threads calling svt_aom_dlf_kernel with context enc_handle_ptr->dlf_context_ptr_array + + // Cdef Process + // Multiple threads calling svt_aom_cdef_kernel enc_handle_ptr->cdef_context_ptr_array + + // Rest Process + // Multiple threads calling svt_aom_rest_kernel enc_handle_ptr->rest_context_ptr_array + + // Entropy Coding Process + // Multiple threads calling svt_aom_entropy_coding_kernel enc_handle_ptr->entropy_coding_context_ptr_array + + // Packetization + // Single thread calling svt_aom_packetization_kernel with context enc_handle_ptr->packetization_context_ptr + + // svt_print_memory_usage(); + } +}