|
|
|
@ -400,6 +400,19 @@ static void jpeg_put_comments(MpegEncContext *s) |
|
|
|
|
ptr[0] = size >> 8; |
|
|
|
|
ptr[1] = size; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( s->avctx->pix_fmt == PIX_FMT_YUV420P
|
|
|
|
|
||s->avctx->pix_fmt == PIX_FMT_YUV422P |
|
|
|
|
||s->avctx->pix_fmt == PIX_FMT_YUV444P){ |
|
|
|
|
put_marker(p, COM); |
|
|
|
|
flush_put_bits(p); |
|
|
|
|
ptr = pbBufPtr(p); |
|
|
|
|
put_bits(p, 16, 0); /* patched later */ |
|
|
|
|
put_string(p, "CS=ITU601", 1); |
|
|
|
|
size = strlen("CS=ITU601")+3; |
|
|
|
|
ptr[0] = size >> 8; |
|
|
|
|
ptr[1] = size; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void mjpeg_picture_header(MpegEncContext *s) |
|
|
|
@ -845,6 +858,7 @@ typedef struct MJpegDecodeContext { |
|
|
|
|
int restart_count; |
|
|
|
|
|
|
|
|
|
int buggy_avid; |
|
|
|
|
int cs_itu601; |
|
|
|
|
int interlace_polarity; |
|
|
|
|
|
|
|
|
|
int mjpb_skiptosod; |
|
|
|
@ -1133,16 +1147,16 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) |
|
|
|
|
if(s->rgb){ |
|
|
|
|
s->avctx->pix_fmt = PIX_FMT_RGBA32; |
|
|
|
|
}else if(s->nb_components==3) |
|
|
|
|
s->avctx->pix_fmt = PIX_FMT_YUV444P; |
|
|
|
|
s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV444P : PIX_FMT_YUVJ444P; |
|
|
|
|
else |
|
|
|
|
s->avctx->pix_fmt = PIX_FMT_GRAY8; |
|
|
|
|
break; |
|
|
|
|
case 0x21: |
|
|
|
|
s->avctx->pix_fmt = PIX_FMT_YUV422P; |
|
|
|
|
s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
case 0x22: |
|
|
|
|
s->avctx->pix_fmt = PIX_FMT_YUV420P; |
|
|
|
|
s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420P; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1737,6 +1751,9 @@ static int mjpeg_decode_com(MJpegDecodeContext *s) |
|
|
|
|
// if (s->first_picture)
|
|
|
|
|
// printf("mjpeg: workarounding buggy AVID\n");
|
|
|
|
|
} |
|
|
|
|
else if(!strcmp(cbuf, "CS=ITU601")){ |
|
|
|
|
s->cs_itu601= 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
av_free(cbuf); |
|
|
|
|
} |
|
|
|
@ -2172,7 +2189,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx, |
|
|
|
|
s->v_max = 2; |
|
|
|
|
|
|
|
|
|
s->qscale_table = av_mallocz((s->width+15)/16); |
|
|
|
|
avctx->pix_fmt = PIX_FMT_YUV420P; |
|
|
|
|
avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420; |
|
|
|
|
s->interlaced = 0; |
|
|
|
|
|
|
|
|
|
s->picture.reference = 0; |
|
|
|
|