History

avcodec/v210_dec: Move ff_v210dec_init into a header

This removes a dependency of checkasm on lavc/v210_dec.o and also allows to inline ff_v210dec_init() irrespectively of interposing.

Andreas Rheinhardt committed 4 years ago

Commit 0c2489f1 parent 11e37534 files · +63 −30Browse files

Showing the changes to libavcodec (3 of 4 files). Show all

Unified · Split

3 files
  1. libavcodec/v210dec.c +1 −28
  2. libavcodec/v210dec.h +0 −1
  3. libavcodec/v210dec_init.h +61 −0
libavcodec/v210dec.c+1−28
@@ -24,45 +24,18 @@ · 23 unmodified lines
2424 #include "avcodec.h"
2525 #include "codec_internal.h"
2626 #include "v210dec.h"
27+#include "v210dec_init.h"
2728 #include "libavutil/bswap.h"
2829 #include "libavutil/internal.h"
2930 #include "libavutil/intreadwrite.h"
3031 #include "thread.h"
3132
32−#define READ_PIXELS(a, b, c) \
33− do { \
34− val = av_le2ne32(*src++); \
35− *a++ = val & 0x3FF; \
36− *b++ = (val >> 10) & 0x3FF; \
37− *c++ = (val >> 20) & 0x3FF; \
38− } while (0)
39−
4033 typedef struct ThreadData {
4134 AVFrame *frame;
4235 uint8_t *buf;
4336 int stride;
4437 } ThreadData;
4538
46−static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width)
47−{
48− uint32_t val;
49− int i;
50−
51− for( i = 0; i < width-5; i += 6 ){
52− READ_PIXELS(u, y, v);
53− READ_PIXELS(y, u, y);
54− READ_PIXELS(v, y, u);
55− READ_PIXELS(y, v, y);
56− }
57−}
58−
59−av_cold void ff_v210dec_init(V210DecContext *s)
60−{
61− s->unpack_frame = v210_planar_unpack_c;
62− if (ARCH_X86)
63− ff_v210_x86_init(s);
64−}
65−
6639 static av_cold int decode_init(AVCodecContext *avctx)
6740 {
6841 V210DecContext *s = avctx->priv_data;
libavcodec/v210dec.h+0−1
@@ -32,7 +32,6 @@ typedef struct { · 31 unmodified lines
3232 void (*unpack_frame)(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width);
3333 } V210DecContext;
3434
35−void ff_v210dec_init(V210DecContext *s);
3635 void ff_v210_x86_init(V210DecContext *s);
3736
3837 #endif /* AVCODEC_V210DEC_H */
libavcodec/v210dec_init.h+61−0
@@ -0,0 +1,61 @@
1+/*
2+ * V210 decoder DSP init
3+ *
4+ * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
5+ * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
6+ *
7+ * This file is part of FFmpeg.
8+ *
9+ * FFmpeg is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU Lesser General Public
11+ * License as published by the Free Software Foundation; either
12+ * version 2.1 of the License, or (at your option) any later version.
13+ *
14+ * FFmpeg is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ * Lesser General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU Lesser General Public
20+ * License along with FFmpeg; if not, write to the Free Software
21+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22+ */
23+
24+#ifndef AVCODEC_V210DEC_INIT_H
25+#define AVCODEC_V210DEC_INIT_H
26+
27+#include <stdint.h>
28+
29+#include "config.h"
30+#include "libavutil/attributes.h"
31+#include "libavutil/bswap.h"
32+#include "v210dec.h"
33+
34+#define READ_PIXELS(a, b, c) \
35+ do { \
36+ val = av_le2ne32(*src++); \
37+ *a++ = val & 0x3FF; \
38+ *b++ = (val >> 10) & 0x3FF; \
39+ *c++ = (val >> 20) & 0x3FF; \
40+ } while (0)
41+
42+static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width)
43+{
44+ uint32_t val;
45+
46+ for (int i = 0; i < width - 5; i += 6) {
47+ READ_PIXELS(u, y, v);
48+ READ_PIXELS(y, u, y);
49+ READ_PIXELS(v, y, u);
50+ READ_PIXELS(y, v, y);
51+ }
52+}
53+
54+static av_unused av_cold void ff_v210dec_init(V210DecContext *s)
55+{
56+ s->unpack_frame = v210_planar_unpack_c;
57+ if (ARCH_X86)
58+ ff_v210_x86_init(s);
59+}
60+
61+#endif /* AVCODEC_V210DEC_INIT_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t