Also give a more suitable name to the MMI-optimized IDCT;
it is not PS2-specific, as the name currently suggests.
---
Now with a more elegant solution in avcodec.h that avoids
one ugly #ifdef.
libavcodec/Makefile | 2 +-
libavcodec/avcodec.h | 5 ++++-
libavcodec/mips/Makefile | 6 +++---
libavcodec/{ps2 => mips}/dsputil_mmi.c | 3 +--
libavcodec/{ps2 => mips}/idct_mmi.c | 1 -
libavcodec/{ps2 => mips}/mmi.h | 6 +++---
libavcodec/{ps2 => mips}/mpegvideo_mmi.c | 2 --
libavcodec/options.c | 5 ++++-
8 files changed, 16 insertions(+), 14 deletions(-)
rename libavcodec/{ps2 => mips}/dsputil_mmi.c (98%)
rename libavcodec/{ps2 => mips}/idct_mmi.c (99%)
rename libavcodec/{ps2 => mips}/mmi.h (98%)
rename libavcodec/{ps2 => mips}/mpegvideo_mmi.c (99%)
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fbb09ee..23cc1b5 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -694,7 +694,7 @@ HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen
cos_tablegen \
dv_tablegen motionpixels_tablegen mpegaudio_tablegen \
pcm_tablegen qdm2_tablegen sinewin_tablegen
-DIRS = alpha arm bfin ppc ps2 sh4 sparc x86
+DIRS = alpha arm bfin mips ppc sh4 sparc x86
CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b60e7be..701bc4c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1729,7 +1729,10 @@ typedef struct AVCodecContext {
#define FF_IDCT_SIMPLE 2
#define FF_IDCT_SIMPLEMMX 3
#define FF_IDCT_LIBMPEG2MMX 4
-#define FF_IDCT_PS2 5
+#define FF_IDCT_MMI 5
+#if LIBAVCODEC_VERSION_MAJOR == 54
+#define FF_IDCT_PS2 FF_IDCT_MMI
+#endif
#define FF_IDCT_ARM 7
#define FF_IDCT_ALTIVEC 8
#define FF_IDCT_SH4 9
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 3f4da68..0066176 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -1,3 +1,3 @@
-OBJS-$(HAVE_MMI) += ps2/dsputil_mmi.o \
- ps2/idct_mmi.o \
- ps2/mpegvideo_mmi.o \
+OBJS-$(HAVE_MMI) += mips/dsputil_mmi.o \
+ mips/idct_mmi.o \
+ mips/mpegvideo_mmi.o \
diff --git a/libavcodec/ps2/dsputil_mmi.c b/libavcodec/mips/dsputil_mmi.c
similarity index 98%
rename from libavcodec/ps2/dsputil_mmi.c
rename to libavcodec/mips/dsputil_mmi.c
index 77755b0..3f65406 100644
--- a/libavcodec/ps2/dsputil_mmi.c
+++ b/libavcodec/mips/dsputil_mmi.c
@@ -157,11 +157,10 @@ void dsputil_init_mmi(DSPContext* c, AVCodecContext
*avctx)
}
if (avctx->bits_per_raw_sample <= 8 &&
- (idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2)) {
+ (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_MMI)) {
c->idct_put= ff_mmi_idct_put;
c->idct_add= ff_mmi_idct_add;
c->idct = ff_mmi_idct;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}
}
-
diff --git a/libavcodec/ps2/idct_mmi.c b/libavcodec/mips/idct_mmi.c
similarity index 99%
rename from libavcodec/ps2/idct_mmi.c
rename to libavcodec/mips/idct_mmi.c
index 86df092..9b9033a 100644
--- a/libavcodec/ps2/idct_mmi.c
+++ b/libavcodec/mips/idct_mmi.c
@@ -359,4 +359,3 @@ void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM
*block)
//let savedtemp regs be saved
__asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21",
"$22", "$23");
}
-
diff --git a/libavcodec/ps2/mmi.h b/libavcodec/mips/mmi.h
similarity index 98%
rename from libavcodec/ps2/mmi.h
rename to libavcodec/mips/mmi.h
index fc8d328..3640de4 100644
--- a/libavcodec/ps2/mmi.h
+++ b/libavcodec/mips/mmi.h
@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVCODEC_PS2_MMI_H
-#define AVCODEC_PS2_MMI_H
+#ifndef AVCODEC_MIPS_MMI_H
+#define AVCODEC_MIPS_MMI_H
#define align16 __attribute__ ((aligned (16)))
@@ -168,4 +168,4 @@
#define pextlb(rs, rt, rd) \
__asm__ volatile ("pextlb " #rd ", " #rs ", " #rt )
-#endif /* AVCODEC_PS2_MMI_H */
+#endif /* AVCODEC_MIPS_MMI_H */
diff --git a/libavcodec/ps2/mpegvideo_mmi.c b/libavcodec/mips/mpegvideo_mmi.c
similarity index 99%
rename from libavcodec/ps2/mpegvideo_mmi.c
rename to libavcodec/mips/mpegvideo_mmi.c
index ed56893..623e35a 100644
--- a/libavcodec/ps2/mpegvideo_mmi.c
+++ b/libavcodec/mips/mpegvideo_mmi.c
@@ -85,5 +85,3 @@ void MPV_common_init_mmi(MpegEncContext *s)
s->dct_unquantize_h263_intra =
s->dct_unquantize_h263_inter = dct_unquantize_h263_mmi;
}
-
-
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 04fb1b4..999ccf4 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -214,7 +214,10 @@ static const AVOption options[]={
{"simple", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLE }, INT_MIN,
INT_MAX, V|E|D, "idct"},
{"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX },
INT_MIN, INT_MAX, V|E|D, "idct"},
{"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX },
INT_MIN, INT_MAX, V|E|D, "idct"},
-{"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX,
V|E|D, "idct"},
+#if LIBAVCODEC_VERSION_MAJOR == 54
+{"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_MMI }, INT_MIN, INT_MAX,
V|E|D, "idct"},
+#endif
+{"mmi", NULL, 0, AV_OPT_TYPE_CONST, { .dbl = FF_IDCT_MMI }, INT_MIN, INT_MAX,
V|E|D, "idct"},
{"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX,
V|E|D, "idct"},
{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN,
INT_MAX, V|E|D, "idct"},
{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX,
V|E|D, "idct"},
--
1.7.2.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel