Commit a2aeac82 authored by michaelni's avatar michaelni

lossless mjpeg encoding (planar yuv & RGB) and somerelated bugfixes


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1968 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent ae554be0
......@@ -63,6 +63,7 @@ void avcodec_register_all(void)
register_avcodec(&wmv2_encoder);
#endif
register_avcodec(&mjpeg_encoder);
register_avcodec(&ljpeg_encoder);
register_avcodec(&huffyuv_encoder);
register_avcodec(&asv1_encoder);
register_avcodec(&ffv1_encoder);
......
......@@ -31,6 +31,7 @@ enum CodecID {
CODEC_ID_AC3,
CODEC_ID_MJPEG,
CODEC_ID_MJPEGB,
CODEC_ID_LJPEG,
CODEC_ID_MPEG4,
CODEC_ID_RAWVIDEO,
CODEC_ID_MSMPEG4V1,
......@@ -98,7 +99,7 @@ enum PixelFormat {
PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
PIX_FMT_RGBA32, ///< always stored in cpu endianness
PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
PIX_FMT_RGB565, ///< always stored in cpu endianness
......@@ -1226,6 +1227,7 @@ extern AVCodec h263_encoder;
extern AVCodec h263p_encoder;
extern AVCodec rv10_encoder;
extern AVCodec mjpeg_encoder;
extern AVCodec ljpeg_encoder;
extern AVCodec mpeg4_encoder;
extern AVCodec msmpeg4v1_encoder;
extern AVCodec msmpeg4v2_encoder;
......
This diff is collapsed.
......@@ -528,8 +528,7 @@ int MPV_encode_init(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
int i;
avctx->pix_fmt = PIX_FMT_YUV420P;
int chroma_h_shift, chroma_v_shift;
s->bit_rate = avctx->bit_rate;
s->bit_rate_tolerance = avctx->bit_rate_tolerance;
......@@ -620,22 +619,25 @@ int MPV_encode_init(AVCodecContext *avctx)
s->intra_quant_bias= avctx->intra_quant_bias;
if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
s->inter_quant_bias= avctx->inter_quant_bias;
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift);
switch(avctx->codec->id) {
case CODEC_ID_MPEG1VIDEO:
s->out_format = FMT_MPEG1;
s->low_delay= 0; //s->max_b_frames ? 0 : 1;
avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
break;
case CODEC_ID_LJPEG:
case CODEC_ID_MJPEG:
s->out_format = FMT_MJPEG;
s->intra_only = 1; /* force intra only for jpeg */
s->mjpeg_write_tables = 1; /* write all tables */
s->mjpeg_data_only_frames = 0; /* write all the needed headers */
s->mjpeg_vsample[0] = 2; /* set up default sampling factors */
s->mjpeg_vsample[1] = 1; /* the only currently supported values */
s->mjpeg_vsample[0] = 1<<chroma_v_shift;
s->mjpeg_vsample[1] = 1;
s->mjpeg_vsample[2] = 1;
s->mjpeg_hsample[0] = 2;
s->mjpeg_hsample[0] = 1<<chroma_h_shift;
s->mjpeg_hsample[1] = 1;
s->mjpeg_hsample[2] = 1;
if (mjpeg_init(s) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment