This removes a dependency of checkasm on lavc/v210_dec.o and also allows to inline ff_v210dec_init() irrespectively of interposing.
Unified · Split
| @@ -24,45 +24,18 @@ · 23 unmodified lines | |||
| 24 | #include "avcodec.h" | 24 | #include "avcodec.h" |
| 25 | #include "codec_internal.h" | 25 | #include "codec_internal.h" |
| 26 | #include "v210dec.h" | 26 | #include "v210dec.h" |
| 27 | #include "v210dec_init.h" | ||
| 27 | #include "libavutil/bswap.h" | 28 | #include "libavutil/bswap.h" |
| 28 | #include "libavutil/internal.h" | 29 | #include "libavutil/internal.h" |
| 29 | #include "libavutil/intreadwrite.h" | 30 | #include "libavutil/intreadwrite.h" |
| 30 | #include "thread.h" | 31 | #include "thread.h" |
| 31 | 32 | ||
| 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 | |||
| 40 | typedef struct ThreadData { | 33 | typedef struct ThreadData { |
| 41 | AVFrame *frame; | 34 | AVFrame *frame; |
| 42 | uint8_t *buf; | 35 | uint8_t *buf; |
| 43 | int stride; | 36 | int stride; |
| 44 | } ThreadData; | 37 | } ThreadData; |
| 45 | 38 | ||
| 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 | |||
| 66 | static av_cold int decode_init(AVCodecContext *avctx) | 39 | static av_cold int decode_init(AVCodecContext *avctx) |
| 67 | { | 40 | { |
| 68 | V210DecContext *s = avctx->priv_data; | 41 | V210DecContext *s = avctx->priv_data; |
| @@ -32,7 +32,6 @@ typedef struct { · 31 unmodified lines | |||
| 32 | void (*unpack_frame)(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); | 32 | void (*unpack_frame)(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width); |
| 33 | } V210DecContext; | 33 | } V210DecContext; |
| 34 | 34 | ||
| 35 | void ff_v210dec_init(V210DecContext *s); | ||
| 36 | void ff_v210_x86_init(V210DecContext *s); | 35 | void ff_v210_x86_init(V210DecContext *s); |
| 37 | 36 | ||
| 38 | #endif /* AVCODEC_V210DEC_H */ | 37 | #endif /* AVCODEC_V210DEC_H */ |
| @@ -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 */ | ||
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | #include <string.h> | 21 | #include <string.h> |
| 22 | #include "checkasm.h" | 22 | #include "checkasm.h" |
| 23 | #include "libavcodec/v210dec.h" | 23 | #include "libavcodec/v210dec_init.h" |
| 24 | 24 | ||
| 25 | static uint32_t get_v210(void) | 25 | static uint32_t get_v210(void) |
| 26 | { | 26 | { |