FFmpeg
mpegvideo_init.c
Go to the documentation of this file.
1 /*
2  * Copyright © 2022 Rémi Denis-Courmont.
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config.h"
22 
23 #include "libavutil/attributes.h"
24 #include "libavutil/cpu.h"
25 #include "libavcodec/mpegvideo.h"
27 
28 void ff_h263_dct_unquantize_intra_rvv(const MPVContext *s, int16_t *block,
29  ptrdiff_t len, int qscale, int aic);
30 void ff_h263_dct_unquantize_inter_rvv(const MPVContext *s, int16_t *block,
31  ptrdiff_t len, int qscale);
32 
33 static void dct_unquantize_h263_intra_rvv(const MPVContext *s,
34  int16_t *block, int n, int qscale)
35 {
36  if (!s->h263_aic)
37  block[0] *= (n < 4) ? s->y_dc_scale : s->c_dc_scale;
38 
39  n = s->ac_pred ? 63
40  : s->intra_scantable.raster_end[s->block_last_index[n]];
41  ff_h263_dct_unquantize_intra_rvv(s, block, n, qscale, s->h263_aic);
42 }
43 
44 static void dct_unquantize_h263_inter_rvv(const MPVContext *s,
45  int16_t *block, int n, int qscale)
46 {
47  n = s->inter_scantable.raster_end[s->block_last_index[n]];
49 }
50 
51 av_cold
53 {
54 #if HAVE_RVV
55  int flags = av_get_cpu_flags();
56 
58  c->dct_unquantize_h263_intra = dct_unquantize_h263_intra_rvv;
59  c->dct_unquantize_h263_inter = dct_unquantize_h263_inter_rvv;
60  }
61 #endif
62 }
flags
const SwsFlags flags[]
Definition: swscale.c:61
mpegvideo_unquantize.h
mpegvideo.h
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:109
AV_CPU_FLAG_RVB
#define AV_CPU_FLAG_RVB
B (bit manipulations)
Definition: cpu.h:105
ff_h263_dct_unquantize_inter_rvv
void ff_h263_dct_unquantize_inter_rvv(const MPVContext *s, int16_t *block, ptrdiff_t len, int qscale)
av_cold
#define av_cold
Definition: attributes.h:106
s
#define s(width, name)
Definition: cbs_vp9.c:198
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
cpu.h
attributes.h
AV_CPU_FLAG_RVV_I32
#define AV_CPU_FLAG_RVV_I32
Vectors of 8/16/32-bit int's *‍/.
Definition: cpu.h:95
len
int len
Definition: vorbis_enc_data.h:426
ff_mpv_unquantize_init_riscv
av_cold void ff_mpv_unquantize_init_riscv(MPVUnquantDSPContext *c, int bitexact)
Definition: mpegvideo_init.c:52
dct_unquantize_h263_inter_rvv
static void dct_unquantize_h263_inter_rvv(const MPVContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo_init.c:44
ff_h263_dct_unquantize_intra_rvv
void ff_h263_dct_unquantize_intra_rvv(const MPVContext *s, int16_t *block, ptrdiff_t len, int qscale, int aic)
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
MPVUnquantDSPContext
Definition: mpegvideo_unquantize.h:34
dct_unquantize_h263_intra_rvv
static void dct_unquantize_h263_intra_rvv(const MPVContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo_init.c:33