Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
scalepixels.c File Reference
#include "develop/imageop_gui.h"
#include "widgets/bauhaus.h"
#include "common/module_versioning.h"
#include "system/target_clones.h"
#include "pixel/interpolation.h"
#include "develop/geometry/geometry.h"
#include "develop/imageop.h"
#include "develop/tiling.h"
#include "iop/iop_api.h"
#include <gtk/gtk.h>
#include <stdlib.h>
#include "widgets/label.h"
+ Include dependency graph for scalepixels.c:

Go to the source code of this file.

Data Structures

struct  dt_iop_scalepixels_params_t
 
struct  dt_iop_scalepixels_gui_data_t
 
struct  dt_iop_scalepixels_data_t
 
struct  dt_iop_scalepixels_geometry_t
 

Typedefs

typedef struct dt_iop_scalepixels_params_t dt_iop_scalepixels_params_t
 
typedef struct dt_iop_scalepixels_gui_data_t dt_iop_scalepixels_gui_data_t
 
typedef struct dt_iop_scalepixels_data_t dt_iop_scalepixels_data_t
 
typedef struct dt_iop_scalepixels_geometry_t dt_iop_scalepixels_geometry_t
 

Functions

const char * name ()
 
int flags ()
 
int default_group ()
 
int operation_tags ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
 
const char ** description (struct dt_iop_module_t *self)
 
static void transform (const dt_dev_pixelpipe_iop_t *const piece, float *p)
 
static void _scalepixels_scales (const float pixel_aspect_ratio, float *x_scale, float *y_scale)
 The axis scales this module applies, from its one parameter. THE constructor.
 
static void precalculate_scale (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
 
int distort_transform (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
 
int distort_backtransform (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
 
void distort_mask (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const float *const in, float *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
void modify_roi_out (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *const roi_in)
 
void modify_roi_in (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_out, dt_iop_roi_t *roi_in)
 
__DT_CLONE_TARGETS__ int process (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
 
void commit_params (dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
static void _scalepixels_geometry_map_size (const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out)
 
static int _scalepixels_geometry_transform (const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count)
 
static int _scalepixels_geometry_backtransform (const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count)
 
gboolean geometry_record (dt_iop_module_t *self, const void *params, dt_geometry_record_t *record)
 
void init_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void reload_defaults (dt_iop_module_t *self)
 
void gui_update (dt_iop_module_t *self)
 Refresh GUI controls from current params and configuration.
 
void gui_init (dt_iop_module_t *self)
 

Variables

static const dt_geometry_vtable_t _scalepixels_geometry_vtable
 

Typedef Documentation

◆ dt_iop_scalepixels_data_t

◆ dt_iop_scalepixels_geometry_t

◆ dt_iop_scalepixels_gui_data_t

◆ dt_iop_scalepixels_params_t

Function Documentation

◆ _scalepixels_geometry_backtransform()

static int _scalepixels_geometry_backtransform ( const void data,
const dt_geometry_record_t *const  record,
dt_geometry_chain_t chain,
float *  points,
size_t  points_count 
)
static

Definition at line 333 of file scalepixels.c.

References g, i, and dt_iop_scalepixels_geometry_t::x_scale.

◆ _scalepixels_geometry_map_size()

static void _scalepixels_geometry_map_size ( const void data,
const dt_iop_roi_t *const  in,
dt_iop_roi_t out 
)
static

◆ _scalepixels_geometry_transform()

static int _scalepixels_geometry_transform ( const void data,
const dt_geometry_record_t *const  record,
dt_geometry_chain_t chain,
float *  points,
size_t  points_count 
)
static

Definition at line 321 of file scalepixels.c.

References g, i, and dt_iop_scalepixels_geometry_t::x_scale.

◆ _scalepixels_scales()

static void _scalepixels_scales ( const float  pixel_aspect_ratio,
float *  x_scale,
float *  y_scale 
)
static

The axis scales this module applies, from its one parameter. THE constructor.

These used to be obtained by calling modify_roi_in() on a SHALLOW COPY of the piece with roi_out set to the full input size – a copy whose ‘data’ pointer still aliased the real one, so the callback's writes landed in the real piece. Working the algebra through shows the dimensions cancel and the result is a pure function of the pixel aspect ratio:

hw = { H, W } transformed -> par < 1 : { H, W/par }, par >= 1 : { H*par, W } reduction = max(hw[0]/H, hw[1]/W) -> par < 1 : 1/par, par >= 1 : par both divided by reduction -> par < 1 : { H*par, W }, par >= 1 : { H, W/par } x_scale = width/W, y_scale = height/H

so x_scale = 1, y_scale = par below one, and x_scale = 1/par, y_scale = 1 at or above it. Same numbers, no aliased copy, and one place that says what the scaling is – which is what the geometry record needs, having no piece to fake.

Definition at line 136 of file scalepixels.c.

Referenced by geometry_record(), and precalculate_scale().

◆ cleanup_pipe()

void cleanup_pipe ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

Definition at line 378 of file scalepixels.c.

References dt_dev_pixelpipe_iop_t::data, and dt_free_align.

◆ commit_params()

void commit_params ( dt_iop_module_t self,
dt_iop_params_t params,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

Definition at line 280 of file scalepixels.c.

References d, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::enabled, and p.

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)

Definition at line 92 of file scalepixels.c.

References IOP_CS_RGB.

◆ default_group()

int default_group ( )

Definition at line 82 of file scalepixels.c.

References IOP_GROUP_TECHNICAL.

◆ description()

const char ** description ( struct dt_iop_module_t self)

Definition at line 97 of file scalepixels.c.

References dt_iop_set_description().

◆ distort_backtransform()

int distort_backtransform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *  points,
size_t  points_count 
)

Definition at line 174 of file scalepixels.c.

References d, dt_dev_pixelpipe_iop_t::data, i, and precalculate_scale().

◆ distort_mask()

void distort_mask ( struct dt_iop_module_t self,
const struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece,
const float *const  in,
float *const  out,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out 
)
Todo:

Definition at line 189 of file scalepixels.c.

References dt_iop_roi_t::height, out, void(), and dt_iop_roi_t::width.

◆ distort_transform()

int distort_transform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *  points,
size_t  points_count 
)

Definition at line 159 of file scalepixels.c.

References d, dt_dev_pixelpipe_iop_t::data, i, and precalculate_scale().

◆ flags()

◆ geometry_record()

◆ gui_init()

void gui_init ( dt_iop_module_t self)

◆ gui_update()

void gui_update ( dt_iop_module_t self)

Refresh GUI controls from current params and configuration.

Todo:
check why needed
Todo:
by hand

Definition at line 401 of file scalepixels.c.

References dt_iop_module_t::default_enabled, dt_iop_module_t::gui, and dt_iop_module_gui_t::widget.

◆ init_pipe()

void init_pipe ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

◆ modify_roi_in()

◆ modify_roi_out()

void modify_roi_out ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece,
dt_iop_roi_t roi_out,
const dt_iop_roi_t *const  roi_in 
)

◆ name()

const char * name ( )

Definition at line 71 of file scalepixels.c.

◆ operation_tags()

int operation_tags ( )

Definition at line 87 of file scalepixels.c.

References IOP_TAG_DISTORT.

◆ precalculate_scale()

static void precalculate_scale ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)
static

Definition at line 150 of file scalepixels.c.

References _scalepixels_scales(), d, and dt_dev_pixelpipe_iop_t::data.

Referenced by distort_backtransform(), and distort_transform().

◆ process()

◆ reload_defaults()

◆ transform()

static void transform ( const dt_dev_pixelpipe_iop_t *const  piece,
float *  p 
)
static

Definition at line 105 of file scalepixels.c.

References d, dt_dev_pixelpipe_iop_t::data, and p.

Referenced by modify_roi_in(), and modify_roi_out().

Variable Documentation

◆ _scalepixels_geometry_vtable

const dt_geometry_vtable_t _scalepixels_geometry_vtable
static
Initial value:
= {
}
static int _scalepixels_geometry_backtransform(const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count)
static void _scalepixels_geometry_map_size(const void *data, const dt_iop_roi_t *const in, dt_iop_roi_t *out)
static int _scalepixels_geometry_transform(const void *data, const dt_geometry_record_t *const record, dt_geometry_chain_t *chain, float *points, size_t points_count)

Definition at line 346 of file scalepixels.c.

Referenced by geometry_record().