summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2004-11-28 18:29:38 +0000
committerLoren Merritt <lorenm@u.washington.edu>2004-11-28 18:29:38 +0000
commitf37b9768f64f859c67b8592eca618c5d82509025 (patch)
tree197ab0b87440b44e8d0f07590bc97b436687f3d6 /libavcodec
parent17179d2d970cae6d81074f8de204764072bcd791 (diff)
split ffhuffyuv into 2 codecs:
"huffyuv" is compatible with the official version "ffvhuff" contains our improvements Originally committed as revision 3720 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/allcodecs.c2
-rw-r--r--libavcodec/avcodec.h5
-rw-r--r--libavcodec/huffyuv.c60
3 files changed, 54 insertions, 13 deletions
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ce30182ae8..b202dcb092 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -83,6 +83,7 @@ void avcodec_register_all(void)
register_avcodec(&pbm_encoder);
register_avcodec(&pam_encoder);
register_avcodec(&huffyuv_encoder);
+ register_avcodec(&ffvhuff_encoder);
register_avcodec(&asv1_encoder);
register_avcodec(&asv2_encoder);
register_avcodec(&ffv1_encoder);
@@ -143,6 +144,7 @@ void avcodec_register_all(void)
register_avcodec(&mace3_decoder);
register_avcodec(&mace6_decoder);
register_avcodec(&huffyuv_decoder);
+ register_avcodec(&ffvhuff_decoder);
register_avcodec(&ffv1_decoder);
register_avcodec(&snow_decoder);
register_avcodec(&cyuv_decoder);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index a2c633bfea..bbc3cedf1f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -17,7 +17,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000409
#define FFMPEG_VERSION "0.4.9-pre1"
-#define LIBAVCODEC_BUILD 4733
+#define LIBAVCODEC_BUILD 4734
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION
@@ -99,6 +99,7 @@ enum CodecID {
CODEC_ID_PGM,
CODEC_ID_PGMYUV,
CODEC_ID_PAM,
+ CODEC_ID_FFVHUFF,
/* various pcm "codecs" */
CODEC_ID_PCM_S16LE= 0x10000,
@@ -1816,6 +1817,7 @@ extern AVCodec msmpeg4v3_encoder;
extern AVCodec wmv1_encoder;
extern AVCodec wmv2_encoder;
extern AVCodec huffyuv_encoder;
+extern AVCodec ffvhuff_encoder;
extern AVCodec h264_encoder;
extern AVCodec asv1_encoder;
extern AVCodec asv2_encoder;
@@ -1858,6 +1860,7 @@ extern AVCodec mp3_decoder;
extern AVCodec mace3_decoder;
extern AVCodec mace6_decoder;
extern AVCodec huffyuv_decoder;
+extern AVCodec ffvhuff_decoder;
extern AVCodec oggvorbis_decoder;
extern AVCodec cyuv_decoder;
extern AVCodec h264_decoder;
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 99925dde96..d529268ada 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -495,10 +495,6 @@ static int encode_init(AVCodecContext *avctx)
switch(avctx->pix_fmt){
case PIX_FMT_YUV420P:
- if(avctx->strict_std_compliance>=0){
- av_log(avctx, AV_LOG_ERROR, "Warning: YV12-huffyuv is not supported by windows huffyuv use a different colorspace or use (v)strict=-1\n");
- return -1;
- }
s->bitstream_bpp= 12;
break;
case PIX_FMT_YUV422P:
@@ -512,22 +508,30 @@ static int encode_init(AVCodecContext *avctx)
s->decorrelate= s->bitstream_bpp >= 24;
s->predictor= avctx->prediction_method;
s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0;
- if(s->interlaced != ( height > 288 )){
- av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n");
- }
if(avctx->context_model==1){
s->context= avctx->context_model;
- if(avctx->strict_std_compliance>=0){
- av_log(avctx, AV_LOG_ERROR, "Warning: per-frame huffman tables are not supported by windows huffyuv; use context=0 or use (v)strict=-1\n");
- return -1;
- }
if(s->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){
av_log(avctx, AV_LOG_ERROR, "context=1 is not compatible with 2 pass huffyuv encoding\n");
return -1;
}
- av_log(avctx, AV_LOG_INFO, "using per-frame huffman tables\n");
}else s->context= 0;
+ if(avctx->codec->id==CODEC_ID_HUFFYUV){
+ if(avctx->pix_fmt==PIX_FMT_YUV420P){
+ av_log(avctx, AV_LOG_ERROR, "Error: YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p\n");
+ return -1;
+ }
+ if(avctx->context_model){
+ av_log(avctx, AV_LOG_ERROR, "Error: per-frame huffman tables are not supported by huffyuv; use vcodec=ffvhuff\n");
+ return -1;
+ }
+ if(s->interlaced != ( 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 decodeable with future versions!!! Set vstrict=-1 to use it anyway.\n");
+ return -1;
+ }
+
((uint8_t*)avctx->extradata)[0]= s->predictor;
((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp;
((uint8_t*)avctx->extradata)[2]= 0x20 | (s->interlaced ? 0x10 : 0);
@@ -1172,6 +1176,14 @@ static const AVOption huffyuv_options[] =
AVOPTION_END()
};
+static const AVOption ffvhuff_options[] =
+{
+ AVOPTION_CODEC_INT("prediction_method", "prediction_method", prediction_method, 0, 2, 0),
+ AVOPTION_CODEC_INT("context_model", "context_model", context_model, 0, 2, 0),
+ AVOPTION_END()
+};
+
+
AVCodec huffyuv_decoder = {
"huffyuv",
CODEC_TYPE_VIDEO,
@@ -1185,6 +1197,19 @@ AVCodec huffyuv_decoder = {
NULL
};
+AVCodec ffvhuff_decoder = {
+ "ffvhuff",
+ CODEC_TYPE_VIDEO,
+ CODEC_ID_FFVHUFF,
+ sizeof(HYuvContext),
+ decode_init,
+ NULL,
+ decode_end,
+ decode_frame,
+ CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
+ NULL
+};
+
#ifdef CONFIG_ENCODERS
AVCodec huffyuv_encoder = {
@@ -1198,4 +1223,15 @@ AVCodec huffyuv_encoder = {
.options = huffyuv_options,
};
+AVCodec ffvhuff_encoder = {
+ "ffvhuff",
+ CODEC_TYPE_VIDEO,
+ CODEC_ID_FFVHUFF,
+ sizeof(HYuvContext),
+ encode_init,
+ encode_frame,
+ encode_end,
+ .options = ffvhuff_options,
+};
+
#endif //CONFIG_ENCODERS