summaryrefslogtreecommitdiff
path: root/libavfilter/internal.h
diff options
context:
space:
mode:
authorArwa Arif <arwaarif1994@gmail.com>2015-01-10 01:43:42 +0530
committerMichael Niedermayer <michaelni@gmx.at>2015-01-10 02:22:02 +0100
commit4df01d5d44cf65c141e5569c9cb6c57a77c70e39 (patch)
treef3295e63789963015bcba9b41acb0c690700b049 /libavfilter/internal.h
parentaab74a38b8ba910a383dd82953061d5c42772ae9 (diff)
avfilter: Factorize the use of norm_qscale in pp7
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/internal.h')
-rw-r--r--libavfilter/internal.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 308b115b89..d3a859cfe4 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -31,6 +31,7 @@
#include "thread.h"
#include "version.h"
#include "video.h"
+#include "libavcodec/avcodec.h"
#define POOL_SIZE 32
typedef struct AVFilterPool {
@@ -374,4 +375,18 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name);
*/
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter);
+/**
+ * Normalize the qscale factor
+ */
+static inline int ff_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;
+ }
+ return qscale;
+}
+
#endif /* AVFILTER_INTERNAL_H */