FFmpeg
Loading...
Searching...
No Matches
idctdsp.h
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVCODEC_IDCTDSP_H
20#define AVCODEC_IDCTDSP_H
21
22#include <stddef.h>
23#include <stdint.h>
24
25struct AVCodecContext;
26
35
36void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64],
37 const uint8_t permutation[64]);
38void ff_init_scantable_permutation(uint8_t *idct_permutation,
39 enum idct_permutation_type perm_type);
40int ff_init_scantable_permutation_x86(uint8_t *idct_permutation,
41 enum idct_permutation_type perm_type);
42
43typedef struct IDCTDSPContext {
44 /* pixel ops : interface with DCT */
45 void (*put_pixels_clamped)(const int16_t *block /* align 16 */,
46 uint8_t *restrict pixels /* align 8 */,
47 ptrdiff_t line_size);
48 void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */,
49 uint8_t *restrict pixels /* align 8 */,
50 ptrdiff_t line_size);
51 void (*add_pixels_clamped)(const int16_t *block /* align 16 */,
52 uint8_t *restrict pixels /* align 8 */,
53 ptrdiff_t line_size);
54
55 void (*idct)(int16_t *block /* align 16 */);
56
57 /**
58 * block -> idct -> clip to unsigned 8 bit -> dest.
59 * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
60 * @param line_size size in bytes of a horizontal line of dest
61 */
62 void (*idct_put)(uint8_t *dest /* align 8 */,
63 ptrdiff_t line_size, int16_t *block /* align 16 */);
64
65 /**
66 * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
67 * @param line_size size in bytes of a horizontal line of dest
68 */
69 void (*idct_add)(uint8_t *dest /* align 8 */,
70 ptrdiff_t line_size, int16_t *block /* align 16 */);
71
72 /**
73 * IDCT input permutation.
74 * Several optimized IDCTs need a permutated input (relative to the
75 * normal order of the reference IDCT).
76 * This permutation must be performed before the idct_put/add.
77 * Note, normally this can be merged with the zigzag/alternate scan<br>
78 * An example to avoid confusion:
79 * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
80 * - (x -> reference DCT -> reference IDCT -> x)
81 * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
82 * -> simple_idct_mmx -> x)
83 * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
84 * -> simple_idct_mmx -> ...)
85 */
86 uint8_t idct_permutation[64];
88
91
92void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
93 ptrdiff_t line_size);
94void ff_add_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
95 ptrdiff_t line_size);
96
98
100 unsigned high_bit_depth);
102 unsigned high_bit_depth);
104 unsigned high_bit_depth);
106 unsigned high_bit_depth);
108 unsigned high_bit_depth);
110 unsigned high_bit_depth);
112 unsigned high_bit_depth);
113
114#endif /* AVCODEC_IDCTDSP_H */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static int16_t block[64]
Definition dct.c:125
void ff_idctdsp_init_arm(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
void ff_idctdsp_init_loongarch(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
void ff_idctdsp_init_x86(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
void ff_init_scantable_permutation(uint8_t *idct_permutation, enum idct_permutation_type perm_type)
Definition idctdsp.c:39
void ff_idctdsp_init_riscv(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, enum idct_permutation_type perm_type)
idct_permutation_type
Definition idctdsp.h:27
@ FF_IDCT_PERM_SIMPLE
Definition idctdsp.h:30
@ FF_IDCT_PERM_LIBMPEG2
Definition idctdsp.h:29
@ FF_IDCT_PERM_NONE
Definition idctdsp.h:28
@ FF_IDCT_PERM_PARTTRANS
Definition idctdsp.h:32
@ FF_IDCT_PERM_TRANSPOSE
Definition idctdsp.h:31
@ FF_IDCT_PERM_SSE2
Definition idctdsp.h:33
void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], const uint8_t permutation[64])
Definition idctdsp.c:30
void ff_add_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size)
Definition idctdsp.c:147
void ff_idctdsp_init(IDCTDSPContext *c, struct AVCodecContext *avctx)
Definition idctdsp.c:228
void ff_idctdsp_init_aarch64(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
void ff_idctdsp_init_ppc(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
Definition idctdsp.c:256
void ff_idctdsp_init_mips(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth)
void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size)
Definition idctdsp.c:73
main external API structure.
Definition avcodec.h:443
void(* add_pixels_clamped)(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size)
Definition idctdsp.h:51
void(* put_pixels_clamped)(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size)
Definition idctdsp.h:45
void(* idct)(int16_t *block)
Definition idctdsp.h:55
void(* idct_add)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
Definition idctdsp.h:69
void(* idct_put)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
Definition idctdsp.h:62
enum idct_permutation_type perm_type
Definition idctdsp.h:87
void(* put_signed_pixels_clamped)(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size)
Definition idctdsp.h:48
int mpeg4_studio_profile
Definition idctdsp.h:89
uint8_t idct_permutation[64]
IDCT input permutation.
Definition idctdsp.h:86
#define src
Definition vp8dsp.c:248
static double c[64]