summaryrefslogtreecommitdiff
path: root/libavcodec/huffyuv.c
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/huffyuv.c
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/huffyuv.c')
-rw-r--r--libavcodec/huffyuv.c60
1 files changed, 48 insertions, 12 deletions
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