You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/utvideodec: Move bitstream end check out of inner loop
This is not needed when the buffer is large enough for the worst case of a line 2% faster vlc reading Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -196,11 +196,6 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
|
|||||||
prev = 0x200;
|
prev = 0x200;
|
||||||
for (j = sstart; j < send; j++) {
|
for (j = sstart; j < send; j++) {
|
||||||
for (i = 0; i < width * step; i += step) {
|
for (i = 0; i < width * step; i += step) {
|
||||||
if (get_bits_left(&gb) <= 0) {
|
|
||||||
av_log(c->avctx, AV_LOG_ERROR,
|
|
||||||
"Slice decoding ran out of bits\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
|
pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
|
||||||
if (pix < 0) {
|
if (pix < 0) {
|
||||||
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
||||||
@@ -214,6 +209,11 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
|
|||||||
dest[i] = pix;
|
dest[i] = pix;
|
||||||
}
|
}
|
||||||
dest += stride;
|
dest += stride;
|
||||||
|
if (get_bits_left(&gb) < 0) {
|
||||||
|
av_log(c->avctx, AV_LOG_ERROR,
|
||||||
|
"Slice decoding ran out of bits\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (get_bits_left(&gb) > 32)
|
if (get_bits_left(&gb) > 32)
|
||||||
av_log(c->avctx, AV_LOG_WARNING,
|
av_log(c->avctx, AV_LOG_WARNING,
|
||||||
@@ -302,11 +302,6 @@ static int decode_plane(UtvideoContext *c, int plane_no,
|
|||||||
prev = 0x80;
|
prev = 0x80;
|
||||||
for (j = sstart; j < send; j++) {
|
for (j = sstart; j < send; j++) {
|
||||||
for (i = 0; i < width * step; i += step) {
|
for (i = 0; i < width * step; i += step) {
|
||||||
if (get_bits_left(&gb) <= 0) {
|
|
||||||
av_log(c->avctx, AV_LOG_ERROR,
|
|
||||||
"Slice decoding ran out of bits\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
|
pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
|
||||||
if (pix < 0) {
|
if (pix < 0) {
|
||||||
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
||||||
@@ -318,6 +313,11 @@ static int decode_plane(UtvideoContext *c, int plane_no,
|
|||||||
}
|
}
|
||||||
dest[i] = pix;
|
dest[i] = pix;
|
||||||
}
|
}
|
||||||
|
if (get_bits_left(&gb) < 0) {
|
||||||
|
av_log(c->avctx, AV_LOG_ERROR,
|
||||||
|
"Slice decoding ran out of bits\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
dest += stride;
|
dest += stride;
|
||||||
}
|
}
|
||||||
if (get_bits_left(&gb) > 32)
|
if (get_bits_left(&gb) > 32)
|
||||||
@@ -610,6 +610,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
|
|
||||||
c->frame_pred = (c->frame_info >> 8) & 3;
|
c->frame_pred = (c->frame_info >> 8) & 3;
|
||||||
|
|
||||||
|
max_slice_size += 4*avctx->width;
|
||||||
|
|
||||||
av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
|
av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
|
||||||
max_slice_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
max_slice_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user