@ -265,6 +265,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
}
break ;
case CODEC_ID_MJPEG :
case CODEC_ID_AMV :
if ( avctx - > pix_fmt ! = PIX_FMT_YUVJ420P & & avctx - > pix_fmt ! = PIX_FMT_YUVJ422P & &
( ( avctx - > pix_fmt ! = PIX_FMT_YUV420P & & avctx - > pix_fmt ! = PIX_FMT_YUV422P ) | | avctx - > strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL ) ) {
av_log ( avctx , AV_LOG_ERROR , " colorspace not supported in jpeg \n " ) ;
@ -530,6 +531,11 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
if ( s - > mpeg_quant | | s - > codec_id = = CODEC_ID_MPEG1VIDEO | | s - > codec_id = = CODEC_ID_MPEG2VIDEO | | s - > codec_id = = CODEC_ID_MJPEG ) {
s - > intra_quant_bias = 3 < < ( QUANT_BIAS_SHIFT - 3 ) ; //(a + x*3/8)/x
s - > inter_quant_bias = 0 ;
} else if ( s - > codec_id = = CODEC_ID_AMV ) {
s - > intra_quant_bias = 0 ;
s - > inter_quant_bias = 0 ;
s - > fixed_qscale = 1 ;
s - > adaptive_quant = 0 ;
} else {
s - > intra_quant_bias = 0 ;
s - > inter_quant_bias = - ( 1 < < ( QUANT_BIAS_SHIFT - 2 ) ) ; //(a - x/4)/x
@ -540,6 +546,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
if ( avctx - > inter_quant_bias ! = FF_DEFAULT_QUANT_BIAS )
s - > inter_quant_bias = avctx - > inter_quant_bias ;
av_log ( avctx , AV_LOG_DEBUG , " intra_quant_bias = %d inter_quant_bias = %d \n " , s - > intra_quant_bias , s - > inter_quant_bias ) ;
avcodec_get_chroma_sub_sample ( avctx - > pix_fmt , & chroma_h_shift , & chroma_v_shift ) ;
if ( avctx - > codec_id = = CODEC_ID_MPEG4 & & s - > avctx - > time_base . den > ( 1 < < 16 ) - 1 ) {
@ -564,6 +572,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
break ;
case CODEC_ID_LJPEG :
case CODEC_ID_MJPEG :
case CODEC_ID_AMV :
s - > out_format = FMT_MJPEG ;
s - > intra_only = 1 ; /* force intra only for jpeg */
if ( avctx - > codec - > id = = CODEC_ID_LJPEG & & avctx - > pix_fmt = = PIX_FMT_BGRA ) {
@ -1788,6 +1797,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x,
h263_encode_mb ( s , s - > block , motion_x , motion_y ) ;
break ;
case CODEC_ID_MJPEG :
case CODEC_ID_AMV :
if ( CONFIG_MJPEG_ENCODER )
ff_mjpeg_encode_mb ( s , s - > block ) ;
break ;