int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
{
- int len, nb_components, i, width, height, pix_fmt_id, ret;
+ int len, nb_components, i, width, height, bits, pix_fmt_id, ret;
int h_count[MAX_COMPONENTS];
int v_count[MAX_COMPONENTS];
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
s->avctx->bits_per_raw_sample =
- s->bits = get_bits(&s->gb, 8);
+ bits = get_bits(&s->gb, 8);
if (s->pegasus_rct)
- s->bits = 9;
- if (s->bits == 9 && !s->pegasus_rct)
+ bits = 9;
+ if (bits == 9 && !s->pegasus_rct)
s->rct = 1; // FIXME ugly
if(s->lossless && s->avctx->lowres){
return AVERROR_INVALIDDATA;
}
}
- if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
+ if (s->ls && !(bits <= 8 || nb_components == 1)) {
avpriv_report_missing_feature(s->avctx,
"JPEG-LS that is not <= 8 "
"bits/component or 16-bit gray");
/* if different size, realloc/alloc picture */
if ( width != s->width || height != s->height
+ || bits != s->bits
|| memcmp(s->h_count, h_count, sizeof(h_count))
|| memcmp(s->v_count, v_count, sizeof(v_count))) {
s->width = width;
s->height = height;
+ s->bits = bits;
memcpy(s->h_count, h_count, sizeof(h_count));
memcpy(s->v_count, v_count, sizeof(v_count));
s->interlaced = 0;
if (!(s->upscale_v & (1<<p)))
continue;
if (p==1 || p==2)
- w >>= hshift;
+ w = FF_CEIL_RSHIFT(w, hshift);
for (i = s->height - 1; i; i--) {
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[p])[i / 2 * s->linesize[p]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[p])[(i + 1) / 2 * s->linesize[p]];