aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2024-11-20 05:11:49 +0100
committerLynne <dev@lynne.ee>2024-11-20 05:23:35 +0100
commit9691ac6af29ba558de9ff900eb769c2b29473581 (patch)
tree86b868fb3e049467d5874b314dc5273540a05653 /libavcodec
parentebf5264c93469890db5cea3543c3fe6fcae558f4 (diff)
downloadffmpeg-9691ac6af29ba558de9ff900eb769c2b29473581.tar.gz
ffv1enc_vulkan: increase max outstanding byte count to 16bit
The issue is that at higher resolutions, the outstanding byte counter overflowed in case the image had a lot of blank areas.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vulkan/rangecoder.comp16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/vulkan/rangecoder.comp b/libavcodec/vulkan/rangecoder.comp
index 13c135f913..848a056fb1 100644
--- a/libavcodec/vulkan/rangecoder.comp
+++ b/libavcodec/vulkan/rangecoder.comp
@@ -26,7 +26,7 @@ struct RangeCoder {
uint low;
uint16_t range;
- uint8_t outstanding_count;
+ uint16_t outstanding_count;
uint8_t outstanding_byte;
};
@@ -39,17 +39,17 @@ void renorm_encoder_full(inout RangeCoder c)
c.outstanding_byte = uint8_t(c.low >> 8);
} else if (c.low <= 0xFF00) {
c.bytestream[bs_cnt++].v = c.outstanding_byte;
- uint8_t cnt = c.outstanding_count;
+ uint16_t cnt = c.outstanding_count;
for (; cnt > 0; cnt--)
c.bytestream[bs_cnt++].v = uint8_t(0xFF);
- c.outstanding_count = uint8_t(0);
+ c.outstanding_count = uint16_t(0);
c.outstanding_byte = uint8_t(c.low >> 8);
} else if (c.low >= 0x10000) {
c.bytestream[bs_cnt++].v = c.outstanding_byte + uint8_t(1);
- uint8_t cnt = c.outstanding_count;
+ uint16_t cnt = c.outstanding_count;
for (; cnt > 0; cnt--)
c.bytestream[bs_cnt++].v = uint8_t(0x00);
- c.outstanding_count = uint8_t(0);
+ c.outstanding_count = uint16_t(0);
c.outstanding_byte = uint8_t(bitfieldExtract(c.low, 8, 8));
} else {
c.outstanding_count++;
@@ -63,7 +63,7 @@ void renorm_encoder_full(inout RangeCoder c)
/* Cannot deal with outstanding_byte == -1 in the name of speed */
void renorm_encoder(inout RangeCoder c)
{
- uint8_t oc = c.outstanding_count + uint8_t(1);
+ uint16_t oc = c.outstanding_count + uint16_t(1);
uint low = c.low;
c.range <<= 8;
@@ -78,7 +78,7 @@ void renorm_encoder(inout RangeCoder c)
uint8_t outstanding_byte = c.outstanding_byte;
c.bytestream = OFFBUF(u8buf, bs, oc);
- c.outstanding_count = uint8_t(0);
+ c.outstanding_count = uint16_t(0);
c.outstanding_byte = uint8_t(low >> 8);
uint8_t obs = uint8_t(low > 0xFF00);
@@ -185,6 +185,6 @@ void rac_init(out RangeCoder r, u8buf data, uint64_t buf_size)
r.bytestream = data;
r.low = 0;
r.range = uint16_t(0xFF00);
- r.outstanding_count = uint8_t(0);
+ r.outstanding_count = uint16_t(0);
r.outstanding_byte = uint8_t(0xFF);
}