mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 07:47:32 +09:00
MoonchildProductions/UXP#2897: Fix ffvpx build on loongarch64
This commit is contained in:
parent
8dde509b85
commit
d7963fcc9e
18 changed files with 3559 additions and 23 deletions
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
* Contributed by Hao Chen <chenhao@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/loongarch/cpu.h"
|
||||
#include "libavcodec/h264pred.h"
|
||||
#include "h264_intrapred_loongarch.h"
|
||||
|
||||
av_cold void ff_h264_pred_init_loongarch(H264PredContext *h, int codec_id,
|
||||
const int bit_depth,
|
||||
const int chroma_format_idc)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (bit_depth == 8) {
|
||||
if (have_lsx(cpu_flags)) {
|
||||
if (chroma_format_idc <= 1) {
|
||||
}
|
||||
if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
|
||||
} else {
|
||||
if (chroma_format_idc <= 1) {
|
||||
}
|
||||
if (codec_id == AV_CODEC_ID_SVQ3) {
|
||||
h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_svq3_8_lsx;
|
||||
} else if (codec_id == AV_CODEC_ID_RV40) {
|
||||
h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_rv40_8_lsx;
|
||||
} else {
|
||||
h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_h264_8_lsx;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (have_lasx(cpu_flags)) {
|
||||
if (chroma_format_idc <= 1) {
|
||||
}
|
||||
if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
|
||||
} else {
|
||||
if (chroma_format_idc <= 1) {
|
||||
}
|
||||
if (codec_id == AV_CODEC_ID_SVQ3) {
|
||||
h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_svq3_8_lasx;
|
||||
} else if (codec_id == AV_CODEC_ID_RV40) {
|
||||
h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_rv40_8_lasx;
|
||||
} else {
|
||||
h->pred16x16[PLANE_PRED8x8] = ff_h264_pred16x16_plane_h264_8_lasx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
media/ffvpx/libavcodec/loongarch/h264_intrapred_loongarch.h
Normal file
35
media/ffvpx/libavcodec/loongarch/h264_intrapred_loongarch.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Loongson Technology Corporation Limited
|
||||
* Contributed by Hao Chen <chenhao@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_LOONGARCH_H264_INTRAPRED_LOONGARCH_H
|
||||
#define AVCODEC_LOONGARCH_H264_INTRAPRED_LOONGARCH_H
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
|
||||
void ff_h264_pred16x16_plane_h264_8_lsx(uint8_t *src, ptrdiff_t stride);
|
||||
void ff_h264_pred16x16_plane_rv40_8_lsx(uint8_t *src, ptrdiff_t stride);
|
||||
void ff_h264_pred16x16_plane_svq3_8_lsx(uint8_t *src, ptrdiff_t stride);
|
||||
|
||||
void ff_h264_pred16x16_plane_h264_8_lasx(uint8_t *src, ptrdiff_t stride);
|
||||
void ff_h264_pred16x16_plane_rv40_8_lasx(uint8_t *src, ptrdiff_t stride);
|
||||
void ff_h264_pred16x16_plane_svq3_8_lasx(uint8_t *src, ptrdiff_t stride);
|
||||
|
||||
#endif // #ifndef AVCODEC_LOONGARCH_H264_INTRAPRED_LOONGARCH_H
|
||||
15
media/ffvpx/libavcodec/loongarch/moz.build
Normal file
15
media/ffvpx/libavcodec/loongarch/moz.build
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
SOURCES += [
|
||||
'h264_intrapred_init_loongarch.c',
|
||||
'videodsp_init.c',
|
||||
'vp8dsp_init_loongarch.c',
|
||||
'vp9dsp_init_loongarch.c',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'mozavcodec'
|
||||
|
||||
include('/media/ffvpx/ffvpxcommon.mozbuild')
|
||||
45
media/ffvpx/libavcodec/loongarch/videodsp_init.c
Normal file
45
media/ffvpx/libavcodec/loongarch/videodsp_init.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
* Contributed by Xiwei Gu <guxiwei-hf@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavcodec/videodsp.h"
|
||||
#include "libavutil/attributes.h"
|
||||
|
||||
static void prefetch_loongarch(const uint8_t *mem, ptrdiff_t stride, int h)
|
||||
{
|
||||
register const uint8_t *p = mem;
|
||||
|
||||
__asm__ volatile (
|
||||
"1: \n\t"
|
||||
"preld 0, %[p], 0 \n\t"
|
||||
"preld 0, %[p], 32 \n\t"
|
||||
"addi.d %[h], %[h], -1 \n\t"
|
||||
"add.d %[p], %[p], %[stride] \n\t"
|
||||
|
||||
"blt $r0, %[h], 1b \n\t"
|
||||
: [p] "+r" (p), [h] "+r" (h)
|
||||
: [stride] "r" (stride)
|
||||
);
|
||||
}
|
||||
|
||||
av_cold void ff_videodsp_init_loongarch(VideoDSPContext *ctx, int bpc)
|
||||
{
|
||||
ctx->prefetch = prefetch_loongarch;
|
||||
}
|
||||
63
media/ffvpx/libavcodec/loongarch/vp8dsp_init_loongarch.c
Normal file
63
media/ffvpx/libavcodec/loongarch/vp8dsp_init_loongarch.c
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
* Contributed by Hecai Yuan <yuanhecai@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* VP8 compatible video decoder
|
||||
*/
|
||||
|
||||
#include "libavutil/loongarch/cpu.h"
|
||||
#include "libavcodec/vp8dsp.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "vp8dsp_loongarch.h"
|
||||
|
||||
#define VP8_MC_LOONGARCH_FUNC(IDX, SIZE) \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel##SIZE##_h6_lsx; \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel##SIZE##_v4_lsx; \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel##SIZE##_h6v4_lsx; \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel##SIZE##_v6_lsx; \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel##SIZE##_h4v6_lsx; \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel##SIZE##_h6v6_lsx;
|
||||
|
||||
#define VP8_MC_LOONGARCH_COPY(IDX, SIZE) \
|
||||
dsp->put_vp8_epel_pixels_tab[IDX][0][0] = ff_put_vp8_pixels##SIZE##_lsx; \
|
||||
dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = ff_put_vp8_pixels##SIZE##_lsx;
|
||||
|
||||
av_cold void ff_vp8dsp_init_loongarch(VP8DSPContext *dsp)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_lsx(cpu_flags)) {
|
||||
VP8_MC_LOONGARCH_FUNC(0, 16);
|
||||
VP8_MC_LOONGARCH_FUNC(1, 8);
|
||||
|
||||
VP8_MC_LOONGARCH_COPY(0, 16);
|
||||
VP8_MC_LOONGARCH_COPY(1, 8);
|
||||
|
||||
dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_lsx;
|
||||
dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_lsx;
|
||||
dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_lsx;
|
||||
dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_lsx;
|
||||
|
||||
dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_lsx;
|
||||
dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_lsx;
|
||||
}
|
||||
}
|
||||
90
media/ffvpx/libavcodec/loongarch/vp8dsp_loongarch.h
Normal file
90
media/ffvpx/libavcodec/loongarch/vp8dsp_loongarch.h
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
* Contributed by Hecai Yuan <yuanhecai@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_LOONGARCH_VP8DSP_LOONGARCH_H
|
||||
#define AVCODEC_LOONGARCH_VP8DSP_LOONGARCH_H
|
||||
|
||||
#include "libavcodec/vp8dsp.h"
|
||||
|
||||
void ff_put_vp8_pixels8_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int x, int y);
|
||||
void ff_put_vp8_pixels16_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int x, int y);
|
||||
|
||||
void ff_put_vp8_epel16_h6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel16_v4_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel16_v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel16_h6v4_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel16_h4v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel16_h6v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
|
||||
void ff_put_vp8_epel8_v4_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel8_v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel8_h6v4_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel8_h4v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
void ff_put_vp8_epel8_h6v6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
|
||||
void ff_put_vp8_epel8_h6_lsx(uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const uint8_t *src, ptrdiff_t src_stride,
|
||||
int h, int mx, int my);
|
||||
|
||||
/* loop filter */
|
||||
void ff_vp8_v_loop_filter16_inner_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
int32_t e, int32_t i, int32_t h);
|
||||
void ff_vp8_h_loop_filter16_inner_lsx(uint8_t *src, ptrdiff_t stride,
|
||||
int32_t e, int32_t i, int32_t h);
|
||||
|
||||
void ff_vp8_v_loop_filter16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
int flim_e, int flim_i, int hev_thresh);
|
||||
void ff_vp8_h_loop_filter16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
int flim_e, int flim_i, int hev_thresh);
|
||||
void ff_vp8_h_loop_filter8uv_lsx(uint8_t *dst_u, uint8_t *dst_v,
|
||||
ptrdiff_t stride,
|
||||
int flim_e, int flim_i, int hev_thresh);
|
||||
void ff_vp8_v_loop_filter8uv_lsx(uint8_t *dst_u, uint8_t *dst_v,
|
||||
ptrdiff_t stride,
|
||||
int flim_e, int flim_i, int hev_thresh);
|
||||
|
||||
#endif // #ifndef AVCODEC_LOONGARCH_VP8DSP_LOONGARCH_H
|
||||
130
media/ffvpx/libavcodec/loongarch/vp9dsp_init_loongarch.c
Normal file
130
media/ffvpx/libavcodec/loongarch/vp9dsp_init_loongarch.c
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
* Contributed by Hao Chen <chenhao@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/loongarch/cpu.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavcodec/vp9dsp.h"
|
||||
#include "vp9dsp_loongarch.h"
|
||||
|
||||
#define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type) \
|
||||
dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = \
|
||||
ff_##type##_8tap_smooth_##sz##dir##_lsx; \
|
||||
dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = \
|
||||
ff_##type##_8tap_regular_##sz##dir##_lsx; \
|
||||
dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = \
|
||||
ff_##type##_8tap_sharp_##sz##dir##_lsx;
|
||||
|
||||
#define init_subpel2(idx, idxh, idxv, dir, type) \
|
||||
init_subpel1(0, idx, idxh, idxv, 64, dir, type); \
|
||||
init_subpel1(1, idx, idxh, idxv, 32, dir, type); \
|
||||
init_subpel1(2, idx, idxh, idxv, 16, dir, type); \
|
||||
init_subpel1(3, idx, idxh, idxv, 8, dir, type); \
|
||||
init_subpel1(4, idx, idxh, idxv, 4, dir, type);
|
||||
|
||||
#define init_subpel3(idx, type) \
|
||||
init_subpel2(idx, 1, 0, h, type); \
|
||||
init_subpel2(idx, 0, 1, v, type); \
|
||||
init_subpel2(idx, 1, 1, hv, type);
|
||||
|
||||
#define init_fpel(idx1, idx2, sz, type) \
|
||||
dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = ff_##type##sz##_lsx; \
|
||||
dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = ff_##type##sz##_lsx; \
|
||||
dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = ff_##type##sz##_lsx; \
|
||||
dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_##type##sz##_lsx;
|
||||
|
||||
#define init_copy(idx, sz) \
|
||||
init_fpel(idx, 0, sz, copy); \
|
||||
init_fpel(idx, 1, sz, avg);
|
||||
|
||||
#define init_intra_pred1_lsx(tx, sz) \
|
||||
dsp->intra_pred[tx][VERT_PRED] = ff_vert_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][HOR_PRED] = ff_hor_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][DC_PRED] = ff_dc_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][LEFT_DC_PRED] = ff_dc_left_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][TOP_DC_PRED] = ff_dc_top_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][DC_128_PRED] = ff_dc_128_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][DC_127_PRED] = ff_dc_127_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][DC_129_PRED] = ff_dc_129_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][TM_VP8_PRED] = ff_tm_##sz##_lsx; \
|
||||
|
||||
#define init_intra_pred2_lsx(tx, sz) \
|
||||
dsp->intra_pred[tx][DC_PRED] = ff_dc_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][LEFT_DC_PRED] = ff_dc_left_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][TOP_DC_PRED] = ff_dc_top_##sz##_lsx; \
|
||||
dsp->intra_pred[tx][TM_VP8_PRED] = ff_tm_##sz##_lsx; \
|
||||
|
||||
#define init_idct(tx, nm) \
|
||||
dsp->itxfm_add[tx][DCT_DCT] = \
|
||||
dsp->itxfm_add[tx][ADST_DCT] = \
|
||||
dsp->itxfm_add[tx][DCT_ADST] = \
|
||||
dsp->itxfm_add[tx][ADST_ADST] = nm##_add_lsx;
|
||||
|
||||
#define init_itxfm(tx, sz) \
|
||||
dsp->itxfm_add[tx][DCT_DCT] = ff_idct_idct_##sz##_add_lsx;
|
||||
|
||||
av_cold void ff_vp9dsp_init_loongarch(VP9DSPContext *dsp, int bpp)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
if (have_lsx(cpu_flags))
|
||||
if (bpp == 8) {
|
||||
init_subpel3(0, put);
|
||||
init_subpel3(1, avg);
|
||||
init_copy(0, 64);
|
||||
init_copy(1, 32);
|
||||
init_copy(2, 16);
|
||||
init_copy(3, 8);
|
||||
init_intra_pred1_lsx(TX_16X16, 16x16);
|
||||
init_intra_pred1_lsx(TX_32X32, 32x32);
|
||||
init_intra_pred2_lsx(TX_4X4, 4x4);
|
||||
init_intra_pred2_lsx(TX_8X8, 8x8);
|
||||
init_itxfm(TX_8X8, 8x8);
|
||||
init_itxfm(TX_16X16, 16x16);
|
||||
init_idct(TX_32X32, ff_idct_idct_32x32);
|
||||
dsp->loop_filter_8[0][0] = ff_loop_filter_h_4_8_lsx;
|
||||
dsp->loop_filter_8[0][1] = ff_loop_filter_v_4_8_lsx;
|
||||
dsp->loop_filter_8[1][0] = ff_loop_filter_h_8_8_lsx;
|
||||
dsp->loop_filter_8[1][1] = ff_loop_filter_v_8_8_lsx;
|
||||
dsp->loop_filter_8[2][0] = ff_loop_filter_h_16_8_lsx;
|
||||
dsp->loop_filter_8[2][1] = ff_loop_filter_v_16_8_lsx;
|
||||
|
||||
dsp->loop_filter_16[0] = ff_loop_filter_h_16_16_lsx;
|
||||
dsp->loop_filter_16[1] = ff_loop_filter_v_16_16_lsx;
|
||||
|
||||
dsp->loop_filter_mix2[0][0][0] = ff_loop_filter_h_44_16_lsx;
|
||||
dsp->loop_filter_mix2[0][0][1] = ff_loop_filter_v_44_16_lsx;
|
||||
dsp->loop_filter_mix2[0][1][0] = ff_loop_filter_h_48_16_lsx;
|
||||
dsp->loop_filter_mix2[0][1][1] = ff_loop_filter_v_48_16_lsx;
|
||||
dsp->loop_filter_mix2[1][0][0] = ff_loop_filter_h_84_16_lsx;
|
||||
dsp->loop_filter_mix2[1][0][1] = ff_loop_filter_v_84_16_lsx;
|
||||
dsp->loop_filter_mix2[1][1][0] = ff_loop_filter_h_88_16_lsx;
|
||||
dsp->loop_filter_mix2[1][1][1] = ff_loop_filter_v_88_16_lsx;
|
||||
}
|
||||
}
|
||||
|
||||
#undef init_subpel1
|
||||
#undef init_subpel2
|
||||
#undef init_subpel3
|
||||
#undef init_copy
|
||||
#undef init_fpel
|
||||
#undef init_intra_pred1_lsx
|
||||
#undef init_intra_pred2_lsx
|
||||
#undef init_idct
|
||||
#undef init_itxfm
|
||||
185
media/ffvpx/libavcodec/loongarch/vp9dsp_loongarch.h
Normal file
185
media/ffvpx/libavcodec/loongarch/vp9dsp_loongarch.h
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
* Contributed by Hao Chen <chenhao@loongson.cn>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H
|
||||
#define AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define VP9_8TAP_LOONGARCH_LSX_FUNC(SIZE, type, type_idx) \
|
||||
void ff_put_8tap_##type##_##SIZE##h_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, \
|
||||
ptrdiff_t srcstride, \
|
||||
int h, int mx, int my); \
|
||||
\
|
||||
void ff_put_8tap_##type##_##SIZE##v_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, \
|
||||
ptrdiff_t srcstride, \
|
||||
int h, int mx, int my); \
|
||||
\
|
||||
void ff_put_8tap_##type##_##SIZE##hv_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, \
|
||||
ptrdiff_t srcstride, \
|
||||
int h, int mx, int my); \
|
||||
\
|
||||
void ff_avg_8tap_##type##_##SIZE##h_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, \
|
||||
ptrdiff_t srcstride, \
|
||||
int h, int mx, int my); \
|
||||
\
|
||||
void ff_avg_8tap_##type##_##SIZE##v_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, \
|
||||
ptrdiff_t srcstride, \
|
||||
int h, int mx, int my); \
|
||||
\
|
||||
void ff_avg_8tap_##type##_##SIZE##hv_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, \
|
||||
ptrdiff_t srcstride, \
|
||||
int h, int mx, int my);
|
||||
|
||||
#define VP9_COPY_LOONGARCH_LSX_FUNC(SIZE) \
|
||||
void ff_copy##SIZE##_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, ptrdiff_t srcstride, \
|
||||
int h, int mx, int my); \
|
||||
\
|
||||
void ff_avg##SIZE##_lsx(uint8_t *dst, ptrdiff_t dststride, \
|
||||
const uint8_t *src, ptrdiff_t srcstride, \
|
||||
int h, int mx, int my);
|
||||
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(64, regular, FILTER_8TAP_REGULAR);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(32, regular, FILTER_8TAP_REGULAR);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(16, regular, FILTER_8TAP_REGULAR);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(8, regular, FILTER_8TAP_REGULAR);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(4, regular, FILTER_8TAP_REGULAR);
|
||||
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(64, sharp, FILTER_8TAP_SHARP);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(32, sharp, FILTER_8TAP_SHARP);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(16, sharp, FILTER_8TAP_SHARP);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(8, sharp, FILTER_8TAP_SHARP);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(4, sharp, FILTER_8TAP_SHARP);
|
||||
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(64, smooth, FILTER_8TAP_SMOOTH);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(32, smooth, FILTER_8TAP_SMOOTH);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(16, smooth, FILTER_8TAP_SMOOTH);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(8, smooth, FILTER_8TAP_SMOOTH);
|
||||
VP9_8TAP_LOONGARCH_LSX_FUNC(4, smooth, FILTER_8TAP_SMOOTH);
|
||||
|
||||
VP9_COPY_LOONGARCH_LSX_FUNC(64);
|
||||
VP9_COPY_LOONGARCH_LSX_FUNC(32);
|
||||
VP9_COPY_LOONGARCH_LSX_FUNC(16);
|
||||
VP9_COPY_LOONGARCH_LSX_FUNC(8);
|
||||
|
||||
#undef VP9_8TAP_LOONGARCH_LSX_FUNC
|
||||
#undef VP9_COPY_LOONGARCH_LSX_FUNC
|
||||
|
||||
void ff_vert_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_vert_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_hor_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_hor_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_left_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_left_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_left_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_left_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_top_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_top_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_dc_top_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_top_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_128_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_128_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_127_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_127_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_129_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_dc_129_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *left, const uint8_t *top);
|
||||
void ff_tm_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_tm_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_tm_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_tm_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
|
||||
const uint8_t *top);
|
||||
void ff_loop_filter_h_16_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_16_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_4_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_4_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_44_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_44_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_8_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_8_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_88_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_88_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_84_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_84_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_48_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_48_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_h_16_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_loop_filter_v_16_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
|
||||
int32_t i, int32_t h);
|
||||
void ff_idct_idct_8x8_add_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
int16_t *block, int eob);
|
||||
void ff_idct_idct_16x16_add_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
int16_t *block, int eob);
|
||||
void ff_idct_idct_32x32_add_lsx(uint8_t *dst, ptrdiff_t stride,
|
||||
int16_t *block, int eob);
|
||||
|
||||
#endif /* AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue