Signed-off-by: Zhong Li
---
libavcodec/mjpegdec.c | 450 +-
1 file changed, 225 insertions(+), 225 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 1030861..a65bc8d 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -453,268 +453,268 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
avpriv_request_sample(s->avctx, "progressively coded interlaced
picture");
return AVERROR_INVALIDDATA;
}
-} else{
+} else {
if (s->v_max == 1 && s->h_max == 1 && s->lossless==1 &&
(nb_components==3 || nb_components==4))
s->rgb = 1;
else if (!s->lossless)
s->rgb = 0;
-/* XXX: not complete test ! */
-pix_fmt_id = ((unsigned)s->h_count[0] << 28) | (s->v_count[0] << 24) |
- (s->h_count[1] << 20) | (s->v_count[1] << 16) |
- (s->h_count[2] << 12) | (s->v_count[2] << 8) |
- (s->h_count[3] << 4) | s->v_count[3];
-av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id);
-/* NOTE we do not allocate pictures large enough for the possible
- * padding of h/v_count being 4 */
-if (!(pix_fmt_id & 0xD0D0D0D0))
-pix_fmt_id -= (pix_fmt_id & 0xF0F0F0F0) >> 1;
-if (!(pix_fmt_id & 0x0D0D0D0D))
-pix_fmt_id -= (pix_fmt_id & 0x0F0F0F0F) >> 1;
-
-for (i = 0; i < 8; i++) {
-int j = 6 + (i&1) - (i&6);
-int is = (pix_fmt_id >> (4*i)) & 0xF;
-int js = (pix_fmt_id >> (4*j)) & 0xF;
-
-if (is == 1 && js != 2 && (i < 2 || i > 5))
-js = (pix_fmt_id >> ( 8 + 4*(i&1))) & 0xF;
-if (is == 1 && js != 2 && (i < 2 || i > 5))
-js = (pix_fmt_id >> (16 + 4*(i&1))) & 0xF;
-
-if (is == 1 && js == 2) {
-if (i & 1) s->upscale_h[j/2] = 1;
-else s->upscale_v[j/2] = 1;
-}
-}
-
-switch (pix_fmt_id) {
-case 0x1100:
-if (s->rgb)
-s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_BGR24 :
AV_PIX_FMT_BGR48;
-else {
-if ( s->adobe_transform == 0
-|| s->component_id[0] == 'R' - 1 && s->component_id[1] == 'G'
- 1 && s->component_id[2] == 'B' - 1) {
-s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP :
AV_PIX_FMT_GBRP16;
-} else {
-if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ?
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
-else s->avctx->pix_fmt = AV_PIX_FMT_YUV444P16;
-s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG :
AVCOL_RANGE_JPEG;
+/* XXX: not complete test ! */
+pix_fmt_id = ((unsigned)s->h_count[0] << 28) | (s->v_count[0] << 24) |
+ (s->h_count[1] << 20) | (s->v_count[1] << 16) |
+ (s->h_count[2] << 12) | (s->v_count[2] << 8) |
+ (s->h_count[3] << 4) | s->v_count[3];
+av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id);
+/* NOTE we do not allocate pictures large enough for the possible
+ * padding of h/v_count being 4 */
+if (!(pix_fmt_id & 0xD0D0D0D0))
+pix_fmt_id -= (pix_fmt_id & 0xF0F0F0F0) >> 1;
+if (!(pix_fmt_id & 0x0D0D0D0D))
+pix_fmt_id -= (pix_fmt_id & 0x0F0F0F0F) >> 1;
+
+for (i = 0; i < 8; i++) {
+int j = 6 + (i&1) - (i&6);
+int is = (pix_fmt_id >> (4*i)) & 0xF;
+int js = (pix_fmt_id >> (4*j)) & 0xF;
+
+if (is == 1 && js != 2 && (i < 2 || i > 5))
+js = (pix_fmt_id >> ( 8 + 4*(i&1))) & 0xF;
+if (is == 1 && js != 2 && (i < 2 || i > 5))
+js = (pix_fmt_id >> (16 + 4*(i&1))) & 0xF;
+
+if (is == 1 && js == 2) {
+if (i & 1) s->upscale_h[j/2] = 1;
+else s->upscale_v[j/2] = 1;
}
}
-av_assert0(s->nb_components == 3);
-break;
-case 0x:
-if (s->rgb)
-s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_ABGR :
AV_PIX_FMT_RGBA64;
-else {
+
+switch (pix_fmt_id) {
+case 0x1100:
+if (s->rgb)
+s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_BGR24 :
AV_PIX_FMT_BGR48;
+else {
+if ( s->adobe_transform == 0
+|| s->component_id[0] == 'R' - 1 && s->component_id[1] ==
'G' - 1 && s->component_id[2] == 'B' - 1) {
+s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP :
AV_PIX_FMT_GBRP16;
+} else {
+if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ?
AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
+else s->avctx->pix_fmt = AV_PIX_FMT_YUV444P16;
+s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG :
AVCOL_RANGE_JPEG;
+}
+}
+