1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

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:
Andreas Rheinhardt 2022-03-22 11:11:14 +01:00
parent e142153bd7
commit 8abfc327bd
7 changed files with 18 additions and 15 deletions

View File

@ -18,9 +18,6 @@
#include <stdint.h>
// for FF_QSCALE_TYPE_*
#include "libavcodec/internal.h"
#include "libavutil/frame.h"
#include "libavutil/mem.h"
#include "libavutil/video_enc_params.h"
@ -28,7 +25,7 @@
#include "qp_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;
AVVideoEncParams *par;
@ -55,7 +52,7 @@ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table
if (table_h)
*table_h = mb_h;
if (qscale_type)
*qscale_type = FF_QSCALE_TYPE_MPEG2;
*qscale_type = par->type;
if (par->nb_blocks == 0) {
memset(*table, par->qp, nb_mb);

View File

@ -22,23 +22,24 @@
#include <stdint.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
* 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 *qscale_type);
enum AVVideoEncParamsType *qscale_type);
/**
* 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) {
case FF_QSCALE_TYPE_MPEG1: return qscale;
case FF_QSCALE_TYPE_MPEG2: return qscale >> 1;
case AV_VIDEO_ENC_PARAMS_MPEG2: return qscale >> 1;
}
return qscale;
}

View File

@ -227,7 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVFilterLink *outlink = ctx->outputs[0];
if (s->qp) {
int qstride, qp_type, ret;
enum AVVideoEncParamsType qp_type;
int qstride, ret;
int8_t *qp_table;
ret = ff_qp_table_extract(frame, &qp_table, &qstride, NULL, &qp_type);

View File

@ -23,6 +23,7 @@
#ifndef AVFILTER_FSPP_H
#define AVFILTER_FSPP_H
#include "libavutil/video_enc_params.h"
#include "avfilter.h"
#define BLOCKSZ 12
@ -61,7 +62,7 @@ typedef struct FSPPContext {
int vsub;
int temp_stride;
int qp;
int qscale_type;
enum AVVideoEncParamsType qscale_type;
int prev_q;
uint8_t *src;
int16_t *temp;

View File

@ -22,6 +22,7 @@
#ifndef AVFILTER_PP7_H
#define AVFILTER_PP7_H
#include "libavutil/video_enc_params.h"
#include "avfilter.h"
typedef struct PP7Context {
@ -30,7 +31,7 @@ typedef struct PP7Context {
int qp;
int mode;
int qscale_type;
enum AVVideoEncParamsType qscale_type;
int hsub;
int vsub;
int temp_stride;

View File

@ -22,6 +22,7 @@
#ifndef AVFILTER_SPP_H
#define AVFILTER_SPP_H
#include "libavutil/video_enc_params.h"
#include "libavcodec/avdct.h"
#include "avfilter.h"
@ -33,7 +34,7 @@ typedef struct SPPContext {
int log2_count;
int qp;
int mode;
int qscale_type;
enum AVVideoEncParamsType qscale_type;
int temp_linesize;
uint8_t *src;
uint16_t *temp;

View File

@ -32,6 +32,7 @@
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/video_enc_params.h"
#include "libavcodec/avcodec.h"
#include "internal.h"
#include "qp_table.h"
@ -45,7 +46,7 @@ typedef struct USPPContext {
int log2_count;
int hsub, vsub;
int qp;
int qscale_type;
enum AVVideoEncParamsType qscale_type;
int temp_stride[3];
uint8_t *src[3];
uint16_t *temp[3];