FFmpeg
Loading...
Searching...
No Matches
vf_hqx.c File Reference

hqx magnification filters (hq2x, hq3x, hq4x) More...

#include "libavutil/opt.h"
#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  HQXContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define YMASK   0xff0000
 
#define UMASK   0x00ff00
 
#define VMASK   0x0000ff
 
#define ABSDIFF(a, b)
 
#define P(m, r)
 
#define DROP4(z)
 
#define SHF(x, rot, n)
 
#define WDIFF(c1, c2)
 
#define INTERP_BOOTSTRAP(rot)
 
#define HQX_FUNC(size)
 

Typedefs

typedef int(* hqxfunc_t) (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 

Functions

 AVFILTER_DEFINE_CLASS (hqx)
 
static av_always_inline uint32_t rgb2yuv (const uint32_t *r2y, uint32_t c)
 
static av_always_inline int yuv_diff (uint32_t yuv1, uint32_t yuv2)
 
static av_always_inline uint32_t interp_2px (uint32_t c1, int w1, uint32_t c2, int w2, int s)
 
static av_always_inline uint32_t interp_3px (uint32_t c1, int w1, uint32_t c2, int w2, uint32_t c3, int w3, int s)
 
static av_always_inline uint32_t hq2x_interp_1x1 (const uint32_t *r2y, int k, const uint32_t *w, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
 
static av_always_inline void hq3x_interp_2x1 (uint32_t *dst, int dst_linesize, const uint32_t *r2y, int k, const uint32_t *w, int pos00, int pos01, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int rotate)
 
static av_always_inline void hq4x_interp_2x2 (uint32_t *dst, int dst_linesize, const uint32_t *r2y, int k, const uint32_t *w, int pos00, int pos01, int pos10, int pos11, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
 
static av_always_inline void hqx_filter (const ThreadData *td, int jobnr, int nb_jobs, int n)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption hqx_options []
 
static const AVFilterPad hqx_inputs []
 
static const AVFilterPad hqx_outputs []
 
const FFFilter ff_vf_hqx
 

Detailed Description

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(HQXContext, x)

Definition at line 50 of file vf_hqx.c.

◆ FLAGS

Definition at line 51 of file vf_hqx.c.

◆ YMASK

#define YMASK   0xff0000

Referenced by pixel_diff(), and yuv_diff().

◆ UMASK

#define UMASK   0x00ff00

Referenced by pixel_diff(), and yuv_diff().

◆ VMASK

#define VMASK   0x0000ff

Referenced by pixel_diff(), and yuv_diff().

◆ ABSDIFF

#define ABSDIFF ( a,
b )
Value:
(abs((int)(a)-(int)(b)))
#define abs(x)
int a
#define b
Definition input.c:43

Referenced by yuv_diff().

◆ P

#define P ( m,
r )
Value:
((k_shuffled & (m)) == (r))
#define r
Definition input.c:42

Definition at line 93 of file vf_hqx.c.

Referenced by hq2x_interp_1x1(), hq3x_interp_2x1(), and hq4x_interp_2x2().

◆ DROP4

#define DROP4 ( z)
Value:
((z) > 4 ? (z)-1 : (z))

Definition at line 97 of file vf_hqx.c.

◆ SHF

#define SHF ( x,
rot,
n )
Value:
(((x) >> ((rot) ? 7-DROP4(n) : DROP4(n)) & 1) << DROP4(p##n))
#define DROP4(z)
Definition vf_hqx.c:97

Definition at line 100 of file vf_hqx.c.

◆ WDIFF

#define WDIFF ( c1,
c2 )
Value:
yuv_diff(rgb2yuv(r2y, c1), rgb2yuv(r2y, c2))
static void fn rgb2yuv(uint8_t *_yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t s, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8])
static const uint64_t c2
Definition murmur3.c:53
static const uint64_t c1
Definition murmur3.c:52
static av_always_inline int yuv_diff(uint32_t yuv1, uint32_t yuv2)
Definition vf_hqx.c:64

Definition at line 103 of file vf_hqx.c.

Referenced by hq2x_interp_1x1(), hq3x_interp_2x1(), and hq4x_interp_2x2().

◆ INTERP_BOOTSTRAP

#define INTERP_BOOTSTRAP ( rot)
Value:
const int k_shuffled = SHF(k,rot,0) | SHF(k,rot,1) | SHF(k,rot,2) \
| SHF(k,rot,3) | 0 | SHF(k,rot,5) \
| SHF(k,rot,6) | SHF(k,rot,7) | SHF(k,rot,8); \
\
const uint32_t w0 = w[p0], w1 = w[p1], \
w3 = w[p3], w4 = w[p4], w5 = w[p5], \
w7 = w[p7]
uint8_t w
Definition llvidencdsp.c:39
#define SHF(x, rot, n)
Definition vf_hqx.c:100

Definition at line 108 of file vf_hqx.c.

Referenced by hq2x_interp_1x1(), hq3x_interp_2x1(), and hq4x_interp_2x2().

◆ HQX_FUNC

#define HQX_FUNC ( size)
Value:
static int hq##size##x(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
{ \
hqx_filter(arg, jobnr, nb_jobs, size); \
return 0; \
}
static AVFormatContext * ctx
const char * arg
Definition jacosubdec.c:65
An instance of a filter.
Definition avfilter.h:273
int size

Definition at line 454 of file vf_hqx.c.

Typedef Documentation

◆ hqxfunc_t

typedef int(* hqxfunc_t) (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)

Definition at line 36 of file vf_hqx.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( hqx )

◆ rgb2yuv()

static av_always_inline uint32_t rgb2yuv ( const uint32_t * r2y,
uint32_t c )
static

Definition at line 59 of file vf_hqx.c.

Referenced by hqx_filter().

◆ yuv_diff()

static av_always_inline int yuv_diff ( uint32_t yuv1,
uint32_t yuv2 )
static

Definition at line 64 of file vf_hqx.c.

Referenced by hqx_filter().

◆ interp_2px()

static av_always_inline uint32_t interp_2px ( uint32_t c1,
int w1,
uint32_t c2,
int w2,
int s )
static

Definition at line 77 of file vf_hqx.c.

Referenced by hq2x_interp_1x1(), hq3x_interp_2x1(), and hq4x_interp_2x2().

◆ interp_3px()

static av_always_inline uint32_t interp_3px ( uint32_t c1,
int w1,
uint32_t c2,
int w2,
uint32_t c3,
int w3,
int s )
static

Definition at line 84 of file vf_hqx.c.

Referenced by hq2x_interp_1x1(), hq3x_interp_2x1(), and hq4x_interp_2x2().

◆ hq2x_interp_1x1()

static av_always_inline uint32_t hq2x_interp_1x1 ( const uint32_t * r2y,
int k,
const uint32_t * w,
int p0,
int p1,
int p2,
int p3,
int p4,
int p5,
int p6,
int p7,
int p8 )
static

Definition at line 120 of file vf_hqx.c.

Referenced by hqx_filter().

◆ hq3x_interp_2x1()

static av_always_inline void hq3x_interp_2x1 ( uint32_t * dst,
int dst_linesize,
const uint32_t * r2y,
int k,
const uint32_t * w,
int pos00,
int pos01,
int p0,
int p1,
int p2,
int p3,
int p4,
int p5,
int p6,
int p7,
int p8,
int rotate )
static

Definition at line 170 of file vf_hqx.c.

Referenced by hqx_filter().

◆ hq4x_interp_2x2()

static av_always_inline void hq4x_interp_2x2 ( uint32_t * dst,
int dst_linesize,
const uint32_t * r2y,
int k,
const uint32_t * w,
int pos00,
int pos01,
int pos10,
int pos11,
int p0,
int p1,
int p2,
int p3,
int p4,
int p5,
int p6,
int p7,
int p8 )
static

Definition at line 236 of file vf_hqx.c.

Referenced by hqx_filter().

◆ hqx_filter()

static av_always_inline void hqx_filter ( const ThreadData * td,
int jobnr,
int nb_jobs,
int n )
static

Definition at line 384 of file vf_hqx.c.

◆ config_output()

static int config_output ( AVFilterLink * outlink)
static

Definition at line 465 of file vf_hqx.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 479 of file vf_hqx.c.

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 504 of file vf_hqx.c.

Variable Documentation

◆ hqx_options

const AVOption hqx_options[]
static
Initial value:
= {
{ "n", "set scale factor", OFFSET(n), AV_OPT_TYPE_INT, {.i64 = 3}, 2, 4, .flags = FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 52 of file vf_hqx.c.

◆ hqx_inputs

const AVFilterPad hqx_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 531 of file vf_hqx.c.

◆ hqx_outputs

const AVFilterPad hqx_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}
static int config_output(AVBitStreamFilterLink *outlink)

Definition at line 539 of file vf_hqx.c.

◆ ff_vf_hqx

const FFFilter ff_vf_hqx
Initial value:
= {
.p.name = "hqx",
.p.description = NULL_IF_CONFIG_SMALL("Scale the input by 2, 3 or 4 using the hq*x magnification algorithm."),
.p.priv_class = &hqx_class,
.priv_size = sizeof(HQXContext),
.init = init,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define AV_PIX_FMT_RGB32
Definition pixfmt.h:517
static const AVFilterPad hqx_outputs[]
Definition vf_hqx.c:539
static const AVFilterPad hqx_inputs[]
Definition vf_hqx.c:531

Definition at line 547 of file vf_hqx.c.