1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avfilter/internal: Move ff_norm_qscale() to qp_table.h

It is the natural header for it.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-02 00:24:54 +02:00
parent b75dc8bd70
commit 2b6e008577
2 changed files with 17 additions and 16 deletions

View File

@ -341,22 +341,6 @@ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter
*/
int ff_filter_graph_run_once(AVFilterGraph *graph);
/**
* Normalize the qscale factor
* FIXME the H264 qscale is a log based scale, mpeg1/2 is not, the code below
* cannot be optimal
*/
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;
}
/**
* Get number of threads for current filter instance.
* This number is always same or less than graph->nb_threads.

View File

@ -22,6 +22,7 @@
#include <stdint.h>
#include "libavutil/frame.h"
#include "libavcodec/internal.h"
/**
* Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16
@ -30,4 +31,20 @@
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
int *qscale_type);
/**
* Normalize the qscale factor
* FIXME the H264 qscale is a log based scale, mpeg1/2 is not, the code below
* cannot be optimal
*/
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_QP_TABLE_H