8% speedup on nvidia on 4k.
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -47,8 +47,7 @@ ivec2 get_pred(ivec2 sp, ivec2 off, int p, int sw, uint8_t quant_table_idx) · 46 unmodified lines | |||
| 47 | quant_table[quant_table_idx][1][(top[0] - top[1]) & MAX_QUANT_TABLE_MASK] + | 47 | quant_table[quant_table_idx][1][(top[0] - top[1]) & MAX_QUANT_TABLE_MASK] + |
| 48 | quant_table[quant_table_idx][2][(top[1] - top[2]) & MAX_QUANT_TABLE_MASK]; | 48 | quant_table[quant_table_idx][2][(top[1] - top[2]) & MAX_QUANT_TABLE_MASK]; |
| 49 | 49 | ||
| 50 | if ((quant_table[quant_table_idx][3][127] != 0) || | 50 | if (extend_lookup[quant_table_idx] > 0) { |
| 51 | (quant_table[quant_table_idx][4][127] != 0)) { | ||
| 52 | TYPE cur2 = TYPE(0); | 51 | TYPE cur2 = TYPE(0); |
| 53 | if (off.x > 0) { | 52 | if (off.x > 0) { |
| 54 | const ivec2 yoff_border2 = off.x == 1 ? ivec2(-1, -1) : ivec2(-2, 0); | 53 | const ivec2 yoff_border2 = off.x == 1 ? ivec2(-1, -1) : ivec2(-2, 0); |
| @@ -88,6 +88,7 @@ typedef struct FFv1VkParameters { · 87 unmodified lines | |||
| 88 | uint32_t crcref; | 88 | uint32_t crcref; |
| 89 | int rct_offset; | 89 | int rct_offset; |
| 90 | 90 | ||
| 91 | uint8_t extend_lookup[8]; | ||
| 91 | uint8_t bits_per_raw_sample; | 92 | uint8_t bits_per_raw_sample; |
| 92 | uint8_t quant_table_count; | 93 | uint8_t quant_table_count; |
| 93 | uint8_t version; | 94 | uint8_t version; |
| @@ -120,6 +121,7 @@ static void add_push_data(FFVulkanShader *shd) · 26 unmodified lines | |||
| 120 | GLSLC(1, uint32_t crcref; ); | 121 | GLSLC(1, uint32_t crcref; ); |
| 121 | GLSLC(1, int rct_offset; ); | 122 | GLSLC(1, int rct_offset; ); |
| 122 | GLSLC(0, ); | 123 | GLSLC(0, ); |
| 124 | GLSLC(1, uint8_t extend_lookup[8]; ); | ||
| 123 | GLSLC(1, uint8_t bits_per_raw_sample; ); | 125 | GLSLC(1, uint8_t bits_per_raw_sample; ); |
| 124 | GLSLC(1, uint8_t quant_table_count; ); | 126 | GLSLC(1, uint8_t quant_table_count; ); |
| 125 | GLSLC(1, uint8_t version; ); | 127 | GLSLC(1, uint8_t version; ); |
| @@ -456,6 +458,10 @@ static int vk_ffv1_end_frame(AVCodecContext *avctx) · 330 unmodified lines | |||
| 456 | .golomb = f->ac == AC_GOLOMB_RICE, | 458 | .golomb = f->ac == AC_GOLOMB_RICE, |
| 457 | .check_crc = !!(avctx->err_recognition & AV_EF_CRCCHECK), | 459 | .check_crc = !!(avctx->err_recognition & AV_EF_CRCCHECK), |
| 458 | }; | 460 | }; |
| 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 | |||
| 459 | 465 | ||
| 460 | /* For some reason the C FFv1 encoder/decoder treats these differently */ | 466 | /* For some reason the C FFv1 encoder/decoder treats these differently */ |
| 461 | if (sw_format == AV_PIX_FMT_GBRP10 || sw_format == AV_PIX_FMT_GBRP12 || | 467 | if (sw_format == AV_PIX_FMT_GBRP10 || sw_format == AV_PIX_FMT_GBRP12 || |