|
|
|
@ -414,7 +414,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) |
|
|
|
|
else |
|
|
|
|
goto unk_pixfmt; |
|
|
|
|
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; |
|
|
|
|
s->upscale_v = 2; |
|
|
|
|
s->upscale_v = 4; |
|
|
|
|
s->upscale_h = 2*(pix_fmt_id == 0x22122100); |
|
|
|
|
s->chroma_height = s->height; |
|
|
|
|
break; |
|
|
|
@ -424,7 +424,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) |
|
|
|
|
else |
|
|
|
|
goto unk_pixfmt; |
|
|
|
|
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; |
|
|
|
|
s->upscale_v = (pix_fmt_id == 0x22211200); |
|
|
|
|
s->upscale_v = 2*(pix_fmt_id == 0x22211200); |
|
|
|
|
s->upscale_h = 4; |
|
|
|
|
s->chroma_height = s->height; |
|
|
|
|
break; |
|
|
|
@ -433,7 +433,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) |
|
|
|
|
else |
|
|
|
|
goto unk_pixfmt; |
|
|
|
|
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; |
|
|
|
|
s->upscale_v = 2; |
|
|
|
|
s->upscale_v = 4; |
|
|
|
|
s->upscale_h = 4; |
|
|
|
|
s->chroma_height = s->height / 2; |
|
|
|
|
break; |
|
|
|
@ -472,7 +472,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) |
|
|
|
|
else |
|
|
|
|
goto unk_pixfmt; |
|
|
|
|
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; |
|
|
|
|
s->upscale_v = (pix_fmt_id == 0x22121100) + 1; |
|
|
|
|
s->upscale_v = 2 << (pix_fmt_id == 0x22121100); |
|
|
|
|
break; |
|
|
|
|
case 0x22111100: |
|
|
|
|
if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; |
|
|
|
@ -2052,24 +2052,29 @@ the_end: |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (s->upscale_v) { |
|
|
|
|
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]]; |
|
|
|
|
int w; |
|
|
|
|
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); |
|
|
|
|
w = s->width >> hshift; |
|
|
|
|
int p; |
|
|
|
|
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || |
|
|
|
|
avctx->pix_fmt == AV_PIX_FMT_YUV444P || |
|
|
|
|
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || |
|
|
|
|
avctx->pix_fmt == AV_PIX_FMT_YUV422P); |
|
|
|
|
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); |
|
|
|
|
for (p = 1; p < 4; p++) { |
|
|
|
|
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[p])[(s->height - 1) * s->linesize[p]]; |
|
|
|
|
int w; |
|
|
|
|
if (!(s->upscale_v & (1<<p))) |
|
|
|
|
continue; |
|
|
|
|
w = s->width >> hshift; |
|
|
|
|
for (i = s->height - 1; i; i--) { |
|
|
|
|
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]]; |
|
|
|
|
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]]; |
|
|
|
|
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]]; |
|
|
|
|
if (src1 == src2) { |
|
|
|
|
memcpy(dst, src1, w); |
|
|
|
|
} else { |
|
|
|
|
for (index = 0; index < w; index++) |
|
|
|
|
dst[index] = (src1[index] + src2[index]) >> 1; |
|
|
|
|
} |
|
|
|
|
dst -= s->linesize[s->upscale_v]; |
|
|
|
|
dst -= s->linesize[p]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (s->flipped) { |
|
|
|
|