#include "xface.h"
#include "avcodec.h"
#include "internal.h"
+#include "libavutil/avassert.h"
typedef struct XFaceContext {
AVClass *class;
}
typedef struct {
- const ProbRange *prob_ranges[XFACE_PIXELS*2];
+ ProbRange prob_ranges[XFACE_PIXELS*2];
int prob_ranges_idx;
} ProbRangesQueue;
{
if (pq->prob_ranges_idx >= XFACE_PIXELS * 2 - 1)
return -1;
- pq->prob_ranges[pq->prob_ranges_idx++] = p;
+ pq->prob_ranges[pq->prob_ranges_idx++] = *p;
return 0;
}
const AVFrame *frame, int *got_packet)
{
XFaceContext *xface = avctx->priv_data;
- ProbRangesQueue pq = {{ 0 }, 0};
+ ProbRangesQueue pq = {{{ 0 }}, 0};
uint8_t bitmap_copy[XFACE_PIXELS];
BigInt b = {0};
int i, j, k, ret = 0;
encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq);
while (pq.prob_ranges_idx > 0)
- push_integer(&b, pq.prob_ranges[--pq.prob_ranges_idx]);
+ push_integer(&b, &pq.prob_ranges[--pq.prob_ranges_idx]);
/* write the inverted big integer in b to intbuf */
i = 0;
+ av_assert0(b.nb_words < XFACE_MAX_WORDS);
while (b.nb_words) {
uint8_t r;
ff_big_div(&b, XFACE_PRINTS, &r);
+ av_assert0(i < sizeof(intbuf));
intbuf[i++] = r + XFACE_FIRST_PRINT;
}