FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_tonemap_opencl.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/bprint.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
#include "opencl.h"
#include "opencl_source.h"
#include "video.h"
#include "colorspace.h"

Go to the source code of this file.

Data Structures

struct  TonemapOpenCLContext
 

Macros

#define DETECTION_FRAMES   63
 
#define OPENCL_SOURCE_NB   3
 
#define OFFSET(x)   offsetof(TonemapOpenCLContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  TonemapAlgorithm {
  TONEMAP_NONE, TONEMAP_LINEAR, TONEMAP_GAMMA, TONEMAP_CLIP,
  TONEMAP_REINHARD, TONEMAP_HABLE, TONEMAP_MOBIUS, TONEMAP_MAX,
  TONEMAP_NONE, TONEMAP_LINEAR, TONEMAP_GAMMA, TONEMAP_CLIP,
  TONEMAP_REINHARD, TONEMAP_HABLE, TONEMAP_MOBIUS, TONEMAP_MAX
}
 

Functions

static void get_rgb2rgb_matrix (enum AVColorPrimaries in, enum AVColorPrimaries out, double rgb2rgb[3][3])
 
static int tonemap_opencl_init (AVFilterContext *avctx)
 
static int tonemap_opencl_config_output (AVFilterLink *outlink)
 
static int launch_kernel (AVFilterContext *avctx, cl_kernel kernel, AVFrame *output, AVFrame *input, float peak)
 
static int tonemap_opencl_filter_frame (AVFilterLink *inlink, AVFrame *input)
 
static av_cold void tonemap_opencl_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (tonemap_opencl)
 

Variables

static const char * yuv_coff [AVCOL_SPC_NB]
 
static const char * rgb_coff [AVCOL_SPC_NB]
 
static const char * linearize_funcs [AVCOL_TRC_NB]
 
static const char * delinearize_funcs [AVCOL_TRC_NB]
 
static const struct
LumaCoefficients 
luma_coefficients [AVCOL_SPC_NB]
 
static struct PrimaryCoefficients primaries_table [AVCOL_PRI_NB]
 
static struct
WhitepointCoefficients 
whitepoint_table [AVCOL_PRI_NB]
 
static const char * tonemap_func [TONEMAP_MAX]
 
static const float sdr_avg = 0.25f
 
static const AVOption tonemap_opencl_options []
 
static const AVFilterPad tonemap_opencl_inputs []
 
static const AVFilterPad tonemap_opencl_outputs []
 
AVFilter ff_vf_tonemap_opencl
 

Macro Definition Documentation

#define DETECTION_FRAMES   63

Definition at line 41 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_filter_frame(), and tonemap_opencl_init().

#define OPENCL_SOURCE_NB   3

Definition at line 131 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

#define OFFSET (   x)    offsetof(TonemapOpenCLContext, x)

Definition at line 491 of file vf_tonemap_opencl.c.

Definition at line 492 of file vf_tonemap_opencl.c.

Enumeration Type Documentation

Enumerator
TONEMAP_NONE 
TONEMAP_LINEAR 
TONEMAP_GAMMA 
TONEMAP_CLIP 
TONEMAP_REINHARD 
TONEMAP_HABLE 
TONEMAP_MOBIUS 
TONEMAP_MAX 
TONEMAP_NONE 
TONEMAP_LINEAR 
TONEMAP_GAMMA 
TONEMAP_CLIP 
TONEMAP_REINHARD 
TONEMAP_HABLE 
TONEMAP_MOBIUS 
TONEMAP_MAX 

Definition at line 43 of file vf_tonemap_opencl.c.

Function Documentation

static void get_rgb2rgb_matrix ( enum AVColorPrimaries  in,
enum AVColorPrimaries  out,
double  rgb2rgb[3][3] 
)
static

Definition at line 121 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

static int tonemap_opencl_init ( AVFilterContext avctx)
static

Definition at line 136 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_filter_frame().

static int tonemap_opencl_config_output ( AVFilterLink outlink)
static

Definition at line 288 of file vf_tonemap_opencl.c.

static int launch_kernel ( AVFilterContext avctx,
cl_kernel  kernel,
AVFrame output,
AVFrame input,
float  peak 
)
static

Definition at line 312 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_filter_frame().

static int tonemap_opencl_filter_frame ( AVFilterLink inlink,
AVFrame input 
)
static

Definition at line 344 of file vf_tonemap_opencl.c.

static av_cold void tonemap_opencl_uninit ( AVFilterContext avctx)
static

Definition at line 467 of file vf_tonemap_opencl.c.

AVFILTER_DEFINE_CLASS ( tonemap_opencl  )

Variable Documentation

const char* yuv_coff[AVCOL_SPC_NB]
static
Initial value:
= {
[AVCOL_SPC_BT709] = "rgb2yuv_bt709",
[AVCOL_SPC_BT2020_NCL] = "rgb2yuv_bt2020",
}
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:488
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:497

Definition at line 76 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

const char* rgb_coff[AVCOL_SPC_NB]
static
Initial value:
= {
[AVCOL_SPC_BT709] = "yuv2rgb_bt709",
[AVCOL_SPC_BT2020_NCL] = "yuv2rgb_bt2020",
}
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:488
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:497

Definition at line 81 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

const char* linearize_funcs[AVCOL_TRC_NB]
static
Initial value:
= {
[AVCOL_TRC_SMPTE2084] = "eotf_st2084",
[AVCOL_TRC_ARIB_STD_B67] = "inverse_oetf_hlg",
}
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:474
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:478

Definition at line 86 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

const char* delinearize_funcs[AVCOL_TRC_NB]
static
Initial value:
= {
[AVCOL_TRC_BT709] = "inverse_eotf_bt1886",
[AVCOL_TRC_BT2020_10] = "inverse_eotf_bt1886",
}
also ITU-R BT1361
Definition: pixfmt.h:459
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:472

Definition at line 91 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB]
static
Initial value:
= {
[AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 },
[AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 },
}
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:488
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:497

Definition at line 96 of file vf_tonemap_opencl.c.

struct PrimaryCoefficients primaries_table[AVCOL_PRI_NB]
static
Initial value:
= {
[AVCOL_PRI_BT709] = { 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 },
[AVCOL_PRI_BT2020] = { 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 },
}
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
Definition: pixfmt.h:435
ITU-R BT2020.
Definition: pixfmt.h:444

Definition at line 101 of file vf_tonemap_opencl.c.

struct WhitepointCoefficients whitepoint_table[AVCOL_PRI_NB]
static
Initial value:
= {
[AVCOL_PRI_BT709] = { 0.3127, 0.3290 },
[AVCOL_PRI_BT2020] = { 0.3127, 0.3290 },
}
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
Definition: pixfmt.h:435
ITU-R BT2020.
Definition: pixfmt.h:444

Definition at line 106 of file vf_tonemap_opencl.c.

const char* tonemap_func[TONEMAP_MAX]
static
Initial value:

Definition at line 111 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

const float sdr_avg = 0.25f
static

Definition at line 134 of file vf_tonemap_opencl.c.

Referenced by tonemap_opencl_init().

const AVOption tonemap_opencl_options[]
static

Definition at line 493 of file vf_tonemap_opencl.c.

const AVFilterPad tonemap_opencl_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = &tonemap_opencl_filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
int ff_opencl_filter_config_input(AVFilterLink *inlink)
Check that the input link contains a suitable hardware frames context and extract the device from it...
Definition: opencl.c:60
static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)

Definition at line 530 of file vf_tonemap_opencl.c.

const AVFilterPad tonemap_opencl_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = &tonemap_opencl_config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int tonemap_opencl_config_output(AVFilterLink *outlink)

Definition at line 540 of file vf_tonemap_opencl.c.

AVFilter ff_vf_tonemap_opencl
Initial value:
= {
.name = "tonemap_opencl",
.description = NULL_IF_CONFIG_SMALL("perform HDR to SDR conversion with tonemapping"),
.priv_size = sizeof(TonemapOpenCLContext),
.priv_class = &tonemap_opencl_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:385
int ff_opencl_filter_query_formats(AVFilterContext *avctx)
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
Definition: opencl.c:28
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition: opencl.c:147
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVFilterPad tonemap_opencl_inputs[]
static const AVFilterPad tonemap_opencl_outputs[]
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static av_cold void tonemap_opencl_uninit(AVFilterContext *avctx)
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244

Definition at line 549 of file vf_tonemap_opencl.c.