# SPDX-License-Identifier: MIT from ..utils import * from collections import namedtuple from enum import IntEnum EncodeNotRawDescriptor = namedtuple('EncodeNotRawDescriptor', [ 'flags', # +0x000 # [31:16] ????? # 13 ????? # 12 ????? # [11:9] ????? # 8 - enable alpha # 7 - alpha channel bpp # 0 -> 8bpp # 1 -> 16bpp # 6 - something unknown about tiling # [5:4] ????? # [3:2] - chroma subsampling # 00 -> broken? # 01 -> broken? # 10 -> 4:2:2 # 11 -> 4:4:4 # [1:0] - input bpp # 00 -> 8bpp # 01 -> 16bpp? # 10 -> 16bpp? # 11 -> 16bpp? # the last three all produce slightly differnet outputs # so might be 10/12/14/16????? 'flags2', # +0x004 'output_iova', # +0x008 'max_out_sz', # +0x010 'offset_x', # +0x014 'offset_y', # +0x016 'pix_surface_w_2_', # +0x018 'pix_surface_h_2_', # +0x01a 'pix_surface_w', # +0x01c 'pix_surface_h', # +0x01e 'luma_stride', # +0x020 'chroma_stride', # +0x022 'alpha_stride', # +0x024 'unk_pad_0x26_', # +0x026 'luma_iova', # +0x028 'pix_plane0_tileheader_thing_', # +0x030 'chroma_iova', # +0x038 'pix_plane1_tileheader_thing_', # +0x040 'alpha_iova', # +0x048 'pix_plane2_tileheader_thing_', # +0x050 'frame_header_sz', # +0x058 'unk_pad_0x5a_', # +0x05a 'bitstream_version', # +0x05b 'encoder_identifier', # +0x05c 'pix_surface_w_byteswap_', # +0x060 'pix_surface_h_byteswap_', # +0x062 'chroma_format_interlace_mode', # +0x064 'aspect_ratio_frame_rate', # +0x065 'color_primaries', # +0x066 'transfer_characteristic', # +0x067 'matrix_coefficients', # +0x068 'alpha_channel_type', # +0x069 'frame_hdr_reserved14', # +0x06a 'unk_pad_0x6c_', # +0x06c 'deprecated_number_of_slices', # +0x0ec 'log2_desired_slice_size_in_mb', # +0x0ee 'quantization_index', # +0x0ef 'unk_0xf0_', # +0x0f0 'unk_0xf2_', # +0x0f2 'unk_0xf4_', # +0x0f4 'unk_0xfc_', # +0x0fc 'unk_0x100_0_', # +0x100 'unk_0x100_1_', # +0x104 'unk_0x100_2_', # +0x108 'unk_0x100_3_', # +0x10c 'unk_0x110_0_', # +0x110 'unk_0x110_1_', # +0x114 'unk_0x110_2_', # +0x118 'unk_0x110_3_', # +0x11c 'unk_0x110_4_', # +0x120 'unk_0x110_5_', # +0x124 'unk_0x110_6_', # +0x128 'unk_0x110_7_', # +0x12c 'unk_0x110_8_', # +0x130 'unk_0x110_9_', # +0x134 'unk_0x110_10_', # +0x138 'unk_0x110_11_', # +0x13c 'unk_0x110_12_', # +0x140 'unk_0x110_13_', # +0x144 'unk_0x110_14_', # +0x148 'unk_0x110_15_', # +0x14c 'quant_table_sel', # +0x150 # upper nibble: quality / table index # lower nibble UNKNOWN! 'unk_pad_0x154_', # +0x154 ]) ENCODE_NOT_RAW_STRUCT = "