FFmpeg
crc.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 AVUTIL_AARCH64_CRC_H
20 #define AVUTIL_AARCH64_CRC_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include "config.h"
26 
27 #include "cpu.h"
29 #include "libavutil/avassert.h"
30 #include "libavutil/cpu.h"
31 #include "libavutil/crc.h"
32 
34 uint32_t ff_crc32_aarch64(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer,
35  size_t length);
37 
38 static inline uint32_t ff_crc_aarch64(const AVCRC *ctx, uint32_t crc,
39  const uint8_t *buffer, size_t length)
40 {
41 #if HAVE_ARM_CRC
42  av_assert2(ctx[0] == AV_CRC_32_IEEE_LE + 1);
43  return ff_crc32_aarch64(ctx, crc, buffer, length);
44 #else
45  av_unreachable("AARCH64 has only AV_CRC_32_IEEE_LE arch-specific CRC code");
46  return 0;
47 #endif
48 }
49 
50 static inline const AVCRC *ff_crc_get_table_aarch64(AVCRCId crc_id)
51 {
52 #if HAVE_ARM_CRC
53  static const AVCRC crc32_ieee_le_ctx[] = {
55  };
56 
57  if (crc_id != AV_CRC_32_IEEE_LE)
58  return NULL;
59 
61  if (have_arm_crc(cpu_flags)) {
62  return crc32_ieee_le_ctx;
63  }
64 #endif
65  return NULL;
66 }
67 
68 #endif /* AVUTIL_AARCH64_CRC_H */
FF_VISIBILITY_PUSH_HIDDEN
#define FF_VISIBILITY_PUSH_HIDDEN
Definition: attributes_internal.h:30
AVCRC
uint32_t AVCRC
Definition: crc.h:46
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:109
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:56
crc.h
avassert.h
attributes_internal.h
ctx
AVFormatContext * ctx
Definition: movenc.c:49
NULL
#define NULL
Definition: coverity.c:32
av_unreachable
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Definition: avassert.h:108
ff_crc_aarch64
static FF_VISIBILITY_POP_HIDDEN uint32_t ff_crc_aarch64(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Definition: crc.h:38
ff_crc32_aarch64
FF_VISIBILITY_PUSH_HIDDEN uint32_t ff_crc32_aarch64(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
cpu.h
FF_VISIBILITY_POP_HIDDEN
#define FF_VISIBILITY_POP_HIDDEN
Definition: attributes_internal.h:31
have_arm_crc
#define have_arm_crc(flags)
Definition: cpu.h:28
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:68
ff_crc_get_table_aarch64
static const AVCRC * ff_crc_get_table_aarch64(AVCRCId crc_id)
Definition: crc.h:50
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
AV_CRC_32_IEEE_LE
@ AV_CRC_32_IEEE_LE
Definition: crc.h:53
AVCRCId
AVCRCId
Definition: crc.h:48
cpu.h