FFmpeg
Macros | Functions | Variables
uops.c File Reference
#include <stdbool.h>
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/refstruct.h"
#include "ops.h"
#include "uops.h"
#include "uops_list.h"

Go to the source code of this file.

Macros

#define UOP_NAME(OP, ABBR)   [OP] = { ABBR },
 
#define Q2PIXEL(val)   pixel_from_q64(op->type, val)
 

Functions

int ff_sws_uop_cmp (const SwsUOp *a, const SwsUOp *b)
 Copyright (C) 2026 Niklas Haas. More...
 
static SwsPixel pixel_from_q64 (SwsPixelType type, AVRational64 val)
 
static bool pixel_is_1s (SwsPixelType type, SwsPixel val)
 
void ff_sws_uop_name (const SwsUOp *op, char buf[SWS_UOP_NAME_MAX])
 
static void uop_uninit (SwsUOp *uop)
 
void ff_sws_uop_list_free (SwsUOpList **p_ops)
 
SwsUOpListff_sws_uop_list_alloc (void)
 
int ff_sws_uop_list_append (SwsUOpList *uops, SwsUOp *uop)
 
int ff_sws_dither_height (const SwsDitherUOp *dither)
 Computes (1 << size_log2) + MAX(y_offset). More...
 
static SwsPixelType pixel_type_to_int (const SwsPixelType type)
 
static bool exact_product_f32 (float a, float b)
 
static bool exact_prod (SwsPixelType type, SwsPixel coef, const SwsComps *comps, int idx)
 
static bool check_filter_fma (SwsContext *ctx, SwsUOpFlags flags, const SwsOp *op)
 
static int translate_rw_op (SwsContext *ctx, SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op)
 
static int count_idx (const int *arr, size_t size, int val)
 
static int translate_move (SwsUOpList *ops, const SwsOp *op)
 
static int translate_swizzle (SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op)
 
static int translate_dither_op (SwsUOpList *ops, const SwsOp *op)
 
static int translate_linear_op (SwsContext *ctx, SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op, const SwsComps *input)
 
static bool is_expand_bit (SwsPixelType type, AVRational64 factor)
 
static int translate_op (SwsContext *ctx, SwsUOpList *uops, SwsUOpFlags flags, const SwsOp *op, const SwsComps *input)
 
int ff_sws_ops_translate (SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags, SwsUOpList *uops)
 Translate a list of operations down to micro-ops, which can be further optimized and then directly executed by backends. More...
 

Variables

struct {
   char   abbr [32]
 
uop_names [SWS_UOP_TYPE_NB]
 

Macro Definition Documentation

◆ UOP_NAME

#define UOP_NAME (   OP,
  ABBR 
)    [OP] = { ABBR },

◆ Q2PIXEL

#define Q2PIXEL (   val)    pixel_from_q64(op->type, val)

Definition at line 66 of file uops.c.

Function Documentation

◆ ff_sws_uop_cmp()

int ff_sws_uop_cmp ( const SwsUOp a,
const SwsUOp b 
)

Copyright (C) 2026 Niklas Haas.

Compare two SwsUOps for equality (excluding constant data).

This file is part of FFmpeg.

FFmpeg is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

FFmpeg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with FFmpeg; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Definition at line 31 of file uops.c.

Referenced by ff_sws_uop_cmp_v(), and ff_sws_uop_lookup().

◆ pixel_from_q64()

static SwsPixel pixel_from_q64 ( SwsPixelType  type,
AVRational64  val 
)
static

Definition at line 50 of file uops.c.

Referenced by exact_prod().

◆ pixel_is_1s()

static bool pixel_is_1s ( SwsPixelType  type,
SwsPixel  val 
)
static

Definition at line 68 of file uops.c.

Referenced by translate_op().

◆ ff_sws_uop_name()

void ff_sws_uop_name ( const SwsUOp op,
char  buf[SWS_UOP_NAME_MAX] 
)

◆ uop_uninit()

static void uop_uninit ( SwsUOp uop)
static

Definition at line 174 of file uops.c.

Referenced by ff_sws_uop_list_append(), and ff_sws_uop_list_free().

◆ ff_sws_uop_list_free()

void ff_sws_uop_list_free ( SwsUOpList **  p_ops)

Definition at line 190 of file uops.c.

Referenced by compile(), print_ops(), and register_flags().

◆ ff_sws_uop_list_alloc()

SwsUOpList* ff_sws_uop_list_alloc ( void  )

Definition at line 204 of file uops.c.

Referenced by compile(), print_ops(), and register_flags().

◆ ff_sws_uop_list_append()

int ff_sws_uop_list_append ( SwsUOpList uops,
SwsUOp uop 
)

◆ ff_sws_dither_height()

int ff_sws_dither_height ( const SwsDitherUOp dither)

Computes (1 << size_log2) + MAX(y_offset).

The dither matrix attached to the SwsUOp is always pre-padded to this number of lines.

Definition at line 222 of file uops.c.

Referenced by DECL_SETUP(), and translate_dither_op().

◆ pixel_type_to_int()

static SwsPixelType pixel_type_to_int ( const SwsPixelType  type)
static

Definition at line 230 of file uops.c.

Referenced by translate_move(), translate_op(), translate_rw_op(), and translate_swizzle().

◆ exact_product_f32()

static bool exact_product_f32 ( float  a,
float  b 
)
static

Definition at line 243 of file uops.c.

Referenced by exact_prod().

◆ exact_prod()

static bool exact_prod ( SwsPixelType  type,
SwsPixel  coef,
const SwsComps comps,
int  idx 
)
static

Definition at line 250 of file uops.c.

Referenced by translate_linear_op().

◆ check_filter_fma()

static bool check_filter_fma ( SwsContext ctx,
SwsUOpFlags  flags,
const SwsOp op 
)
static

Definition at line 272 of file uops.c.

Referenced by translate_rw_op().

◆ translate_rw_op()

static int translate_rw_op ( SwsContext ctx,
SwsUOpList ops,
SwsUOpFlags  flags,
const SwsOp op 
)
static

Definition at line 290 of file uops.c.

Referenced by translate_op().

◆ count_idx()

static int count_idx ( const int *  arr,
size_t  size,
int  val 
)
static

Definition at line 336 of file uops.c.

Referenced by translate_move().

◆ translate_move()

static int translate_move ( SwsUOpList ops,
const SwsOp op 
)
static

Definition at line 347 of file uops.c.

Referenced by translate_swizzle().

◆ translate_swizzle()

static int translate_swizzle ( SwsUOpList ops,
SwsUOpFlags  flags,
const SwsOp op 
)
static

Definition at line 418 of file uops.c.

Referenced by translate_op().

◆ translate_dither_op()

static int translate_dither_op ( SwsUOpList ops,
const SwsOp op 
)
static

Definition at line 476 of file uops.c.

Referenced by translate_op().

◆ translate_linear_op()

static int translate_linear_op ( SwsContext ctx,
SwsUOpList ops,
SwsUOpFlags  flags,
const SwsOp op,
const SwsComps input 
)
static

Definition at line 524 of file uops.c.

Referenced by translate_op().

◆ is_expand_bit()

static bool is_expand_bit ( SwsPixelType  type,
AVRational64  factor 
)
static

Definition at line 564 of file uops.c.

Referenced by translate_op().

◆ translate_op()

static int translate_op ( SwsContext ctx,
SwsUOpList uops,
SwsUOpFlags  flags,
const SwsOp op,
const SwsComps input 
)
static

Definition at line 582 of file uops.c.

Referenced by ff_sws_ops_translate().

◆ ff_sws_ops_translate()

int ff_sws_ops_translate ( SwsContext ctx,
const SwsOpList ops,
SwsUOpFlags  flags,
SwsUOpList uops 
)

Translate a list of operations down to micro-ops, which can be further optimized and then directly executed by backends.

Return 0 or a negative error code.

Definition at line 685 of file uops.c.

Referenced by compile(), print_ops(), and register_flags().

Variable Documentation

◆ abbr

char abbr[32]

Definition at line 43 of file uops.c.

Referenced by av_parse_video_rate(), and av_parse_video_size().

◆ uop_names

const { ... } uop_names[SWS_UOP_TYPE_NB]
Initial value:
= {
#define UOP_NAME(OP, ABBR)
}

Referenced by ff_sws_uop_name().