[FFmpeg-devel] [PATCH] Add AV_QSCALE_TYPE_* and switch all code from FF_QSCALE_TYPE_ to them

Michael Niedermayer michaelni at gmx.at
Fri Nov 15 02:36:26 CET 2013


qscale_type is needed for the postprocessing filters
this commit thus moves all code away from the types that are sheduled
to be removed.
Alternatively we could keep the FF_ types or equivalent or
transfer the information differently of course

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/avcodec.h   |    4 ++++
 libavcodec/h263dec.c   |    4 ++--
 libavcodec/mjpegdec.c  |    2 +-
 libavcodec/mpeg12dec.c |    4 ++--
 libavcodec/rv10.c      |    4 ++--
 libavcodec/rv34.c      |    4 ++--
 libavfilter/vf_spp.c   |    8 ++++----
 7 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 67dc49f..23af06c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -915,6 +915,10 @@ typedef struct AVPanScan{
     int16_t position[3][2];
 }AVPanScan;
 
+#define AV_QSCALE_TYPE_MPEG1 0
+#define AV_QSCALE_TYPE_MPEG2 1
+#define AV_QSCALE_TYPE_H264  2
+#define AV_QSCALE_TYPE_VP56  3
 #if FF_API_QSCALE_TYPE
 #define FF_QSCALE_TYPE_MPEG1 0
 #define FF_QSCALE_TYPE_MPEG2 1
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index f8785d2..6eed905 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -789,12 +789,12 @@ frame_end:
         if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
             return ret;
         ff_print_debug_info(s, s->current_picture_ptr, pict);
-        ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
+        ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, AV_QSCALE_TYPE_MPEG1);
     } else if (s->last_picture_ptr != NULL) {
         if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
             return ret;
         ff_print_debug_info(s, s->last_picture_ptr, pict);
-        ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
+        ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, AV_QSCALE_TYPE_MPEG1);
     }
 
     if (s->last_picture_ptr || s->low_delay) {
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 063b8fa..06176f0 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1916,7 +1916,7 @@ eoi_parser:
                 AVBufferRef *qp_table_buf = av_buffer_alloc(qpw);
                 if (qp_table_buf) {
                     memset(qp_table_buf->data, qp, qpw);
-                    av_frame_set_qp_table(data, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1);
+                    av_frame_set_qp_table(data, qp_table_buf, 0, AV_QSCALE_TYPE_MPEG1);
                 }
 
                 if(avctx->debug & FF_DEBUG_QP)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 11cc5d2..916b000 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1957,7 +1957,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             if (ret < 0)
                 return ret;
             ff_print_debug_info(s, s->current_picture_ptr, pict);
-            ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG2);
+            ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, AV_QSCALE_TYPE_MPEG2);
         } else {
             if (avctx->active_thread_type & FF_THREAD_FRAME)
                 s->picture_number++;
@@ -1968,7 +1968,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 if (ret < 0)
                     return ret;
                 ff_print_debug_info(s, s->last_picture_ptr, pict);
-                ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG2);
+                ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, AV_QSCALE_TYPE_MPEG2);
             }
         }
 
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 120a6d9..e6cbe91 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -740,12 +740,12 @@ static int rv10_decode_frame(AVCodecContext *avctx,
             if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
                 return ret;
             ff_print_debug_info(s, s->current_picture_ptr, pict);
-            ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
+            ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, AV_QSCALE_TYPE_MPEG1);
         } else if (s->last_picture_ptr != NULL) {
             if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
                 return ret;
             ff_print_debug_info(s, s->last_picture_ptr, pict);
-            ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
+            ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, AV_QSCALE_TYPE_MPEG1);
         }
 
         if (s->last_picture_ptr || s->low_delay) {
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 4896b39..582f266 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1589,13 +1589,13 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict)
         if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
             return ret;
         ff_print_debug_info(s, s->current_picture_ptr, pict);
-        ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
+        ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, AV_QSCALE_TYPE_MPEG1);
         got_picture = 1;
     } else if (s->last_picture_ptr != NULL) {
         if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
             return ret;
         ff_print_debug_info(s, s->last_picture_ptr, pict);
-        ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
+        ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, AV_QSCALE_TYPE_MPEG1);
         got_picture = 1;
     }
 
diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 683e333..1543c50 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -184,10 +184,10 @@ static inline void add_block(int16_t *dst, int linesize, const int16_t block[64]
 static inline int norm_qscale(int qscale, int type)
 {
     switch (type) {
-    case FF_QSCALE_TYPE_MPEG1: return qscale;
-    case FF_QSCALE_TYPE_MPEG2: return qscale >> 1;
-    case FF_QSCALE_TYPE_H264:  return qscale >> 2;
-    case FF_QSCALE_TYPE_VP56:  return (63 - qscale + 2) >> 2;
+    case AV_QSCALE_TYPE_MPEG1: return qscale;
+    case AV_QSCALE_TYPE_MPEG2: return qscale >> 1;
+    case AV_QSCALE_TYPE_H264:  return qscale >> 2;
+    case AV_QSCALE_TYPE_VP56:  return (63 - qscale + 2) >> 2;
     }
     return qscale;
 }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list