From 9cd81798187567c1495c595443923951c0c06926 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 8 May 2005 20:15:42 +0000 Subject: #defines for strict_std_compliance and split between inofficial extensions and non standarized things Originally committed as revision 4205 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 7 ++++++- libavcodec/ffv1.c | 4 ++-- libavcodec/g726.c | 2 +- libavcodec/h263.c | 4 ++-- libavcodec/huffyuv.c | 4 ++-- libavcodec/mpeg12.c | 4 ++-- libavcodec/mpegvideo.c | 4 ++-- libavcodec/snow.c | 4 ++-- tests/regression.sh | 8 ++++---- 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 83514e676d..bb84d158a3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -954,7 +954,12 @@ typedef struct AVCodecContext { * - decoding: unused */ int strict_std_compliance; - +#define FF_COMPLIANCE_VERY_STRICT 2 ///< strictly conform to a older more strict version of the spec or reference software +#define FF_COMPLIANCE_STRICT 1 ///< strictly conform to all the things in the spec no matter what consequences +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_INOFFICIAL -1 ///< allow inofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< allow non standarized experimental things + /** * qscale offset between ip and b frames. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 107eab1bcc..57ed9adb52 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -550,9 +550,9 @@ static int encode_init(AVCodecContext *avctx) FFV1Context *s = avctx->priv_data; int i; - if(avctx->strict_std_compliance >= 0){ + if(avctx->strict_std_compliance >FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it may not be decodeable with future versions!!!\n" - "use vstrict=-1 / -strict -1 to use it anyway\n"); + "use vstrict=-2 / -strict -2 to use it anyway\n"); return -1; } diff --git a/libavcodec/g726.c b/libavcodec/g726.c index bc9374d3e6..efc3c5faef 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -327,7 +327,7 @@ static int g726_init(AVCodecContext * avctx) av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n"); return -1; } - if (avctx->sample_rate != 8000 && avctx->strict_std_compliance>=0) { + if (avctx->sample_rate != 8000 && avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL) { av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n"); return -1; } diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 80a283bb56..0077d83b18 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -2408,9 +2408,9 @@ void mpeg4_encode_picture_header(MpegEncContext * s, int picture_number) if(s->pict_type==I_TYPE){ if(!(s->flags&CODEC_FLAG_GLOBAL_HEADER)){ - if(s->strict_std_compliance < 2) //HACK, the reference sw is buggy + if(s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) //HACK, the reference sw is buggy mpeg4_encode_visual_object_header(s); - if(s->strict_std_compliance < 2 || picture_number==0) //HACK, the reference sw is buggy + if(s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number==0) //HACK, the reference sw is buggy mpeg4_encode_vol_header(s, 0, 0); } if(!(s->workaround_bugs & FF_BUG_MS)) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index d2f3585754..ebb1340ac8 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -541,8 +541,8 @@ static int encode_init(AVCodecContext *avctx) } if(s->interlaced != ( s->height > 288 )) av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n"); - }else if(avctx->strict_std_compliance>=0){ - av_log(avctx, AV_LOG_ERROR, "This codec is under development; files encoded with it may not be decodable with future versions!!! Set vstrict=-1 / -strict -1 to use it anyway.\n"); + }else if(avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ + av_log(avctx, AV_LOG_ERROR, "This codec is under development; files encoded with it may not be decodable with future versions!!! Set vstrict=-2 / -strict -2 to use it anyway.\n"); return -1; } diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 47c7887424..ba77a915c9 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -203,7 +203,7 @@ static int find_frame_rate_index(MpegEncContext *s){ for(i=1;i<14;i++) { int64_t n0= 1001LL/frame_rate_tab[i].den*frame_rate_tab[i].num*s->avctx->time_base.num; int64_t n1= 1001LL*s->avctx->time_base.den; - if(s->avctx->strict_std_compliance >= 0 && i>=9) break; + if(s->avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL && i>=9) break; d = ABS(n0 - n1); if(d < dmin){ @@ -225,7 +225,7 @@ static int encode_init(AVCodecContext *avctx) return -1; if(find_frame_rate_index(s) < 0){ - if(s->strict_std_compliance >=0){ + if(s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->time_base.den, avctx->time_base.num); return -1; }else{ diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4aaee760cf..1426c221f9 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -898,12 +898,12 @@ int MPV_encode_init(AVCodecContext *avctx) } if(avctx->codec_id == CODEC_ID_MJPEG || avctx->codec_id == CODEC_ID_LJPEG){ - if(avctx->strict_std_compliance>=0 && avctx->pix_fmt != PIX_FMT_YUVJ420P){ + if(avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL && avctx->pix_fmt != PIX_FMT_YUVJ420P){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } }else{ - if(avctx->strict_std_compliance>=0 && avctx->pix_fmt != PIX_FMT_YUV420P){ + if(avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL && avctx->pix_fmt != PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported\n"); return -1; } diff --git a/libavcodec/snow.c b/libavcodec/snow.c index e34cbac0f3..596d15d3e5 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -3340,9 +3340,9 @@ static int encode_init(AVCodecContext *avctx) SnowContext *s = avctx->priv_data; int plane_index; - if(avctx->strict_std_compliance >= 0){ + if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it may not be decodable with future versions!!!\n" - "use vstrict=-1 / -strict -1 to use it anyway\n"); + "use vstrict=-2 / -strict -2 to use it anyway\n"); return -1; } diff --git a/tests/regression.sh b/tests/regression.sh index 5e478cd067..ded5442c5a 100755 --- a/tests/regression.sh +++ b/tests/regression.sh @@ -290,7 +290,7 @@ file=${outfile}huffyuv.avi do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file # huffyuv decoding -do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -1 -pix_fmt yuv420p $raw_dst +do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst fi ################################### @@ -437,7 +437,7 @@ fi if [ -n "$do_ffv1" ] ; then # ffv1 encoding file=${outfile}ffv1.avi -do_ffmpeg $file -y -strict -1 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file +do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file # ffv1 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst @@ -447,14 +447,14 @@ fi if [ -n "$do_snow" ] ; then # snow encoding file=${outfile}snow.avi -do_ffmpeg $file -y -strict -1 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 $file +do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 $file # snow decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst # snow encoding file=${outfile}snow53.avi -do_ffmpeg $file -y -strict -1 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -qpel -4mv $file +do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -qpel -4mv $file # snow decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst -- cgit v1.2.3