FFmpeg
Loading...
Searching...
No Matches
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)
 
#define Q2PIXEL(val)
 

Functions

int ff_sws_uop_cmp (const SwsUOp *a, const SwsUOp *b)
 Copyright (C) 2026 Niklas Haas.
 
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)
 
void ff_sws_uop_list_remove_at (SwsUOpList *uops, int index, int count)
 
int ff_sws_dither_height (const SwsDitherUOp *dither)
 Computes (1 << size_log2) + MAX(y_offset).
 
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_swizzle (SwsUOpList *ops, 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.
 

Variables

struct { 
 
   char   abbr [32] 
 
uop_names [SWS_UOP_TYPE_NB
 

Macro Definition Documentation

◆ UOP_NAME

#define UOP_NAME ( OP,
ABBR )
Value:
[OP] = { ABBR },
#define OP(gb, pixel, count)

◆ Q2PIXEL

#define Q2PIXEL ( val)
Value:
static double val(void *priv, double ch)
Definition aeval.c:77
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
Definition anm.c:76
static SwsPixel pixel_from_q64(SwsPixelType type, AVRational64 val)
Definition uops.c:50

Definition at line 66 of file uops.c.

Referenced by translate_dither_op(), translate_linear_op(), and translate_op().

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 170 of file uops.c.

Referenced by ff_sws_uop_list_append(), ff_sws_uop_list_free(), and ff_sws_uop_list_remove_at().

◆ ff_sws_uop_list_free()

void ff_sws_uop_list_free ( SwsUOpList ** p_ops)

Definition at line 189 of file uops.c.

Referenced by compile_c(), compile_x86(), print_ops(), and register_flags().

◆ ff_sws_uop_list_alloc()

SwsUOpList * ff_sws_uop_list_alloc ( void )

Definition at line 203 of file uops.c.

Referenced by compile_c(), compile_x86(), print_ops(), and register_flags().

◆ ff_sws_uop_list_append()

int ff_sws_uop_list_append ( SwsUOpList * uops,
SwsUOp * uop )

◆ ff_sws_uop_list_remove_at()

void ff_sws_uop_list_remove_at ( SwsUOpList * uops,
int index,
int count )

Definition at line 221 of file uops.c.

Referenced by ff_sws_uop_list_optimize().

◆ 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 232 of file uops.c.

Referenced by check_dither(), DECL_SETUP(), and translate_dither_op().

◆ pixel_type_to_int()

static SwsPixelType pixel_type_to_int ( const SwsPixelType type)
static

Definition at line 240 of file uops.c.

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

◆ exact_product_f32()

static bool exact_product_f32 ( float a,
float b )
static

Definition at line 253 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 260 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 282 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 300 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 353 of file uops.c.

Referenced by translate_swizzle().

◆ translate_swizzle()

static int translate_swizzle ( SwsUOpList * ops,
const SwsOp * op )
static

Definition at line 364 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 458 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 506 of file uops.c.

Referenced by translate_op().

◆ is_expand_bit()

static bool is_expand_bit ( SwsPixelType type,
AVRational64 factor )
static

Definition at line 550 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 568 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 677 of file uops.c.

Referenced by compile_c(), compile_x86(), 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().

◆ [struct]

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

Referenced by ff_sws_uop_name(), generate_entry_args(), generate_entry_struct(), and sws_uops_macros_gen().