Skip to content

Commit 8abfc32

Browse files
committed
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 <[email protected]>
1 parent e142153 commit 8abfc32

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

libavfilter/qp_table.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@
1818

1919
#include <stdint.h>
2020

21-
// for FF_QSCALE_TYPE_*
22-
#include "libavcodec/internal.h"
23-
2421
#include "libavutil/frame.h"
2522
#include "libavutil/mem.h"
2623
#include "libavutil/video_enc_params.h"
2724

2825
#include "qp_table.h"
2926

3027
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
31-
int *qscale_type)
28+
enum AVVideoEncParamsType *qscale_type)
3229
{
3330
AVFrameSideData *sd;
3431
AVVideoEncParams *par;
@@ -55,7 +52,7 @@ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table
5552
if (table_h)
5653
*table_h = mb_h;
5754
if (qscale_type)
58-
*qscale_type = FF_QSCALE_TYPE_MPEG2;
55+
*qscale_type = par->type;
5956

6057
if (par->nb_blocks == 0) {
6158
memset(*table, par->qp, nb_mb);

libavfilter/qp_table.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@
2222
#include <stdint.h>
2323

2424
#include "libavutil/frame.h"
25-
#include "libavcodec/internal.h"
25+
#include "libavutil/video_enc_params.h"
2626

2727
/**
2828
* Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16
2929
* macroblock, stored in raster order - from AVVideoEncParams side data.
3030
*/
3131
int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
32-
int *qscale_type);
32+
enum AVVideoEncParamsType *qscale_type);
3333

3434
/**
3535
* Normalize the qscale factor
36+
* FIXME Add support for other values of enum AVVideoEncParamsType
37+
* besides AV_VIDEO_ENC_PARAMS_MPEG2.
3638
*/
37-
static inline int ff_norm_qscale(int qscale, int type)
39+
static inline int ff_norm_qscale(int qscale, enum AVVideoEncParamsType type)
3840
{
3941
switch (type) {
40-
case FF_QSCALE_TYPE_MPEG1: return qscale;
41-
case FF_QSCALE_TYPE_MPEG2: return qscale >> 1;
42+
case AV_VIDEO_ENC_PARAMS_MPEG2: return qscale >> 1;
4243
}
4344
return qscale;
4445
}

libavfilter/vf_codecview.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
227227
AVFilterLink *outlink = ctx->outputs[0];
228228

229229
if (s->qp) {
230-
int qstride, qp_type, ret;
230+
enum AVVideoEncParamsType qp_type;
231+
int qstride, ret;
231232
int8_t *qp_table;
232233

233234
ret = ff_qp_table_extract(frame, &qp_table, &qstride, NULL, &qp_type);

libavfilter/vf_fspp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#ifndef AVFILTER_FSPP_H
2424
#define AVFILTER_FSPP_H
2525

26+
#include "libavutil/video_enc_params.h"
2627
#include "avfilter.h"
2728

2829
#define BLOCKSZ 12
@@ -61,7 +62,7 @@ typedef struct FSPPContext {
6162
int vsub;
6263
int temp_stride;
6364
int qp;
64-
int qscale_type;
65+
enum AVVideoEncParamsType qscale_type;
6566
int prev_q;
6667
uint8_t *src;
6768
int16_t *temp;

libavfilter/vf_pp7.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#ifndef AVFILTER_PP7_H
2323
#define AVFILTER_PP7_H
2424

25+
#include "libavutil/video_enc_params.h"
2526
#include "avfilter.h"
2627

2728
typedef struct PP7Context {
@@ -30,7 +31,7 @@ typedef struct PP7Context {
3031

3132
int qp;
3233
int mode;
33-
int qscale_type;
34+
enum AVVideoEncParamsType qscale_type;
3435
int hsub;
3536
int vsub;
3637
int temp_stride;

libavfilter/vf_spp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#ifndef AVFILTER_SPP_H
2323
#define AVFILTER_SPP_H
2424

25+
#include "libavutil/video_enc_params.h"
2526
#include "libavcodec/avdct.h"
2627
#include "avfilter.h"
2728

@@ -33,7 +34,7 @@ typedef struct SPPContext {
3334
int log2_count;
3435
int qp;
3536
int mode;
36-
int qscale_type;
37+
enum AVVideoEncParamsType qscale_type;
3738
int temp_linesize;
3839
uint8_t *src;
3940
uint16_t *temp;

libavfilter/vf_uspp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "libavutil/mem_internal.h"
3333
#include "libavutil/opt.h"
3434
#include "libavutil/pixdesc.h"
35+
#include "libavutil/video_enc_params.h"
3536
#include "libavcodec/avcodec.h"
3637
#include "internal.h"
3738
#include "qp_table.h"
@@ -45,7 +46,7 @@ typedef struct USPPContext {
4546
int log2_count;
4647
int hsub, vsub;
4748
int qp;
48-
int qscale_type;
49+
enum AVVideoEncParamsType qscale_type;
4950
int temp_stride[3];
5051
uint8_t *src[3];
5152
uint16_t *temp[3];

0 commit comments

Comments
 (0)