FFmpeg
Loading...
Searching...
No Matches
ffv1_vulkan.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Lynne <dev@lynne.ee>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef AVCODEC_FFV1_VULKAN_H
22#define AVCODEC_FFV1_VULKAN_H
23
24#include "libavutil/vulkan.h"
25#include "ffv1.h"
26
28 VkSpecializationInfo *sl,
29 enum AVPixelFormat sw_format);
30
32
33/* Context inputs 0 and 3 of the quant tables as a function of the signed
34 * 8-bit difference d, with one threshold per subgroup invocation:
35 * q(d) = q(-128) + scale*#{k : thresh[k] <= d}, where scale is 1 for input 0.
36 * scale_off holds the scale of input 3 and the sum of both q(-128). */
41
42/**
43 * Number of invocations that range code a slice together, as a single
44 * subgroup. Each of them holds CONTEXT_SIZE/lanes of the states of a
45 * context. This is CONTEXT_SIZE if the subgroup size can be set to it, or
46 * the largest subgroup size below it otherwise. required is set to the
47 * subgroup size the shader must be created with, or 0.
48 */
49uint32_t ff_ffv1_vk_rc_lanes(const FFVulkanContext *s, uint32_t *required);
50
51/**
52 * Fill in the ballot quantizers of all quant tables.
53 * Returns 1 if all of them can be evaluated with a ballot.
54 */
56
57typedef struct FFv1ShaderParams {
58 VkDeviceAddress slice_data;
59
60 uint32_t extend_lookup[8];
61 uint16_t context_count[8];
62
63 int fmt_lut[4];
64 uint16_t img_size[2];
65
67 uint32_t key_frame;
68 uint32_t crcref;
70
71 /* Encoder-only */
72 int sar[2];
76
77 /* Decoder-only */
78 uint32_t remap_allowed;
80
81#endif /* AVCODEC_FFV1_VULKAN_H */
int32_t
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
FF Video Codec 1 (a lossless codec)
#define MAX_QUANT_TABLES
Definition ffv1.h:47
int ff_ffv1_vk_quant_ballot(const FFV1Context *f, FFv1QuantBallot *qb)
Fill in the ballot quantizers of all quant tables.
int ff_ffv1_vk_init_consts(FFVulkanContext *s, FFVkBuffer *vkb, FFV1Context *f)
uint32_t ff_ffv1_vk_rc_lanes(const FFVulkanContext *s, uint32_t *required)
Number of invocations that range code a slice together, as a single subgroup.
Definition ffv1_vulkan.c:85
void ff_ffv1_vk_set_common_sl(AVCodecContext *avctx, FFV1Context *f, VkSpecializationInfo *sl, enum AVPixelFormat sw_format)
Definition ffv1_vulkan.c:24
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
main external API structure.
Definition avcodec.h:443
int32_t scale_off[MAX_QUANT_TABLES][2]
Definition ffv1_vulkan.h:39
int32_t thresh[MAX_QUANT_TABLES][32][2]
Definition ffv1_vulkan.h:38
uint32_t plane_state_size
Definition ffv1_vulkan.h:66
uint16_t img_size[2]
Definition ffv1_vulkan.h:64
uint32_t max_pixels_per_slice
Definition ffv1_vulkan.h:75
uint32_t key_frame
Definition ffv1_vulkan.h:67
uint16_t context_count[8]
Definition ffv1_vulkan.h:61
uint32_t remap_allowed
Definition ffv1_vulkan.h:78
uint32_t slice_size_max
Definition ffv1_vulkan.h:74
uint32_t extend_lookup[8]
Definition ffv1_vulkan.h:60
VkDeviceAddress slice_data
Definition ffv1_vulkan.h:58