History

vulkan_ffv1: externalize extended lookup check

8% speedup on nvidia on 4k.

Lynne committed 1 year ago

Commit 8ceabb61 parent 77f777d2 files · +7 −2Browse files

Unified · Split

2 files
  1. libavcodec/vulkan/ffv1_dec.comp +1 −2
  2. libavcodec/vulkan_ffv1.c +6 −0
libavcodec/vulkan/ffv1_dec.comp+1−2
@@ -47,8 +47,7 @@ ivec2 get_pred(ivec2 sp, ivec2 off, int p, int sw, uint8_t quant_table_idx) · 46 unmodified lines
4747 quant_table[quant_table_idx][1][(top[0] - top[1]) & MAX_QUANT_TABLE_MASK] +
4848 quant_table[quant_table_idx][2][(top[1] - top[2]) & MAX_QUANT_TABLE_MASK];
4949
50− if ((quant_table[quant_table_idx][3][127] != 0) ||
51− (quant_table[quant_table_idx][4][127] != 0)) {
50+ if (extend_lookup[quant_table_idx] > 0) {
5251 TYPE cur2 = TYPE(0);
5352 if (off.x > 0) {
5453 const ivec2 yoff_border2 = off.x == 1 ? ivec2(-1, -1) : ivec2(-2, 0);
libavcodec/vulkan_ffv1.c+6−0
@@ -88,6 +88,7 @@ typedef struct FFv1VkParameters { · 87 unmodified lines
8888 uint32_t crcref;
8989 int rct_offset;
9090
91+ uint8_t extend_lookup[8];
9192 uint8_t bits_per_raw_sample;
9293 uint8_t quant_table_count;
9394 uint8_t version;
@@ -120,6 +121,7 @@ static void add_push_data(FFVulkanShader *shd) · 26 unmodified lines
120121 GLSLC(1, uint32_t crcref; );
121122 GLSLC(1, int rct_offset; );
122123 GLSLC(0, );
124+ GLSLC(1, uint8_t extend_lookup[8]; );
123125 GLSLC(1, uint8_t bits_per_raw_sample; );
124126 GLSLC(1, uint8_t quant_table_count; );
125127 GLSLC(1, uint8_t version; );
@@ -456,6 +458,10 @@ static int vk_ffv1_end_frame(AVCodecContext *avctx) · 330 unmodified lines
456458 .golomb = f->ac == AC_GOLOMB_RICE,
457459 .check_crc = !!(avctx->err_recognition & AV_EF_CRCCHECK),
458460 };
461+ for (int i = 0; i < f->quant_table_count; i++)
462+ pd.extend_lookup[i] = (f->quant_tables[i][3][127] != 0) ||
463+ (f->quant_tables[i][4][127] != 0);
464+
459465
460466 /* For some reason the C FFv1 encoder/decoder treats these differently */
461467 if (sw_format == AV_PIX_FMT_GBRP10 || sw_format == AV_PIX_FMT_GBRP12 ||

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t