diff mpegvideo.c @ 4621:5464e5021a67 libavcodec

dummy support for mpeg2 non linear quant
author bcoudurier
date Sun, 04 Mar 2007 02:26:20 +0000
parents c81aa982b72b
children f0ce30e115ac
line wrap: on
line diff
--- a/mpegvideo.c	Sat Mar 03 21:33:33 2007 +0000
+++ b/mpegvideo.c	Sun Mar 04 02:26:20 2007 +0000
@@ -1015,6 +1015,7 @@
     s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER);
     s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN);
     s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
+    s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);
 
     if(avctx->rc_max_rate && !avctx->rc_buffer_size){
         av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n");
@@ -1115,6 +1116,17 @@
         }
     }
 
+    if(s->q_scale_type == 1){
+        if(s->codec_id != CODEC_ID_MPEG2VIDEO){
+            av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n");
+            return -1;
+        }
+        if(avctx->qmax > 12){
+            av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n");
+            return -1;
+        }
+    }
+
     if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4
        && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO
        && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){