* [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check
@ 2024-06-09 9:47 Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 2/7] avcodec/mpegvideo_enc: Make ff_dct_quantize_c() static Andreas Rheinhardt
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:47 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Always false since 49331f7ba3e3214738864af96d22fb1e6b5463b7.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/dnxhdenc.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 028604a6e5..8b67becbe2 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -430,9 +430,6 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
if (ctx->profile != AV_PROFILE_DNXHD)
ff_videodsp_init(&ctx->m.vdsp, ctx->bit_depth);
- if (!ctx->m.dct_quantize)
- ctx->m.dct_quantize = ff_dct_quantize_c;
-
if (ctx->is_444 || ctx->profile == AV_PROFILE_DNXHR_HQX) {
ctx->m.dct_quantize = dnxhd_10bit_dct_quantize_444;
ctx->get_pixels_8x4_sym = dnxhd_10bit_get_pixels_8x4_sym;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 2/7] avcodec/mpegvideo_enc: Make ff_dct_quantize_c() static
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
@ 2024-06-09 9:54 ` Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 3/7] avcodec/mpegvideo_enc: Move initializing H263DSP to ituh263enc.c Andreas Rheinhardt
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Only used here.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 13 ++++++++-----
libavcodec/mpegvideoenc.h | 1 -
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 82bab43e14..45b6fdd3f0 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -87,6 +87,9 @@ static int encode_picture(MpegEncContext *s);
static int dct_quantize_refine(MpegEncContext *s, int16_t *block, int16_t *weight, int16_t *orig, int n, int qscale);
static int sse_mb(MpegEncContext *s);
static void denoise_dct_c(MpegEncContext *s, int16_t *block);
+static int dct_quantize_c(MpegEncContext *s,
+ int16_t *block, int n,
+ int qscale, int *overflow);
static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
@@ -296,7 +299,7 @@ av_cold int ff_dct_encode_init(MpegEncContext *s)
if (CONFIG_H263_ENCODER)
ff_h263dsp_init(&s->h263dsp);
if (!s->dct_quantize)
- s->dct_quantize = ff_dct_quantize_c;
+ s->dct_quantize = dct_quantize_c;
if (!s->denoise_dct)
s->denoise_dct = denoise_dct_c;
s->fast_dct_quantize = s->dct_quantize;
@@ -2444,7 +2447,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
// non c quantize code returns incorrect block_last_index FIXME
- if (s->alternate_scan && s->dct_quantize != ff_dct_quantize_c) {
+ if (s->alternate_scan && s->dct_quantize != dct_quantize_c) {
for (i = 0; i < mb_block_count; i++) {
int j;
if (s->block_last_index[i] > 0) {
@@ -4566,9 +4569,9 @@ void ff_block_permute(int16_t *block, uint8_t *permutation,
}
}
-int ff_dct_quantize_c(MpegEncContext *s,
- int16_t *block, int n,
- int qscale, int *overflow)
+static int dct_quantize_c(MpegEncContext *s,
+ int16_t *block, int n,
+ int qscale, int *overflow)
{
int i, j, level, last_non_zero, q, start_i;
const int *qmat;
diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h
index c20ea500eb..169ed1dc3b 100644
--- a/libavcodec/mpegvideoenc.h
+++ b/libavcodec/mpegvideoenc.h
@@ -148,7 +148,6 @@ void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
int ff_dct_encode_init(MpegEncContext *s);
void ff_dct_encode_init_x86(MpegEncContext *s);
-int ff_dct_quantize_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64],
const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 3/7] avcodec/mpegvideo_enc: Move initializing H263DSP to ituh263enc.c
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 2/7] avcodec/mpegvideo_enc: Make ff_dct_quantize_c() static Andreas Rheinhardt
@ 2024-06-09 9:54 ` Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 4/7] avcodec/mips/mpegvideo: Set denoise_dct only for encoder Andreas Rheinhardt
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/ituh263enc.c | 4 ++++
libavcodec/mpegvideo_enc.c | 2 --
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 97abfb3f45..72c2288ebe 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -42,6 +42,7 @@
#include "h263.h"
#include "h263enc.h"
#include "h263data.h"
+#include "h263dsp.h"
#include "mathops.h"
#include "mpegutils.h"
#include "internal.h"
@@ -869,6 +870,9 @@ av_cold void ff_h263_encode_init(MpegEncContext *s)
av_log(s->avctx, AV_LOG_WARNING, "Clipping lmin value to %d\n", s->lmax);
s->lmin = s->lmax;
}
+#if CONFIG_H263_ENCODER // Snow and SVQ1 call this
+ ff_h263dsp_init(&s->h263dsp);
+#endif
ff_thread_once(&init_static_once, h263_encode_init_static);
}
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 45b6fdd3f0..c9cb4c2e64 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -296,8 +296,6 @@ av_cold int ff_dct_encode_init(MpegEncContext *s)
ff_dct_encode_init_x86(s);
#endif
- if (CONFIG_H263_ENCODER)
- ff_h263dsp_init(&s->h263dsp);
if (!s->dct_quantize)
s->dct_quantize = dct_quantize_c;
if (!s->denoise_dct)
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 4/7] avcodec/mips/mpegvideo: Set denoise_dct only for encoder
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 2/7] avcodec/mpegvideo_enc: Make ff_dct_quantize_c() static Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 3/7] avcodec/mpegvideo_enc: Move initializing H263DSP to ituh263enc.c Andreas Rheinhardt
@ 2024-06-09 9:54 ` Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 5/7] avcodec/mpegvideo_enc: Always set c funcs in ff_dct_encode_init() Andreas Rheinhardt
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The C version is set in ff_dct_encode_init(), yet the MIPS version
is set in dct_init() (in ff_mpv_common_init() and therefore also
for decoders). This commit fixes this inconsistency.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mips/Makefile | 4 +-
libavcodec/mips/mpegvideo_init_mips.c | 2 -
libavcodec/mips/mpegvideo_mmi.c | 72 -----------------
libavcodec/mips/mpegvideoenc_init_mips.c | 33 ++++++++
libavcodec/mips/mpegvideoenc_mmi.c | 98 ++++++++++++++++++++++++
libavcodec/mpegvideo_enc.c | 4 +-
libavcodec/mpegvideoenc.h | 1 +
7 files changed, 138 insertions(+), 76 deletions(-)
create mode 100644 libavcodec/mips/mpegvideoenc_init_mips.c
create mode 100644 libavcodec/mips/mpegvideoenc_mmi.c
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 0647c0142a..fc1bc6b03f 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -31,7 +31,8 @@ OBJS-$(CONFIG_BLOCKDSP) += mips/blockdsp_init_mips.o
OBJS-$(CONFIG_PIXBLOCKDSP) += mips/pixblockdsp_init_mips.o
OBJS-$(CONFIG_IDCTDSP) += mips/idctdsp_init_mips.o
OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_init_mips.o
-OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoencdsp_init_mips.o
+OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoenc_init_mips.o \
+ mips/mpegvideoencdsp_init_mips.o
OBJS-$(CONFIG_ME_CMP) += mips/me_cmp_init_mips.o
OBJS-$(CONFIG_MPEG4_DECODER) += mips/xvididct_init_mips.o
OBJS-$(CONFIG_VC1DSP) += mips/vc1dsp_init_mips.o
@@ -76,6 +77,7 @@ MMI-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o
MMI-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o
MMI-OBJS-$(CONFIG_H264PRED) += mips/h264pred_mmi.o
MMI-OBJS-$(CONFIG_MPEGVIDEO) += mips/mpegvideo_mmi.o
+MMI-OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoenc_mmi.o
MMI-OBJS-$(CONFIG_IDCTDSP) += mips/idctdsp_mmi.o \
mips/simple_idct_mmi.o
MMI-OBJS-$(CONFIG_MPEG4_DECODER) += mips/xvid_idct_mmi.o
diff --git a/libavcodec/mips/mpegvideo_init_mips.c b/libavcodec/mips/mpegvideo_init_mips.c
index f687ad18f1..1d02b0c937 100644
--- a/libavcodec/mips/mpegvideo_init_mips.c
+++ b/libavcodec/mips/mpegvideo_init_mips.c
@@ -36,8 +36,6 @@ av_cold void ff_mpv_common_init_mips(MpegEncContext *s)
if (!(s->avctx->flags & AV_CODEC_FLAG_BITEXACT))
if (!s->q_scale_type)
s->dct_unquantize_mpeg2_intra = ff_dct_unquantize_mpeg2_intra_mmi;
-
- s->denoise_dct= ff_denoise_dct_mmi;
}
if (have_msa(cpu_flags)) {
diff --git a/libavcodec/mips/mpegvideo_mmi.c b/libavcodec/mips/mpegvideo_mmi.c
index 3d5b5e20ab..7af421db6b 100644
--- a/libavcodec/mips/mpegvideo_mmi.c
+++ b/libavcodec/mips/mpegvideo_mmi.c
@@ -434,75 +434,3 @@ void ff_dct_unquantize_mpeg2_intra_mmi(MpegEncContext *s, int16_t *block,
block[0]= block0;
}
-
-void ff_denoise_dct_mmi(MpegEncContext *s, int16_t *block)
-{
- const int intra = s->mb_intra;
- int *sum = s->dct_error_sum[intra];
- uint16_t *offset = s->dct_offset[intra];
- double ftmp[8];
- mips_reg addr[1];
- DECLARE_VAR_ALL64;
-
- s->dct_count[intra]++;
-
- __asm__ volatile(
- "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "1: \n\t"
- MMI_LDC1(%[ftmp1], %[block], 0x00)
- "pxor %[ftmp2], %[ftmp2], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp3], %[block], 0x08)
- "pxor %[ftmp4], %[ftmp4], %[ftmp4] \n\t"
- "pcmpgth %[ftmp2], %[ftmp2], %[ftmp1] \n\t"
- "pcmpgth %[ftmp4], %[ftmp4], %[ftmp3] \n\t"
- "pxor %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- "pxor %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
- "psubh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- "psubh %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
- MMI_LDC1(%[ftmp6], %[offset], 0x00)
- "mov.d %[ftmp5], %[ftmp1] \n\t"
- "psubush %[ftmp1], %[ftmp1], %[ftmp6] \n\t"
- MMI_LDC1(%[ftmp6], %[offset], 0x08)
- "mov.d %[ftmp7], %[ftmp3] \n\t"
- "psubush %[ftmp3], %[ftmp3], %[ftmp6] \n\t"
- "pxor %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- "pxor %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
- "psubh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- "psubh %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
- MMI_SDC1(%[ftmp1], %[block], 0x00)
- MMI_SDC1(%[ftmp3], %[block], 0x08)
- "mov.d %[ftmp1], %[ftmp5] \n\t"
- "mov.d %[ftmp3], %[ftmp7] \n\t"
- "punpcklhw %[ftmp5], %[ftmp5], %[ftmp0] \n\t"
- "punpckhhw %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
- "punpcklhw %[ftmp7], %[ftmp7], %[ftmp0] \n\t"
- "punpckhhw %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
- MMI_LDC1(%[ftmp2], %[sum], 0x00)
- "paddw %[ftmp5], %[ftmp5], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[sum], 0x08)
- "paddw %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[sum], 0x10)
- "paddw %[ftmp7], %[ftmp7], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[sum], 0x18)
- "paddw %[ftmp3], %[ftmp3], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp5], %[sum], 0x00)
- MMI_SDC1(%[ftmp1], %[sum], 0x08)
- MMI_SDC1(%[ftmp7], %[sum], 0x10)
- MMI_SDC1(%[ftmp3], %[sum], 0x18)
- PTR_ADDIU "%[block], %[block], 0x10 \n\t"
- PTR_ADDIU "%[sum], %[sum], 0x20 \n\t"
- PTR_SUBU "%[addr0], %[block1], %[block] \n\t"
- PTR_ADDIU "%[offset], %[offset], 0x10 \n\t"
- "bgtz %[addr0], 1b \n\t"
- : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
- [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
- [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
- [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
- RESTRICT_ASM_ALL64
- [addr0]"=&r"(addr[0]),
- [block]"+&r"(block), [sum]"+&r"(sum),
- [offset]"+&r"(offset)
- : [block1]"r"(block+64)
- : "memory"
- );
-}
diff --git a/libavcodec/mips/mpegvideoenc_init_mips.c b/libavcodec/mips/mpegvideoenc_init_mips.c
new file mode 100644
index 0000000000..5ef0664937
--- /dev/null
+++ b/libavcodec/mips/mpegvideoenc_init_mips.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
+ *
+ * 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/attributes.h"
+#include "libavutil/mips/cpu.h"
+#include "libavcodec/mpegvideoenc.h"
+#include "mpegvideo_mips.h"
+
+av_cold void ff_mpvenc_dct_init_mips(MpegEncContext *s)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_mmi(cpu_flags)) {
+ s->denoise_dct = ff_denoise_dct_mmi;
+ }
+}
diff --git a/libavcodec/mips/mpegvideoenc_mmi.c b/libavcodec/mips/mpegvideoenc_mmi.c
new file mode 100644
index 0000000000..65da155e9f
--- /dev/null
+++ b/libavcodec/mips/mpegvideoenc_mmi.c
@@ -0,0 +1,98 @@
+/*
+ * Loongson SIMD optimized mpegvideo
+ *
+ * Copyright (c) 2015 Loongson Technology Corporation Limited
+ * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
+ * Zhang Shuangshuang <zhangshuangshuang@ict.ac.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 "mpegvideo_mips.h"
+#include "libavutil/mips/mmiutils.h"
+
+void ff_denoise_dct_mmi(MpegEncContext *s, int16_t *block)
+{
+ const int intra = s->mb_intra;
+ int *sum = s->dct_error_sum[intra];
+ uint16_t *offset = s->dct_offset[intra];
+ double ftmp[8];
+ mips_reg addr[1];
+ DECLARE_VAR_ALL64;
+
+ s->dct_count[intra]++;
+
+ __asm__ volatile(
+ "pxor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "1: \n\t"
+ MMI_LDC1(%[ftmp1], %[block], 0x00)
+ "pxor %[ftmp2], %[ftmp2], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp3], %[block], 0x08)
+ "pxor %[ftmp4], %[ftmp4], %[ftmp4] \n\t"
+ "pcmpgth %[ftmp2], %[ftmp2], %[ftmp1] \n\t"
+ "pcmpgth %[ftmp4], %[ftmp4], %[ftmp3] \n\t"
+ "pxor %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ "pxor %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
+ "psubh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ "psubh %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
+ MMI_LDC1(%[ftmp6], %[offset], 0x00)
+ "mov.d %[ftmp5], %[ftmp1] \n\t"
+ "psubush %[ftmp1], %[ftmp1], %[ftmp6] \n\t"
+ MMI_LDC1(%[ftmp6], %[offset], 0x08)
+ "mov.d %[ftmp7], %[ftmp3] \n\t"
+ "psubush %[ftmp3], %[ftmp3], %[ftmp6] \n\t"
+ "pxor %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ "pxor %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
+ "psubh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ "psubh %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
+ MMI_SDC1(%[ftmp1], %[block], 0x00)
+ MMI_SDC1(%[ftmp3], %[block], 0x08)
+ "mov.d %[ftmp1], %[ftmp5] \n\t"
+ "mov.d %[ftmp3], %[ftmp7] \n\t"
+ "punpcklhw %[ftmp5], %[ftmp5], %[ftmp0] \n\t"
+ "punpckhhw %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklhw %[ftmp7], %[ftmp7], %[ftmp0] \n\t"
+ "punpckhhw %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
+ MMI_LDC1(%[ftmp2], %[sum], 0x00)
+ "paddw %[ftmp5], %[ftmp5], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp2], %[sum], 0x08)
+ "paddw %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp2], %[sum], 0x10)
+ "paddw %[ftmp7], %[ftmp7], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp2], %[sum], 0x18)
+ "paddw %[ftmp3], %[ftmp3], %[ftmp2] \n\t"
+ MMI_SDC1(%[ftmp5], %[sum], 0x00)
+ MMI_SDC1(%[ftmp1], %[sum], 0x08)
+ MMI_SDC1(%[ftmp7], %[sum], 0x10)
+ MMI_SDC1(%[ftmp3], %[sum], 0x18)
+ PTR_ADDIU "%[block], %[block], 0x10 \n\t"
+ PTR_ADDIU "%[sum], %[sum], 0x20 \n\t"
+ PTR_SUBU "%[addr0], %[block1], %[block] \n\t"
+ PTR_ADDIU "%[offset], %[offset], 0x10 \n\t"
+ "bgtz %[addr0], 1b \n\t"
+ : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
+ [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
+ [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
+ [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
+ RESTRICT_ASM_ALL64
+ [addr0]"=&r"(addr[0]),
+ [block]"+&r"(block), [sum]"+&r"(sum),
+ [offset]"+&r"(offset)
+ : [block1]"r"(block+64)
+ : "memory"
+ );
+}
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index c9cb4c2e64..bc36d4b5a6 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -292,7 +292,9 @@ static void mpv_encode_defaults(MpegEncContext *s)
av_cold int ff_dct_encode_init(MpegEncContext *s)
{
-#if ARCH_X86
+#if ARCH_MIPS
+ ff_mpvenc_dct_init_mips(s);
+#elif ARCH_X86
ff_dct_encode_init_x86(s);
#endif
diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h
index 169ed1dc3b..abbcdbc8fa 100644
--- a/libavcodec/mpegvideoenc.h
+++ b/libavcodec/mpegvideoenc.h
@@ -146,6 +146,7 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
int ff_dct_encode_init(MpegEncContext *s);
+void ff_mpvenc_dct_init_mips(MpegEncContext *s);
void ff_dct_encode_init_x86(MpegEncContext *s);
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64],
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 5/7] avcodec/mpegvideo_enc: Always set c funcs in ff_dct_encode_init()
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
` (2 preceding siblings ...)
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 4/7] avcodec/mips/mpegvideo: Set denoise_dct only for encoder Andreas Rheinhardt
@ 2024-06-09 9:54 ` Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 6/7] avcodec/mpegvideo: Remove fast_dct_quantize Andreas Rheinhardt
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Use the common approach whereby the _c versions are set first
and then (potentially) overwritten by the arch-specific ones
instead of calling the arch-specific code first, followed by
setting the function pointers that have not already been set.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bc36d4b5a6..7dd692c1e4 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -292,16 +292,15 @@ static void mpv_encode_defaults(MpegEncContext *s)
av_cold int ff_dct_encode_init(MpegEncContext *s)
{
+ s->dct_quantize = dct_quantize_c;
+ s->denoise_dct = denoise_dct_c;
+
#if ARCH_MIPS
ff_mpvenc_dct_init_mips(s);
#elif ARCH_X86
ff_dct_encode_init_x86(s);
#endif
- if (!s->dct_quantize)
- s->dct_quantize = dct_quantize_c;
- if (!s->denoise_dct)
- s->denoise_dct = denoise_dct_c;
s->fast_dct_quantize = s->dct_quantize;
if (s->avctx->trellis)
s->dct_quantize = dct_quantize_trellis_c;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 6/7] avcodec/mpegvideo: Remove fast_dct_quantize
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
` (3 preceding siblings ...)
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 5/7] avcodec/mpegvideo_enc: Always set c funcs in ff_dct_encode_init() Andreas Rheinhardt
@ 2024-06-09 9:54 ` Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 7/7] avcodec/mpegvideo_enc: Don't pretend ff_dct_encode_init() can fail Andreas Rheinhardt
2024-06-11 20:56 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
It has been added in 3a87ac948f0cd95218e62d5a98b8b8d5e4c11366,
but there was never an implementation different from the ordinary
dct_quantize of it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/me_cmp.c | 6 +++---
libavcodec/mpegvideo.h | 1 -
libavcodec/mpegvideo_enc.c | 1 -
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c
index db3fb1260c..670103cc05 100644
--- a/libavcodec/me_cmp.c
+++ b/libavcodec/me_cmp.c
@@ -751,7 +751,7 @@ static int quant_psnr8x8_c(MpegEncContext *s, const uint8_t *src1,
memcpy(bak, temp, 64 * sizeof(int16_t));
s->block_last_index[0 /* FIXME */] =
- s->fast_dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);
+ s->dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);
s->dct_unquantize_inter(s, temp, 0, s->qscale);
ff_simple_idct_int16_8bit(temp); // FIXME
@@ -779,7 +779,7 @@ static int rd8x8_c(MpegEncContext *s, const uint8_t *src1, const uint8_t *src2,
s->block_last_index[0 /* FIXME */] =
last =
- s->fast_dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);
+ s->dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);
bits = 0;
@@ -849,7 +849,7 @@ static int bit8x8_c(MpegEncContext *s, const uint8_t *src1, const uint8_t *src2,
s->block_last_index[0 /* FIXME */] =
last =
- s->fast_dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);
+ s->dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);
bits = 0;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 215df0fd5b..e6b9d1e581 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -496,7 +496,6 @@ typedef struct MpegEncContext {
void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (MPEG-4 can use both)
int16_t *block/*align 16*/, int n, int qscale);
int (*dct_quantize)(struct MpegEncContext *s, int16_t *block/*align 16*/, int n, int qscale, int *overflow);
- int (*fast_dct_quantize)(struct MpegEncContext *s, int16_t *block/*align 16*/, int n, int qscale, int *overflow);
void (*denoise_dct)(struct MpegEncContext *s, int16_t *block);
int mpv_flags; ///< flags set by private options
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 7dd692c1e4..b7c1f08b0f 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -301,7 +301,6 @@ av_cold int ff_dct_encode_init(MpegEncContext *s)
ff_dct_encode_init_x86(s);
#endif
- s->fast_dct_quantize = s->dct_quantize;
if (s->avctx->trellis)
s->dct_quantize = dct_quantize_trellis_c;
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 7/7] avcodec/mpegvideo_enc: Don't pretend ff_dct_encode_init() can fail
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
` (4 preceding siblings ...)
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 6/7] avcodec/mpegvideo: Remove fast_dct_quantize Andreas Rheinhardt
@ 2024-06-09 9:54 ` Andreas Rheinhardt
2024-06-09 10:12 ` Rémi Denis-Courmont
2024-06-11 20:56 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
6 siblings, 1 reply; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-09 9:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/mpegvideo_enc.c | 4 +---
libavcodec/mpegvideoenc.h | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b7c1f08b0f..46ef693abe 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -290,7 +290,7 @@ static void mpv_encode_defaults(MpegEncContext *s)
s->picture_in_gop_number = 0;
}
-av_cold int ff_dct_encode_init(MpegEncContext *s)
+av_cold void ff_dct_encode_init(MpegEncContext *s)
{
s->dct_quantize = dct_quantize_c;
s->denoise_dct = denoise_dct_c;
@@ -303,8 +303,6 @@ av_cold int ff_dct_encode_init(MpegEncContext *s)
if (s->avctx->trellis)
s->dct_quantize = dct_quantize_trellis_c;
-
- return 0;
}
/* init video encoder */
diff --git a/libavcodec/mpegvideoenc.h b/libavcodec/mpegvideoenc.h
index abbcdbc8fa..0a9e65e93a 100644
--- a/libavcodec/mpegvideoenc.h
+++ b/libavcodec/mpegvideoenc.h
@@ -145,7 +145,7 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
-int ff_dct_encode_init(MpegEncContext *s);
+void ff_dct_encode_init(MpegEncContext *s);
void ff_mpvenc_dct_init_mips(MpegEncContext *s);
void ff_dct_encode_init_x86(MpegEncContext *s);
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 7/7] avcodec/mpegvideo_enc: Don't pretend ff_dct_encode_init() can fail
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 7/7] avcodec/mpegvideo_enc: Don't pretend ff_dct_encode_init() can fail Andreas Rheinhardt
@ 2024-06-09 10:12 ` Rémi Denis-Courmont
0 siblings, 0 replies; 9+ messages in thread
From: Rémi Denis-Courmont @ 2024-06-09 10:12 UTC (permalink / raw)
To: ffmpeg-devel
I would have reordered the code to avoid forward declarations, but LGTM.
--
雷米‧德尼-库尔蒙
http://www.remlab.net/
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
` (5 preceding siblings ...)
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 7/7] avcodec/mpegvideo_enc: Don't pretend ff_dct_encode_init() can fail Andreas Rheinhardt
@ 2024-06-11 20:56 ` Andreas Rheinhardt
6 siblings, 0 replies; 9+ messages in thread
From: Andreas Rheinhardt @ 2024-06-11 20:56 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> Always false since 49331f7ba3e3214738864af96d22fb1e6b5463b7.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/dnxhdenc.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
> index 028604a6e5..8b67becbe2 100644
> --- a/libavcodec/dnxhdenc.c
> +++ b/libavcodec/dnxhdenc.c
> @@ -430,9 +430,6 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
> if (ctx->profile != AV_PROFILE_DNXHD)
> ff_videodsp_init(&ctx->m.vdsp, ctx->bit_depth);
>
> - if (!ctx->m.dct_quantize)
> - ctx->m.dct_quantize = ff_dct_quantize_c;
> -
> if (ctx->is_444 || ctx->profile == AV_PROFILE_DNXHR_HQX) {
> ctx->m.dct_quantize = dnxhd_10bit_dct_quantize_444;
> ctx->get_pixels_8x4_sym = dnxhd_10bit_get_pixels_8x4_sym;
Will apply this patchset tomorrow unless there are objections.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-11 20:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-09 9:47 [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 2/7] avcodec/mpegvideo_enc: Make ff_dct_quantize_c() static Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 3/7] avcodec/mpegvideo_enc: Move initializing H263DSP to ituh263enc.c Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 4/7] avcodec/mips/mpegvideo: Set denoise_dct only for encoder Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 5/7] avcodec/mpegvideo_enc: Always set c funcs in ff_dct_encode_init() Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 6/7] avcodec/mpegvideo: Remove fast_dct_quantize Andreas Rheinhardt
2024-06-09 9:54 ` [FFmpeg-devel] [PATCH 7/7] avcodec/mpegvideo_enc: Don't pretend ff_dct_encode_init() can fail Andreas Rheinhardt
2024-06-09 10:12 ` Rémi Denis-Courmont
2024-06-11 20:56 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dnxhdenc: Remove always-false check Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git