avfilter/qp_table: Stop using FF_QSCALE_TYPE_*
All FF_QSCALE_TYPE values used by libavfilter originate from libavfilter (namely from ff_qp_table_extract()); no value is exchanged between libavcodec and libavutil. The values that are exchanged (and used in libavfilter) are of type enum AVVideoEncParamsType. Therefore this patch stops using said FF_QSCALE_TYPE_* in libavfilter and uses enum AVVideoEncParamsType directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
e142153bd7
commit
8abfc327bd
@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// for FF_QSCALE_TYPE_*
|
|
||||||
#include "libavcodec/internal.h"
|
|
||||||
|
|
||||||
#include "libavutil/frame.h"
|
#include "libavutil/frame.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "libavutil/video_enc_params.h"
|
#include "libavutil/video_enc_params.h"
|
||||||
@ -28,7 +25,7 @@
|
|||||||
#include "qp_table.h"
|
#include "qp_table.h"
|
||||||
|
|
||||||
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
|
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
|
||||||
int *qscale_type)
|
enum AVVideoEncParamsType *qscale_type)
|
||||||
{
|
{
|
||||||
AVFrameSideData *sd;
|
AVFrameSideData *sd;
|
||||||
AVVideoEncParams *par;
|
AVVideoEncParams *par;
|
||||||
@ -55,7 +52,7 @@ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table
|
|||||||
if (table_h)
|
if (table_h)
|
||||||
*table_h = mb_h;
|
*table_h = mb_h;
|
||||||
if (qscale_type)
|
if (qscale_type)
|
||||||
*qscale_type = FF_QSCALE_TYPE_MPEG2;
|
*qscale_type = par->type;
|
||||||
|
|
||||||
if (par->nb_blocks == 0) {
|
if (par->nb_blocks == 0) {
|
||||||
memset(*table, par->qp, nb_mb);
|
memset(*table, par->qp, nb_mb);
|
||||||
|
@ -22,23 +22,24 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "libavutil/frame.h"
|
#include "libavutil/frame.h"
|
||||||
#include "libavcodec/internal.h"
|
#include "libavutil/video_enc_params.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16
|
* Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16
|
||||||
* macroblock, stored in raster order - from AVVideoEncParams side data.
|
* macroblock, stored in raster order - from AVVideoEncParams side data.
|
||||||
*/
|
*/
|
||||||
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
|
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
|
||||||
int *qscale_type);
|
enum AVVideoEncParamsType *qscale_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize the qscale factor
|
* Normalize the qscale factor
|
||||||
|
* FIXME Add support for other values of enum AVVideoEncParamsType
|
||||||
|
* besides AV_VIDEO_ENC_PARAMS_MPEG2.
|
||||||
*/
|
*/
|
||||||
static inline int ff_norm_qscale(int qscale, int type)
|
static inline int ff_norm_qscale(int qscale, enum AVVideoEncParamsType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FF_QSCALE_TYPE_MPEG1: return qscale;
|
case AV_VIDEO_ENC_PARAMS_MPEG2: return qscale >> 1;
|
||||||
case FF_QSCALE_TYPE_MPEG2: return qscale >> 1;
|
|
||||||
}
|
}
|
||||||
return qscale;
|
return qscale;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
|||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
|
|
||||||
if (s->qp) {
|
if (s->qp) {
|
||||||
int qstride, qp_type, ret;
|
enum AVVideoEncParamsType qp_type;
|
||||||
|
int qstride, ret;
|
||||||
int8_t *qp_table;
|
int8_t *qp_table;
|
||||||
|
|
||||||
ret = ff_qp_table_extract(frame, &qp_table, &qstride, NULL, &qp_type);
|
ret = ff_qp_table_extract(frame, &qp_table, &qstride, NULL, &qp_type);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#ifndef AVFILTER_FSPP_H
|
#ifndef AVFILTER_FSPP_H
|
||||||
#define AVFILTER_FSPP_H
|
#define AVFILTER_FSPP_H
|
||||||
|
|
||||||
|
#include "libavutil/video_enc_params.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
|
|
||||||
#define BLOCKSZ 12
|
#define BLOCKSZ 12
|
||||||
@ -61,7 +62,7 @@ typedef struct FSPPContext {
|
|||||||
int vsub;
|
int vsub;
|
||||||
int temp_stride;
|
int temp_stride;
|
||||||
int qp;
|
int qp;
|
||||||
int qscale_type;
|
enum AVVideoEncParamsType qscale_type;
|
||||||
int prev_q;
|
int prev_q;
|
||||||
uint8_t *src;
|
uint8_t *src;
|
||||||
int16_t *temp;
|
int16_t *temp;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#ifndef AVFILTER_PP7_H
|
#ifndef AVFILTER_PP7_H
|
||||||
#define AVFILTER_PP7_H
|
#define AVFILTER_PP7_H
|
||||||
|
|
||||||
|
#include "libavutil/video_enc_params.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
|
|
||||||
typedef struct PP7Context {
|
typedef struct PP7Context {
|
||||||
@ -30,7 +31,7 @@ typedef struct PP7Context {
|
|||||||
|
|
||||||
int qp;
|
int qp;
|
||||||
int mode;
|
int mode;
|
||||||
int qscale_type;
|
enum AVVideoEncParamsType qscale_type;
|
||||||
int hsub;
|
int hsub;
|
||||||
int vsub;
|
int vsub;
|
||||||
int temp_stride;
|
int temp_stride;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#ifndef AVFILTER_SPP_H
|
#ifndef AVFILTER_SPP_H
|
||||||
#define AVFILTER_SPP_H
|
#define AVFILTER_SPP_H
|
||||||
|
|
||||||
|
#include "libavutil/video_enc_params.h"
|
||||||
#include "libavcodec/avdct.h"
|
#include "libavcodec/avdct.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ typedef struct SPPContext {
|
|||||||
int log2_count;
|
int log2_count;
|
||||||
int qp;
|
int qp;
|
||||||
int mode;
|
int mode;
|
||||||
int qscale_type;
|
enum AVVideoEncParamsType qscale_type;
|
||||||
int temp_linesize;
|
int temp_linesize;
|
||||||
uint8_t *src;
|
uint8_t *src;
|
||||||
uint16_t *temp;
|
uint16_t *temp;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "libavutil/mem_internal.h"
|
#include "libavutil/mem_internal.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
|
#include "libavutil/video_enc_params.h"
|
||||||
#include "libavcodec/avcodec.h"
|
#include "libavcodec/avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "qp_table.h"
|
#include "qp_table.h"
|
||||||
@ -45,7 +46,7 @@ typedef struct USPPContext {
|
|||||||
int log2_count;
|
int log2_count;
|
||||||
int hsub, vsub;
|
int hsub, vsub;
|
||||||
int qp;
|
int qp;
|
||||||
int qscale_type;
|
enum AVVideoEncParamsType qscale_type;
|
||||||
int temp_stride[3];
|
int temp_stride[3];
|
||||||
uint8_t *src[3];
|
uint8_t *src[3];
|
||||||
uint16_t *temp[3];
|
uint16_t *temp[3];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user