FFmpeg
Loading...
Searching...
No Matches
swscale_lsx.c
Go to the documentation of this file.
1/*
2 * Loongson LSX optimized swscale
3 *
4 * Copyright (c) 2023 Loongson Technology Corporation Limited
5 * Contributed by Lu Wang <wanglu@loongson.cn>
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#include "swscale_loongarch.h"
25
26void ff_hscale_16_to_15_lsx(SwsInternal *c, int16_t *_dst, int dstW,
27 const uint8_t *_src, const int16_t *filter,
28 const int32_t *filterPos, int filterSize)
29{
30 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
31 int sh = desc->comp[0].depth - 1;
32
33 if (sh < 15) {
34 sh = isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8 ? 13 :
35 (desc->comp[0].depth - 1);
36 } else if (desc->flags && AV_PIX_FMT_FLAG_FLOAT) {
37 sh = 15;
38 }
39 ff_hscale_16_to_15_sub_lsx(c, _dst, dstW, _src, filter, filterPos, filterSize, sh);
40}
41
42void ff_hscale_16_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW,
43 const uint8_t *_src, const int16_t *filter,
44 const int32_t *filterPos, int filterSize)
45{
46 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.src_format);
47 int bits = desc->comp[0].depth - 1;
48 int sh = bits - 4;
49
50 if ((isAnyRGB(c->opts.src_format) || c->opts.src_format==AV_PIX_FMT_PAL8) && desc->comp[0].depth<16) {
51
52 sh = 9;
53 } else if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) { /* float input are process like uint 16bpc */
54 sh = 16 - 1 - 4;
55 }
56 ff_hscale_16_to_19_sub_lsx(c, _dst, dstW, _src, filter, filterPos, filterSize, sh);
57}
uint8_t * _dst
Definition dsp.h:56
uint8_t ptrdiff_t const uint8_t * _src
Definition dsp.h:56
int32_t
static const uint8_t bits[8]
Definition fastaudio.c:100
const char * desc
Definition libsvtav1.c:83
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition pixdesc.h:158
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
static av_always_inline int isAnyRGB(enum AVPixelFormat pix_fmt)
void ff_hscale_16_to_15_sub_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize, int sh)
void ff_hscale_16_to_19_sub_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize, int sh)
void ff_hscale_16_to_15_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition swscale_lsx.c:26
void ff_hscale_16_to_19_lsx(SwsInternal *c, int16_t *_dst, int dstW, const uint8_t *_src, const int16_t *filter, const int32_t *filterPos, int filterSize)
Definition swscale_lsx.c:42
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
static double c[64]