tinyimg 1.0.0
Lightweight image manipulation library for Cloudflare Workers
Loading...
Searching...
No Matches
TinyPlanResolution Struct Reference

What the planner decided, before any pixel is touched. More...

#include <plan.h>

Public Attributes

TinyDecodeOpts decode
uint32_t decode_width
uint32_t decode_height
double source_x
 The window of the decoded image the resample reads, in decoded pixels.
double source_y
double source_width
double source_height
uint32_t sample_width
uint32_t sample_height
TinyResampleFilter filter_x
TinyResampleFilter filter_y
int8_t orientation [4]
 The composed flip and quarter turn, as a signed permutation.
uint32_t width
uint32_t height
uint8_t channels
uint32_t offset_x
uint32_t offset_y
uint32_t ops
TinyPlanOp op [TINYIMG_PLAN_MAX_OPS]
uint32_t eliminated
uint32_t collapsed
uint32_t color_stages
uint32_t color_stages_before
 How many of those run on the source samples rather than the output ones.
uint32_t consumed
uint32_t passes
uint32_t kernels

Detailed Description

What the planner decided, before any pixel is touched.

Reported by tiny_plan_resolve so a caller can see the saving, and so a test can assert the decision rather than infer it from the output. The by-hand check in the plan prints decode and kernels from here.

Member Data Documentation

◆ channels

uint8_t TinyPlanResolution::channels

Channels of the final image.

◆ collapsed

uint32_t TinyPlanResolution::collapsed

Operations a pair rule merged into another.

◆ color_stages

uint32_t TinyPlanResolution::color_stages

Color stages the operations collapsed into.

◆ color_stages_before

uint32_t TinyPlanResolution::color_stages_before

How many of those run on the source samples rather than the output ones.

Which is decided by where the caller put them: a color operation written before a resize runs before the resample. Moving one to the output side would be cheaper on a reduction and is not the same image, because the clamp that follows an affine function does not survive being averaged.

◆ consumed

uint32_t TinyPlanResolution::consumed

Operations of op this pass consumes; the rest run after it.

◆ decode

TinyDecodeOpts TinyPlanResolution::decode

Region, scale and channel count the decoder is asked for.

◆ decode_height

uint32_t TinyPlanResolution::decode_height

Height the decode produces.

◆ decode_width

uint32_t TinyPlanResolution::decode_width

Width the decode produces.

◆ eliminated

uint32_t TinyPlanResolution::eliminated

Operations an identity or annihilation rule removed.

◆ filter_x

TinyResampleFilter TinyPlanResolution::filter_x

Filter chosen for the horizontal axis, never TINYIMG_FILTER_AUTO.

◆ filter_y

TinyResampleFilter TinyPlanResolution::filter_y

Filter chosen for the vertical axis.

◆ height

uint32_t TinyPlanResolution::height

Height of the final image.

◆ kernels

uint32_t TinyPlanResolution::kernels

A bitmask of TinyPlanKernel.

◆ offset_x

uint32_t TinyPlanResolution::offset_x

Where the oriented result sits in the final image.

◆ offset_y

uint32_t TinyPlanResolution::offset_y

Where the oriented result sits in the final image.

◆ op

TinyPlanOp TinyPlanResolution::op[TINYIMG_PLAN_MAX_OPS]

Those operations, which is what the rewrite tests assert on.

◆ ops

uint32_t TinyPlanResolution::ops

Operations left after the rewrites.

◆ orientation

int8_t TinyPlanResolution::orientation[4]

The composed flip and quarter turn, as a signed permutation.

Row major, mapping output coordinates to sample coordinates about each axis' center. Composition of any number of flips and turns is one matrix multiply, so the eight orientations cost one pass between them.

◆ passes

uint32_t TinyPlanResolution::passes

Fused passes tiny_plan_run will make.

◆ sample_height

uint32_t TinyPlanResolution::sample_height

Height the resample produces, before orientation.

◆ sample_width

uint32_t TinyPlanResolution::sample_width

Width the resample produces, before orientation.

◆ source_height

double TinyPlanResolution::source_height

Height of that window.

◆ source_width

double TinyPlanResolution::source_width

Width of that window.

◆ source_x

double TinyPlanResolution::source_x

The window of the decoded image the resample reads, in decoded pixels.

Fractional, and that is the point: a crop applied after a resize adjusts this window and the extent below, so the sample positions stay exactly where the uncropped resize would have put them. Deriving a fresh resize from the integer crop instead moves every sample by the fractional part.

◆ source_y

double TinyPlanResolution::source_y

Top edge of that window.

◆ width

uint32_t TinyPlanResolution::width

Width of the final image.


The documentation for this struct was generated from the following file: