Commit 0e5af493 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avcodec/huffyuv: Return proper error code

Also forward said error code in the encoder.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
parent cf96c029
......@@ -31,6 +31,7 @@
#include <stddef.h>
#include <stdint.h>
#include "libavutil/error.h"
#include "libavutil/log.h"
#include "libavutil/macros.h"
......@@ -48,7 +49,7 @@ int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int
for (int i = FF_ARRAY_ELEMS(lens) - 1; i > 0; i--) {
if ((lens[i] + codes[i]) & 1) {
av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
return -1;
return AVERROR_INVALIDDATA;
}
codes[i - 1] = (lens[i] + codes[i]) >> 1;
}
......
......@@ -232,9 +232,9 @@ static int store_huffman_tables(HYuvEncContext *s, uint8_t *buf)
if ((ret = ff_huff_gen_len_table(s->len[i], s->stats[i], s->vlc_n, 0)) < 0)
return ret;
if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n) < 0) {
return -1;
}
ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n);
if (ret < 0)
return ret;
size += store_table(s, s->len[i], buf + size);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment