Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-10 02:18:34 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-10 02:26:54 +0300
commitce6e7a2db1a4fc0c0294b23e3d62a492af0d0359 (patch)
tree8727285e507420837afbeeeec0c2c6031dd7f7cd /libavcodec/mjpegenc_huffman.c
parent3e1507a9547ac09b6ff4372123cde09f19218f3d (diff)
avcodec/mjpegenc: Simplify by moving assert into ff_mjpeg_encode_huffman_close()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mjpegenc_huffman.c')
-rw-r--r--libavcodec/mjpegenc_huffman.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/mjpegenc_huffman.c b/libavcodec/mjpegenc_huffman.c
index e1d300b77d..ebf1311466 100644
--- a/libavcodec/mjpegenc_huffman.c
+++ b/libavcodec/mjpegenc_huffman.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
+#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libavutil/qsort.h"
@@ -154,10 +155,9 @@ void ff_mjpeg_encode_huffman_init(MJpegEncHuffmanContext *s)
* @param bits output array where the ith character represents how many input values have i length encoding
* @param val output array of input values sorted by their encoded length
* @param max_nval maximum number of distinct input values
- * @return int Return code, 0 if succeeded.
*/
-int ff_mjpeg_encode_huffman_close(MJpegEncHuffmanContext *s, uint8_t bits[17],
- uint8_t val[], int max_nval)
+void ff_mjpeg_encode_huffman_close(MJpegEncHuffmanContext *s, uint8_t bits[17],
+ uint8_t val[], int max_nval)
{
int i, j;
int nval = 0;
@@ -167,9 +167,7 @@ int ff_mjpeg_encode_huffman_close(MJpegEncHuffmanContext *s, uint8_t bits[17],
for (i = 0; i < 256; i++) {
if (s->val_count[i]) nval++;
}
- if (nval > max_nval) {
- return AVERROR(EINVAL);
- }
+ av_assert0 (nval <= max_nval);
j = 0;
for (i = 0; i < 256; i++) {
@@ -189,6 +187,4 @@ int ff_mjpeg_encode_huffman_close(MJpegEncHuffmanContext *s, uint8_t bits[17],
val[i] = distincts[i].code;
bits[distincts[i].length]++;
}
-
- return 0;
}