ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
December 2018
- 2 participants
- 310 discussions
ffmpeg | branch: master | Jun Zhao <mypopydev(a)gmail.com> | Mon Nov 19 00:12:21 2018 +0800| [72b047a7a706b11f9c5f33d89434d288b7ec1384] | committer: Jun Zhao
lavc/kvazaar: fix auto thread flag in kvazaar wrapper.
Now the kvazaar warpper didn't setting the threads for kvazaar API,
and kavzaar will auto selecte the thread number.
Signed-off-by: Jun Zhao <mypopydev(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72b047a7a706b11f9…
---
libavcodec/libkvazaar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 5bc5b4ebf1..8f50bef669 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -293,7 +293,7 @@ AVCodec ff_libkvazaar_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("libkvazaar H.265 / HEVC"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
- .capabilities = AV_CODEC_CAP_DELAY,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
.pix_fmts = pix_fmts,
.priv_class = &class,
1
0
02 Dec '18
ffmpeg | branch: master | Marton Balint <cus(a)passwd.hu> | Sun Nov 25 01:38:05 2018 +0100| [c0479010125b8ec7eafe6cd55574cee9c3aeb475] | committer: Marton Balint
avdevice/decklink_enc: add support for setting genlock timing offset
Signed-off-by: Marton Balint <cus(a)passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0479010125b8ec7e…
---
doc/outdevs.texi | 4 ++++
libavdevice/decklink_common.cpp | 5 +++++
libavdevice/decklink_common_c.h | 1 +
libavdevice/decklink_enc_c.c | 2 ++
libavdevice/version.h | 2 +-
5 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index 7509ac695d..1fd83c28cc 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -155,6 +155,10 @@ Defaults to @option{0.5}.
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}.
Defaults to @samp{unset}.
+@item timing_offset
+Sets the genlock timing pixel offset on the used output.
+Defaults to @samp{unset}.
+
@end table
@subsection Examples
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index 130e70b2ca..d3cc1eb3d1 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -171,6 +171,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx,
if (ret < 0)
return ret;
}
+ if (direction == DIRECTION_OUT && cctx->timing_offset != INT_MIN) {
+ res = ctx->cfg->SetInt(bmdDeckLinkConfigReferenceInputTimingOffset, cctx->timing_offset);
+ if (res != S_OK)
+ av_log(avctx, AV_LOG_WARNING, "Setting timing offset failed.\n");
+ }
return 0;
}
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 8e3bbeb7df..ca85ec2504 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -57,6 +57,7 @@ struct decklink_cctx {
int64_t queue_size;
int copyts;
int64_t timestamp_align;
+ int timing_offset;
};
#endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c
index 6169078159..63cbd39ecd 100644
--- a/libavdevice/decklink_enc_c.c
+++ b/libavdevice/decklink_enc_c.c
@@ -35,6 +35,8 @@ static const AVOption options[] = {
{ "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "duplex_mode"},
{ "half" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "duplex_mode"},
{ "full" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "duplex_mode"},
+ { "timing_offset", "genlock timing pixel offset", OFFSET(timing_offset), AV_OPT_TYPE_INT, { .i64 = INT_MIN }, INT_MIN, INT_MAX, ENC, "timing_offset"},
+ { "unset" , NULL , 0 , AV_OPT_TYPE_CONST, { .i64 = INT_MIN }, 0, 0, ENC, "timing_offset"},
{ NULL },
};
diff --git a/libavdevice/version.h b/libavdevice/version.h
index edf26bdc1a..e6ae2c44fc 100644
--- a/libavdevice/version.h
+++ b/libavdevice/version.h
@@ -29,7 +29,7 @@
#define LIBAVDEVICE_VERSION_MAJOR 58
#define LIBAVDEVICE_VERSION_MINOR 6
-#define LIBAVDEVICE_VERSION_MICRO 100
+#define LIBAVDEVICE_VERSION_MICRO 101
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
1
0
ffmpeg | branch: master | Marton Balint <cus(a)passwd.hu> | Sat Nov 24 23:09:24 2018 +0100| [418c90faac6522c73481650d000e9f5f030187cb] | committer: Marton Balint
ffplay: fix -x and -y options when only one of them is used
Previously if only -y was used then nothing happened, if only -x then zero
window height was set which is undefined in SDL and caused a black window.
>From now on if only one dimension is set we calculate the other based on
size/aspect of the shown content.
Signed-off-by: Marton Balint <cus(a)passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=418c90faac6522c73…
---
fftools/ffplay.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 37a853fbd9..6a195e5542 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1322,7 +1322,11 @@ static void sigterm_handler(int sig)
static void set_default_window_size(int width, int height, AVRational sar)
{
SDL_Rect rect;
- calculate_display_rect(&rect, 0, 0, INT_MAX, height, width, height, sar);
+ int max_width = screen_width ? screen_width : INT_MAX;
+ int max_height = screen_height ? screen_height : INT_MAX;
+ if (max_width == INT_MAX && max_height == INT_MAX)
+ max_height = height;
+ calculate_display_rect(&rect, 0, 0, max_width, max_height, width, height, sar);
default_width = rect.w;
default_height = rect.h;
}
@@ -1331,13 +1335,8 @@ static int video_open(VideoState *is)
{
int w,h;
- if (screen_width) {
- w = screen_width;
- h = screen_height;
- } else {
- w = default_width;
- h = default_height;
- }
+ w = screen_width ? screen_width : default_width;
+ h = screen_height ? screen_height : default_height;
if (!window_title)
window_title = input_filename;
1
0
02 Dec '18
ffmpeg | branch: master | Marton Balint <cus(a)passwd.hu> | Sat Nov 24 23:58:04 2018 +0100| [9a39c5449f5aef1c02bd46538bbbad4590064602] | committer: Marton Balint
ffplay: convert float math to int math in calculate_display_rect
Signed-off-by: Marton Balint <cus(a)passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a39c5449f5aef1c0…
---
fftools/ffplay.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index ab1f9faccf..37a853fbd9 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -861,31 +861,27 @@ static void calculate_display_rect(SDL_Rect *rect,
int scr_xleft, int scr_ytop, int scr_width, int scr_height,
int pic_width, int pic_height, AVRational pic_sar)
{
- float aspect_ratio;
- int width, height, x, y;
+ AVRational aspect_ratio = pic_sar;
+ int64_t width, height, x, y;
- if (pic_sar.num == 0)
- aspect_ratio = 0;
- else
- aspect_ratio = av_q2d(pic_sar);
+ if (av_cmp_q(aspect_ratio, av_make_q(0, 1)) <= 0)
+ aspect_ratio = av_make_q(1, 1);
- if (aspect_ratio <= 0.0)
- aspect_ratio = 1.0;
- aspect_ratio *= (float)pic_width / (float)pic_height;
+ aspect_ratio = av_mul_q(aspect_ratio, av_make_q(pic_width, pic_height));
/* XXX: we suppose the screen has a 1.0 pixel ratio */
height = scr_height;
- width = lrint(height * aspect_ratio) & ~1;
+ width = av_rescale(height, aspect_ratio.num, aspect_ratio.den) & ~1;
if (width > scr_width) {
width = scr_width;
- height = lrint(width / aspect_ratio) & ~1;
+ height = av_rescale(width, aspect_ratio.den, aspect_ratio.num) & ~1;
}
x = (scr_width - width) / 2;
y = (scr_height - height) / 2;
rect->x = scr_xleft + x;
rect->y = scr_ytop + y;
- rect->w = FFMAX(width, 1);
- rect->h = FFMAX(height, 1);
+ rect->w = FFMAX((int)width, 1);
+ rect->h = FFMAX((int)height, 1);
}
static void get_sdl_pix_fmt_and_blendmode(int format, Uint32 *sdl_pix_fmt, SDL_BlendMode *sdl_blendmode)
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Tue Nov 27 12:09:03 2018 +0100| [2a08faba88027ec4679910bab9ff23925d8f6142] | committer: Paul B Mahol
avformat/mpegenc: extend muxing PCM-DVD to other depths
Fixes #6783.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a08faba88027ec46…
---
libavformat/mpegenc.c | 27 +++++++++++++++++++++------
libavformat/version.h | 2 +-
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 4c6fa67fb8..1389288b7f 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -364,12 +364,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
stream->id = ac3_id++;
} else if (st->codecpar->codec_id == AV_CODEC_ID_DTS) {
stream->id = dts_id++;
- } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE ||
- st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) {
- if (st->codecpar->bits_per_coded_sample != 16) {
- av_log(ctx, AV_LOG_ERROR, "Only 16 bit LPCM streams can be muxed.\n");
- goto fail;
- }
+ } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) {
stream->id = lpcm_id++;
for (j = 0; j < 4; j++) {
if (lpcm_freq_tab[j] == st->codecpar->sample_rate)
@@ -392,6 +387,26 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
stream->lpcm_header[1] = (st->codecpar->channels - 1) | (j << 4);
stream->lpcm_header[2] = 0x80;
stream->lpcm_align = st->codecpar->channels * 2;
+ } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) {
+ int freq;
+
+ switch (st->codecpar->sample_rate) {
+ case 48000: freq = 0; break;
+ case 96000: freq = 1; break;
+ case 44100: freq = 2; break;
+ case 32000: freq = 3; break;
+ default:
+ av_log(ctx, AV_LOG_ERROR, "Unsupported sample rate.\n");
+ return AVERROR(EINVAL);
+ }
+
+ stream->lpcm_header[0] = 0x0c;
+ stream->lpcm_header[1] = (freq << 4) |
+ (((st->codecpar->bits_per_coded_sample - 16) / 4) << 6) |
+ st->codecpar->channels - 1;
+ stream->lpcm_header[2] = 0x80;
+ stream->id = lpcm_id++;
+ stream->lpcm_align = st->codecpar->channels * st->codecpar->bits_per_coded_sample / 8;
} else {
stream->id = mpa_id++;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index 824b9e7cd6..30f2a84ddb 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 58
#define LIBAVFORMAT_VERSION_MINOR 23
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Mon Nov 26 19:03:58 2018 +0100| [e9967822e41213acb95e4a1b3a9bbfd240bc12c9] | committer: Paul B Mahol
avcodec: add PCM-DVD encoder
Fixes #6784.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9967822e41213acb…
---
Changelog | 1 +
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/pcm-dvdenc.c | 197 ++++++++++++++++++++++++++++++++++++++++++++++++
libavcodec/version.h | 2 +-
5 files changed, 201 insertions(+), 1 deletion(-)
diff --git a/Changelog b/Changelog
index 8782ac41de..1f53ff46da 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version <next>:
- freezedetect filter
- truehd_core bitstream filter
- dhav demuxer
+- PCM-DVD encoder
version 4.1:
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2840a8069f..5feadac729 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -737,6 +737,7 @@ OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o
OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm-dvd.o
+OBJS-$(CONFIG_PCM_DVD_ENCODER) += pcm-dvdenc.o
OBJS-$(CONFIG_PCM_F16LE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_F24LE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_F32BE_DECODER) += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 2c17db5a70..d70646e91a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -494,6 +494,7 @@ extern AVCodec ff_xma2_decoder;
extern AVCodec ff_pcm_alaw_encoder;
extern AVCodec ff_pcm_alaw_decoder;
extern AVCodec ff_pcm_bluray_decoder;
+extern AVCodec ff_pcm_dvd_encoder;
extern AVCodec ff_pcm_dvd_decoder;
extern AVCodec ff_pcm_f16le_decoder;
extern AVCodec ff_pcm_f24le_decoder;
diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
new file mode 100644
index 0000000000..d26eaf071c
--- /dev/null
+++ b/libavcodec/pcm-dvdenc.c
@@ -0,0 +1,197 @@
+/*
+ * LPCM codecs for PCM formats found in Video DVD streams
+ * Copyright (c) 2018 Paul B Mahol
+ *
+ * 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 "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+
+typedef struct PCMDVDContext {
+ uint8_t header[3]; // Header added to every frame
+ int block_size; // Size of a block of samples in bytes
+ int samples_per_block; // Number of samples per channel per block
+ int groups_per_block; // Number of 20/24-bit sample groups per block
+ uint8_t *extra_samples; // Pointer to leftover samples from a frame
+ int extra_sample_count; // Number of leftover samples in the buffer
+} PCMDVDContext;
+
+static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx)
+{
+ PCMDVDContext *s = avctx->priv_data;
+ int quant, freq, frame_size;
+
+ switch (avctx->sample_rate) {
+ case 48000:
+ freq = 0;
+ break;
+ case 96000:
+ freq = 1;
+ break;
+ }
+
+ switch (avctx->sample_fmt) {
+ case AV_SAMPLE_FMT_S16:
+ avctx->bits_per_coded_sample = 16;
+ quant = 0;
+ break;
+ case AV_SAMPLE_FMT_S32:
+ avctx->bits_per_coded_sample = 24;
+ quant = 2;
+ break;
+ }
+
+ avctx->bits_per_coded_sample = 16 + quant * 4;
+ avctx->block_align = avctx->channels * avctx->bits_per_coded_sample / 8;
+ avctx->bit_rate = avctx->block_align * 8LL * avctx->sample_rate;
+ if (avctx->bit_rate > 9800000) {
+ av_log(avctx, AV_LOG_ERROR, "Too big bitrate: reduce sample rate, bitdepth or channels.\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_S16) {
+ s->samples_per_block = 1;
+ s->block_size = avctx->channels * 2;
+ frame_size = 2008 / s->block_size;
+ } else {
+ switch (avctx->channels) {
+ case 1:
+ case 2:
+ case 4:
+ /* one group has all the samples needed */
+ s->block_size = 4 * avctx->bits_per_coded_sample / 8;
+ s->samples_per_block = 4 / avctx->channels;
+ s->groups_per_block = 1;
+ break;
+ case 8:
+ /* two groups have all the samples needed */
+ s->block_size = 8 * avctx->bits_per_coded_sample / 8;
+ s->samples_per_block = 1;
+ s->groups_per_block = 2;
+ break;
+ default:
+ /* need avctx->channels groups */
+ s->block_size = 4 * avctx->channels *
+ avctx->bits_per_coded_sample / 8;
+ s->samples_per_block = 4;
+ s->groups_per_block = avctx->channels;
+ break;
+ }
+
+ frame_size = FFALIGN(2008 / s->block_size, s->samples_per_block);
+ }
+
+ s->header[0] = 0x0c;
+ s->header[1] = (quant << 6) | (freq << 4) | (avctx->channels - 1);
+ s->header[2] = 0x80;
+
+ if (!avctx->frame_size)
+ avctx->frame_size = frame_size;
+
+ return 0;
+}
+
+static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ PCMDVDContext *s = avctx->priv_data;
+ int samples = frame->nb_samples * avctx->channels;
+ int64_t pkt_size = (frame->nb_samples / s->samples_per_block) * s->block_size + 3;
+ int blocks = (pkt_size - 3) / s->block_size;
+ const int16_t *src16;
+ const int32_t *src32;
+ PutByteContext pb;
+ int ret;
+
+ if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size, 0)) < 0)
+ return ret;
+
+ memcpy(avpkt->data, s->header, 3);
+
+ src16 = (const int16_t *)frame->data[0];
+ src32 = (const int32_t *)frame->data[0];
+
+ bytestream2_init_writer(&pb, avpkt->data + 3, avpkt->size - 3);
+
+ switch (avctx->sample_fmt) {
+ case AV_SAMPLE_FMT_S16:
+ do {
+ bytestream2_put_be16(&pb, *src16++);
+ } while (--samples);
+ break;
+ case AV_SAMPLE_FMT_S32:
+ if (avctx->channels == 1) {
+ do {
+ for (int i = 2; i; i--) {
+ bytestream2_put_be16(&pb, src32[0] >> 16);
+ bytestream2_put_be16(&pb, src32[1] >> 16);
+ bytestream2_put_byte(&pb, (*src32++) >> 24);
+ bytestream2_put_byte(&pb, (*src32++) >> 24);
+ }
+ } while (--blocks);
+ } else {
+ do {
+ for (int i = s->groups_per_block; i; i--) {
+ bytestream2_put_be16(&pb, src32[0] >> 16);
+ bytestream2_put_be16(&pb, src32[1] >> 16);
+ bytestream2_put_be16(&pb, src32[2] >> 16);
+ bytestream2_put_be16(&pb, src32[3] >> 16);
+ bytestream2_put_byte(&pb, (*src32++) >> 24);
+ bytestream2_put_byte(&pb, (*src32++) >> 24);
+ bytestream2_put_byte(&pb, (*src32++) >> 24);
+ bytestream2_put_byte(&pb, (*src32++) >> 24);
+ }
+ } while (--blocks);
+ }
+ break;
+ }
+
+ avpkt->pts = frame->pts;
+ avpkt->size = pkt_size;
+ avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
+ *got_packet_ptr = 1;
+
+ return 0;
+}
+
+static av_cold int pcm_dvd_encode_close(AVCodecContext *avctx)
+{
+ return 0;
+}
+
+AVCodec ff_pcm_dvd_encoder = {
+ .name = "pcm_dvd",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for DVD media"),
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_PCM_DVD,
+ .priv_data_size = sizeof(PCMDVDContext),
+ .init = pcm_dvd_encode_init,
+ .close = pcm_dvd_encode_close,
+ .encode2 = pcm_dvd_encode_frame,
+ .capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME,
+ .supported_samplerates = (const int[]) { 48000, 96000, 0},
+ .channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_5POINT1,
+ AV_CH_LAYOUT_7POINT1,
+ 0 },
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_S32,
+ AV_SAMPLE_FMT_NONE },
+};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e0b188b7a..8c81ccc2d5 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
-#define LIBAVCODEC_VERSION_MINOR 40
+#define LIBAVCODEC_VERSION_MINOR 41
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
1
0
ffmpeg | branch: master | Michael Niedermayer <michael(a)niedermayer.cc> | Fri Nov 16 20:03:01 2018 +0100| [1a89ae1df8585134b9524f736b71cee98de7895a] | committer: Michael Niedermayer
avcodec/hevcdec: Check for overlapping slices
Fixes: Timeout
Fixes: 10108/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6222384351674368
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a89ae1df8585134b…
---
libavcodec/hevcdec.c | 4 ++++
libavcodec/hevcdec.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index a3b5c8cb71..10bf2563c0 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2942,6 +2942,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
s->max_ra = INT_MIN;
}
+ s->overlap ++;
ret = hevc_frame_start(s);
if (ret < 0)
return ret;
@@ -3020,6 +3021,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
s->ref = NULL;
s->last_eos = s->eos;
s->eos = 0;
+ s->overlap = 0;
/* split the input packet into NAL units, so we know the upper bound on the
* number of slices in the frame */
@@ -3054,6 +3056,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
continue;
ret = decode_nal_unit(s, nal);
+ if (ret >= 0 && s->overlap > 2)
+ ret = AVERROR_INVALIDDATA;
if (ret < 0) {
av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index dd951aae06..b45969b7e2 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -430,6 +430,7 @@ typedef struct HEVCContext {
int max_ra;
int bs_width;
int bs_height;
+ int overlap;
int is_decoded;
int no_rasl_output_flag;
1
0
01 Dec '18
ffmpeg | branch: master | Michael Niedermayer <michael(a)niedermayer.cc> | Sat Nov 17 09:24:30 2018 +0100| [7f22a4ebc97817fd0968f5ea8295c9a59a6292e0] | committer: Michael Niedermayer
avcodec/truemotion2rt: Fix rounding in input size check
Fixes: Timeout
Fixes: 11332/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2RT_fuzzer-5678456612847616
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f22a4ebc97817fd0…
---
libavcodec/truemotion2rt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/truemotion2rt.c b/libavcodec/truemotion2rt.c
index 9df0b527bb..e3ab998fda 100644
--- a/libavcodec/truemotion2rt.c
+++ b/libavcodec/truemotion2rt.c
@@ -116,7 +116,7 @@ static int truemotion2rt_decode_frame(AVCodecContext *avctx, void *data,
if (ret < 0)
return ret;
- if (avctx->width / s->hscale * avctx->height * s->delta_size > avpkt->size * 8LL * 4)
+ if ((avctx->width + s->hscale - 1)/ s->hscale * avctx->height * s->delta_size > avpkt->size * 8LL * 4)
return AVERROR_INVALIDDATA;
ret = init_get_bits8(gb, avpkt->data + ret, avpkt->size - ret);
1
0
ffmpeg | branch: master | Shiyou Yin <yinshiyou-hf(a)loongson.cn> | Tue Nov 6 08:59:13 2018 +0800| [5982614af1f564ac05c1aa535cbd12cbbb2aa526] | committer: Michael Niedermayer
avcodec/mips: [loongson] refine optimization in h264_chroma.
Remove invalid operation in the case x and y all equal 0,
this refine made about 2% speedup for H264 decode on loongson platform.
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5982614af1f564ac0…
---
libavcodec/mips/h264chroma_mmi.c | 970 +++++++++++++++++----------------------
1 file changed, 426 insertions(+), 544 deletions(-)
diff --git a/libavcodec/mips/h264chroma_mmi.c b/libavcodec/mips/h264chroma_mmi.c
index 91b2cc470d..739dd7d4d6 100644
--- a/libavcodec/mips/h264chroma_mmi.c
+++ b/libavcodec/mips/h264chroma_mmi.c
@@ -30,74 +30,177 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
int h, int x, int y)
{
int A = 64, B, C, D, E;
- double ftmp[10];
+ double ftmp[12];
uint64_t tmp[1];
if (!(x || y)) {
/* x=0, y=0, A=64 */
__asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "mtc1 %[tmp0], %[ftmp4] \n\t"
-
"1: \n\t"
+ MMI_ULDC1(%[ftmp0], %[src], 0x00)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
MMI_ULDC1(%[ftmp1], %[src], 0x00)
- "addi %[h], %[h], -0x04 \n\t"
PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp5], %[src], 0x00)
+ MMI_ULDC1(%[ftmp2], %[src], 0x00)
PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp6], %[src], 0x00)
+ MMI_ULDC1(%[ftmp3], %[src], 0x00)
PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp7], %[src], 0x00)
- "punpcklbh %[ftmp2], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
- "psllh %[ftmp1], %[ftmp2], %[ftmp4] \n\t"
- "psllh %[ftmp2], %[ftmp3], %[ftmp4] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp4] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ "addi %[h], %[h], -0x04 \n\t"
- "punpcklbh %[ftmp2], %[ftmp5], %[ftmp0] \n\t"
- "punpckhbh %[ftmp3], %[ftmp5], %[ftmp0] \n\t"
- "psllh %[ftmp1], %[ftmp2], %[ftmp4] \n\t"
- "psllh %[ftmp2], %[ftmp3], %[ftmp4] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp4] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_SDC1(%[ftmp0], %[dst], 0x00)
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ MMI_SDC1(%[ftmp2], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ MMI_SDC1(%[ftmp3], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ "bnez %[h], 1b \n\t"
+ : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
+ [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
+ [dst]"+&r"(dst), [src]"+&r"(src),
+ [h]"+&r"(h)
+ : [stride]"r"((mips_reg)stride)
+ : "memory"
+ );
+ } else if (x && y) {
+ /* x!=0, y!=0 */
+ D = x * y;
+ B = (x << 3) - D;
+ C = (y << 3) - D;
+ A = 64 - D - B - C;
- "punpcklbh %[ftmp2], %[ftmp6], %[ftmp0] \n\t"
- "punpckhbh %[ftmp3], %[ftmp6], %[ftmp0] \n\t"
- "psllh %[ftmp1], %[ftmp2], %[ftmp4] \n\t"
- "psllh %[ftmp2], %[ftmp3], %[ftmp4] \n\t"
+ __asm__ volatile (
+ "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "dli %[tmp0], 0x06 \n\t"
+ "pshufh %[A], %[A], %[ftmp0] \n\t"
+ "pshufh %[B], %[B], %[ftmp0] \n\t"
+ "mtc1 %[tmp0], %[ftmp9] \n\t"
+ "pshufh %[C], %[C], %[ftmp0] \n\t"
+ "pshufh %[D], %[D], %[ftmp0] \n\t"
+
+ "1: \n\t"
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ MMI_ULDC1(%[ftmp2], %[src], 0x01)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULDC1(%[ftmp3], %[src], 0x00)
+ MMI_ULDC1(%[ftmp4], %[src], 0x01)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULDC1(%[ftmp10], %[src], 0x00)
+ MMI_ULDC1(%[ftmp11], %[src], 0x01)
+ "addi %[h], %[h], -0x02 \n\t"
+
+ "punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp7], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp8], %[ftmp2], %[ftmp0] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
+ "pmullh %[ftmp7], %[ftmp7], %[B] \n\t"
+ "paddh %[ftmp1], %[ftmp5], %[ftmp7] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[A] \n\t"
+ "pmullh %[ftmp8], %[ftmp8], %[B] \n\t"
+ "paddh %[ftmp2], %[ftmp6], %[ftmp8] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp3], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp7], %[ftmp4], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp8], %[ftmp4], %[ftmp0] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
+ "pmullh %[ftmp7], %[ftmp7], %[D] \n\t"
+ "paddh %[ftmp5], %[ftmp5], %[ftmp7] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[C] \n\t"
+ "pmullh %[ftmp8], %[ftmp8], %[D] \n\t"
+ "paddh %[ftmp6], %[ftmp6], %[ftmp8] \n\t"
+ "paddh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
+ "paddh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
"paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
"paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp4] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
+ "psrlh %[ftmp1], %[ftmp1], %[ftmp9] \n\t"
+ "psrlh %[ftmp2], %[ftmp2], %[ftmp9] \n\t"
"packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+
+ "punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp3], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp7], %[ftmp4], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp8], %[ftmp4], %[ftmp0] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
+ "pmullh %[ftmp7], %[ftmp7], %[B] \n\t"
+ "paddh %[ftmp3], %[ftmp5], %[ftmp7] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[A] \n\t"
+ "pmullh %[ftmp8], %[ftmp8], %[B] \n\t"
+ "paddh %[ftmp4], %[ftmp6], %[ftmp8] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp10], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp10], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp7], %[ftmp11], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp8], %[ftmp11], %[ftmp0] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
+ "pmullh %[ftmp7], %[ftmp7], %[D] \n\t"
+ "paddh %[ftmp5], %[ftmp5], %[ftmp7] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[C] \n\t"
+ "pmullh %[ftmp8], %[ftmp8], %[D] \n\t"
+ "paddh %[ftmp6], %[ftmp6], %[ftmp8] \n\t"
+ "paddh %[ftmp3], %[ftmp3], %[ftmp5] \n\t"
+ "paddh %[ftmp4], %[ftmp4], %[ftmp6] \n\t"
+ "paddh %[ftmp3], %[ftmp3], %[ff_pw_32] \n\t"
+ "paddh %[ftmp4], %[ftmp4], %[ff_pw_32] \n\t"
+ "psrlh %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
+ "psrlh %[ftmp4], %[ftmp4], %[ftmp9] \n\t"
+ "packushb %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
+
MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ MMI_SDC1(%[ftmp3], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ "bnez %[h], 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]),
+ [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
+ [ftmp10]"=&f"(ftmp[10]), [ftmp11]"=&f"(ftmp[11]),
+ [tmp0]"=&r"(tmp[0]),
+ [dst]"+&r"(dst), [src]"+&r"(src),
+ [h]"+&r"(h)
+ : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
+ [A]"f"(A), [B]"f"(B),
+ [C]"f"(C), [D]"f"(D)
+ : "memory"
+ );
+ } else if (x) {
+ /* x!=0, y==0 */
+ E = x << 3;
+ A = 64 - E;
+
+ __asm__ volatile (
+ "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "dli %[tmp0], 0x06 \n\t"
+ "pshufh %[A], %[A], %[ftmp0] \n\t"
+ "pshufh %[E], %[E], %[ftmp0] \n\t"
+ "mtc1 %[tmp0], %[ftmp7] \n\t"
+
+ "1: \n\t"
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ MMI_ULDC1(%[ftmp2], %[src], 0x01)
+ "addi %[h], %[h], -0x01 \n\t"
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+
+ "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
+ "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
+ "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
+ "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
+ "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
- "punpcklbh %[ftmp2], %[ftmp7], %[ftmp0] \n\t"
- "punpckhbh %[ftmp3], %[ftmp7], %[ftmp0] \n\t"
- "psllh %[ftmp1], %[ftmp2], %[ftmp4] \n\t"
- "psllh %[ftmp2], %[ftmp3], %[ftmp4] \n\t"
"paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
"paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp4] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
+ "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
+ "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
"packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
MMI_SDC1(%[ftmp1], %[dst], 0x00)
-
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
@@ -107,220 +210,80 @@ void ff_put_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
[tmp0]"=&r"(tmp[0]),
[dst]"+&r"(dst), [src]"+&r"(src),
[h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32)
+ : [stride]"r"((mips_reg)stride),
+ [ff_pw_32]"f"(ff_pw_32),
+ [A]"f"(A), [E]"f"(E)
: "memory"
);
} else {
- if (x && y) {
- /* x!=0, y!=0 */
- D = x * y;
- B = (x << 3) - D;
- C = (y << 3) - D;
- A = 64 - D - B - C;
-
- __asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "pshufh %[B], %[B], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp9] \n\t"
- "pshufh %[C], %[C], %[ftmp0] \n\t"
- "pshufh %[D], %[D], %[ftmp0] \n\t"
-
- "1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- MMI_ULDC1(%[ftmp2], %[src], 0x01)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp3], %[src], 0x00)
- MMI_ULDC1(%[ftmp4], %[src], 0x01)
- "addi %[h], %[h], -0x02 \n\t"
-
- "punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp7], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp8], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
- "pmullh %[ftmp7], %[ftmp7], %[B] \n\t"
- "paddh %[ftmp1], %[ftmp5], %[ftmp7] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[A] \n\t"
- "pmullh %[ftmp8], %[ftmp8], %[B] \n\t"
- "paddh %[ftmp2], %[ftmp6], %[ftmp8] \n\t"
-
- "punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp3], %[ftmp0] \n\t"
- "punpcklbh %[ftmp7], %[ftmp4], %[ftmp0] \n\t"
- "punpckhbh %[ftmp8], %[ftmp4], %[ftmp0] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
- "pmullh %[ftmp7], %[ftmp7], %[D] \n\t"
- "paddh %[ftmp3], %[ftmp5], %[ftmp7] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[C] \n\t"
- "pmullh %[ftmp8], %[ftmp8], %[D] \n\t"
- "paddh %[ftmp4], %[ftmp6], %[ftmp8] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp9] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp9] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
-
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- MMI_ULDC1(%[ftmp2], %[src], 0x01)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp3], %[src], 0x00)
- MMI_ULDC1(%[ftmp4], %[src], 0x01)
-
- "punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp7], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp8], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
- "pmullh %[ftmp7], %[ftmp7], %[B] \n\t"
- "paddh %[ftmp1], %[ftmp5], %[ftmp7] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[A] \n\t"
- "pmullh %[ftmp8], %[ftmp8], %[B] \n\t"
- "paddh %[ftmp2], %[ftmp6], %[ftmp8] \n\t"
-
- "punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp3], %[ftmp0] \n\t"
- "punpcklbh %[ftmp7], %[ftmp4], %[ftmp0] \n\t"
- "punpckhbh %[ftmp8], %[ftmp4], %[ftmp0] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
- "pmullh %[ftmp7], %[ftmp7], %[D] \n\t"
- "paddh %[ftmp3], %[ftmp5], %[ftmp7] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[C] \n\t"
- "pmullh %[ftmp8], %[ftmp8], %[D] \n\t"
- "paddh %[ftmp4], %[ftmp6], %[ftmp8] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp9] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp9] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
-
- "bnez %[h], 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]),
- [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
- [tmp0]"=&r"(tmp[0]),
- [dst]"+&r"(dst), [src]"+&r"(src),
- [h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A), [B]"f"(B),
- [C]"f"(C), [D]"f"(D)
- : "memory"
- );
- } else {
- if (x) {
- /* x!=0, y==0 */
- E = x << 3;
- A = 64 - E;
-
- __asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "pshufh %[E], %[E], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp7] \n\t"
-
- "1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- MMI_ULDC1(%[ftmp2], %[src], 0x01)
- "addi %[h], %[h], -0x01 \n\t"
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
-
- "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
- "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
- "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
- "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
- "bnez %[h], 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]),
- [tmp0]"=&r"(tmp[0]),
- [dst]"+&r"(dst), [src]"+&r"(src),
- [h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),
- [ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A), [E]"f"(E)
- : "memory"
- );
- } else {
- /* x==0, y!=0 */
- E = y << 3;
- A = 64 - E;
-
- __asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "pshufh %[E], %[E], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp7] \n\t"
-
- "1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp2], %[src], 0x00)
- "addi %[h], %[h], -0x01 \n\t"
-
- "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
- "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
- "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
- "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
-
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
- "bnez %[h], 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]),
- [tmp0]"=&r"(tmp[0]),
- [dst]"+&r"(dst), [src]"+&r"(src),
- [h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),
- [ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A), [E]"f"(E)
- : "memory"
- );
- }
- }
+ /* x==0, y!=0 */
+ E = y << 3;
+ A = 64 - E;
+
+ __asm__ volatile (
+ "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "dli %[tmp0], 0x06 \n\t"
+ "pshufh %[A], %[A], %[ftmp0] \n\t"
+ "pshufh %[E], %[E], %[ftmp0] \n\t"
+ "mtc1 %[tmp0], %[ftmp7] \n\t"
+
+ "1: \n\t"
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULDC1(%[ftmp2], %[src], 0x00)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULDC1(%[ftmp8], %[src], 0x00)
+ "addi %[h], %[h], -0x02 \n\t"
+
+ "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
+ "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
+ "paddh %[ftmp3], %[ftmp3], %[ftmp5] \n\t"
+ "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
+ "paddh %[ftmp4], %[ftmp4], %[ftmp6] \n\t"
+ "paddh %[ftmp3], %[ftmp3], %[ff_pw_32] \n\t"
+ "paddh %[ftmp4], %[ftmp4], %[ff_pw_32] \n\t"
+ "psrlh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
+ "psrlh %[ftmp4], %[ftmp4], %[ftmp7] \n\t"
+ "packushb %[ftmp1], %[ftmp3], %[ftmp4] \n\t"
+
+ "punpcklbh %[ftmp3], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp4], %[ftmp2], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp8], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp8], %[ftmp0] \n\t"
+ "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
+ "paddh %[ftmp3], %[ftmp3], %[ftmp5] \n\t"
+ "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
+ "paddh %[ftmp4], %[ftmp4], %[ftmp6] \n\t"
+ "paddh %[ftmp3], %[ftmp3], %[ff_pw_32] \n\t"
+ "paddh %[ftmp4], %[ftmp4], %[ff_pw_32] \n\t"
+ "psrlh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
+ "psrlh %[ftmp4], %[ftmp4], %[ftmp7] \n\t"
+ "packushb %[ftmp2], %[ftmp3], %[ftmp4] \n\t"
+
+ MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ MMI_SDC1(%[ftmp2], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ "bnez %[h], 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]),
+ [ftmp8]"=&f"(ftmp[8]), [tmp0]"=&r"(tmp[0]),
+ [dst]"+&r"(dst), [src]"+&r"(src),
+ [h]"+&r"(h)
+ : [stride]"r"((mips_reg)stride),
+ [ff_pw_32]"f"(ff_pw_32),
+ [A]"f"(A), [E]"f"(E)
+ : "memory"
+ );
}
}
@@ -334,231 +297,200 @@ void ff_avg_h264_chroma_mc8_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
if(!(x || y)){
/* x=0, y=0, A=64 */
__asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp4] \n\t"
-
"1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ MMI_ULDC1(%[ftmp0], %[src], 0x00)
PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp5], %[src], 0x00)
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
PTR_ADDU "%[src], %[src], %[stride] \n\t"
-
- "punpcklbh %[ftmp2], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
- "pmullh %[ftmp1], %[ftmp2], %[A] \n\t"
- "pmullh %[ftmp2], %[ftmp3], %[A] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp4] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
MMI_LDC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
-
- "punpcklbh %[ftmp2], %[ftmp5], %[ftmp0] \n\t"
- "punpckhbh %[ftmp3], %[ftmp5], %[ftmp0] \n\t"
- "pmullh %[ftmp1], %[ftmp2], %[A] \n\t"
- "pmullh %[ftmp2], %[ftmp3], %[A] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp4] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp3], %[dst], 0x00)
+ PTR_SUBU "%[dst], %[dst], %[stride] \n\t"
+ "pavgb %[ftmp0], %[ftmp0], %[ftmp2] \n\t"
+ "pavgb %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
+ MMI_SDC1(%[ftmp0], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
MMI_SDC1(%[ftmp1], %[dst], 0x00)
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
-
"addi %[h], %[h], -0x02 \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
[ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
+ [dst]"+&r"(dst), [src]"+&r"(src),
+ [h]"+&r"(h)
+ : [stride]"r"((mips_reg)stride)
+ : "memory"
+ );
+ } else if (x && y) {
+ /* x!=0, y!=0 */
+ D = x * y;
+ B = (x << 3) - D;
+ C = (y << 3) - D;
+ A = 64 - D - B - C;
+ __asm__ volatile (
+ "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "dli %[tmp0], 0x06 \n\t"
+ "pshufh %[A], %[A], %[ftmp0] \n\t"
+ "pshufh %[B], %[B], %[ftmp0] \n\t"
+ "mtc1 %[tmp0], %[ftmp9] \n\t"
+ "pshufh %[C], %[C], %[ftmp0] \n\t"
+ "pshufh %[D], %[D], %[ftmp0] \n\t"
+
+ "1: \n\t"
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ MMI_ULDC1(%[ftmp2], %[src], 0x01)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULDC1(%[ftmp3], %[src], 0x00)
+ MMI_ULDC1(%[ftmp4], %[src], 0x01)
+ "addi %[h], %[h], -0x01 \n\t"
+
+ "punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp7], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp8], %[ftmp2], %[ftmp0] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
+ "pmullh %[ftmp7], %[ftmp7], %[B] \n\t"
+ "paddh %[ftmp1], %[ftmp5], %[ftmp7] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[A] \n\t"
+ "pmullh %[ftmp8], %[ftmp8], %[B] \n\t"
+ "paddh %[ftmp2], %[ftmp6], %[ftmp8] \n\t"
+
+ "punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp3], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp7], %[ftmp4], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp8], %[ftmp4], %[ftmp0] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
+ "pmullh %[ftmp7], %[ftmp7], %[D] \n\t"
+ "paddh %[ftmp3], %[ftmp5], %[ftmp7] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[C] \n\t"
+ "pmullh %[ftmp8], %[ftmp8], %[D] \n\t"
+ "paddh %[ftmp4], %[ftmp6], %[ftmp8] \n\t"
+
+ "paddh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
+ "paddh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
+ "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
+ "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
+ "psrlh %[ftmp1], %[ftmp1], %[ftmp9] \n\t"
+ "psrlh %[ftmp2], %[ftmp2], %[ftmp9] \n\t"
+ "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp2], %[dst], 0x00)
+ "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ "bnez %[h], 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]),
+ [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
[tmp0]"=&r"(tmp[0]),
[dst]"+&r"(dst), [src]"+&r"(src),
[h]"+&r"(h)
: [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A)
+ [A]"f"(A), [B]"f"(B),
+ [C]"f"(C), [D]"f"(D)
+ : "memory"
+ );
+ } else if (x) {
+ /* x!=0, y==0 */
+ E = x << 3;
+ A = 64 - E;
+ __asm__ volatile (
+ "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "dli %[tmp0], 0x06 \n\t"
+ "pshufh %[A], %[A], %[ftmp0] \n\t"
+ "pshufh %[E], %[E], %[ftmp0] \n\t"
+ "mtc1 %[tmp0], %[ftmp7] \n\t"
+
+ "1: \n\t"
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ MMI_ULDC1(%[ftmp2], %[src], 0x01)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ "addi %[h], %[h], -0x01 \n\t"
+
+ "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
+ "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
+ "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
+ "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
+ "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
+
+ "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
+ "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
+ "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
+ "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
+ "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp2], %[dst], 0x00)
+ "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ "bnez %[h], 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]),
+ [tmp0]"=&r"(tmp[0]),
+ [dst]"+&r"(dst), [src]"+&r"(src),
+ [h]"+&r"(h)
+ : [stride]"r"((mips_reg)stride),
+ [ff_pw_32]"f"(ff_pw_32),
+ [A]"f"(A), [E]"f"(E)
: "memory"
);
} else {
- if(x && y) {
- /* x!=0, y!=0 */
- D = x * y;
- B = (x << 3) - D;
- C = (y << 3) - D;
- A = 64 - D - B - C;
- __asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "pshufh %[B], %[B], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp9] \n\t"
- "pshufh %[C], %[C], %[ftmp0] \n\t"
- "pshufh %[D], %[D], %[ftmp0] \n\t"
-
- "1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- MMI_ULDC1(%[ftmp2], %[src], 0x01)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp3], %[src], 0x00)
- MMI_ULDC1(%[ftmp4], %[src], 0x01)
- "addi %[h], %[h], -0x01 \n\t"
-
- "punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp7], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp8], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
- "pmullh %[ftmp7], %[ftmp7], %[B] \n\t"
- "paddh %[ftmp1], %[ftmp5], %[ftmp7] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[A] \n\t"
- "pmullh %[ftmp8], %[ftmp8], %[B] \n\t"
- "paddh %[ftmp2], %[ftmp6], %[ftmp8] \n\t"
-
- "punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp3], %[ftmp0] \n\t"
- "punpcklbh %[ftmp7], %[ftmp4], %[ftmp0] \n\t"
- "punpckhbh %[ftmp8], %[ftmp4], %[ftmp0] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
- "pmullh %[ftmp7], %[ftmp7], %[D] \n\t"
- "paddh %[ftmp3], %[ftmp5], %[ftmp7] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[C] \n\t"
- "pmullh %[ftmp8], %[ftmp8], %[D] \n\t"
- "paddh %[ftmp4], %[ftmp6], %[ftmp8] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp9] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp9] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
- "bnez %[h], 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]),
- [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
- [tmp0]"=&r"(tmp[0]),
- [dst]"+&r"(dst), [src]"+&r"(src),
- [h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A), [B]"f"(B),
- [C]"f"(C), [D]"f"(D)
- : "memory"
- );
- } else {
- if(x) {
- /* x!=0, y==0 */
- E = x << 3;
- A = 64 - E;
- __asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "pshufh %[E], %[E], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp7] \n\t"
-
- "1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- MMI_ULDC1(%[ftmp2], %[src], 0x01)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
- "addi %[h], %[h], -0x01 \n\t"
-
- "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
- "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
- "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
- "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
- "bnez %[h], 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]),
- [tmp0]"=&r"(tmp[0]),
- [dst]"+&r"(dst), [src]"+&r"(src),
- [h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),
- [ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A), [E]"f"(E)
- : "memory"
- );
- } else {
- /* x==0, y!=0 */
- E = y << 3;
- A = 64 - E;
- __asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "pshufh %[E], %[E], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp7] \n\t"
-
- "1: \n\t"
- MMI_ULDC1(%[ftmp1], %[src], 0x00)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_ULDC1(%[ftmp2], %[src], 0x00)
- "addi %[h], %[h], -0x01 \n\t"
-
- "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
- "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
- "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
- "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
- "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
- "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
- "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
- "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
- "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
- "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
-
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
- "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_LDC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- MMI_SDC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
- "bnez %[h], 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]),
- [tmp0]"=&r"(tmp[0]),
- [dst]"+&r"(dst), [src]"+&r"(src),
- [h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),
- [ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A), [E]"f"(E)
- : "memory"
- );
- }
- }
+ /* x==0, y!=0 */
+ E = y << 3;
+ A = 64 - E;
+ __asm__ volatile (
+ "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
+ "dli %[tmp0], 0x06 \n\t"
+ "pshufh %[A], %[A], %[ftmp0] \n\t"
+ "pshufh %[E], %[E], %[ftmp0] \n\t"
+ "mtc1 %[tmp0], %[ftmp7] \n\t"
+
+ "1: \n\t"
+ MMI_ULDC1(%[ftmp1], %[src], 0x00)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULDC1(%[ftmp2], %[src], 0x00)
+ "addi %[h], %[h], -0x01 \n\t"
+
+ "punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp4], %[ftmp1], %[ftmp0] \n\t"
+ "punpcklbh %[ftmp5], %[ftmp2], %[ftmp0] \n\t"
+ "punpckhbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
+ "pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
+ "pmullh %[ftmp5], %[ftmp5], %[E] \n\t"
+ "paddh %[ftmp1], %[ftmp3], %[ftmp5] \n\t"
+ "pmullh %[ftmp4], %[ftmp4], %[A] \n\t"
+ "pmullh %[ftmp6], %[ftmp6], %[E] \n\t"
+ "paddh %[ftmp2], %[ftmp4], %[ftmp6] \n\t"
+
+ "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
+ "paddh %[ftmp2], %[ftmp2], %[ff_pw_32] \n\t"
+ "psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
+ "psrlh %[ftmp2], %[ftmp2], %[ftmp7] \n\t"
+ "packushb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_LDC1(%[ftmp2], %[dst], 0x00)
+ "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_SDC1(%[ftmp1], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ "bnez %[h], 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]),
+ [tmp0]"=&r"(tmp[0]),
+ [dst]"+&r"(dst), [src]"+&r"(src),
+ [h]"+&r"(h)
+ : [stride]"r"((mips_reg)stride),
+ [ff_pw_32]"f"(ff_pw_32),
+ [A]"f"(A), [E]"f"(E)
+ : "memory"
+ );
}
}
@@ -567,8 +499,8 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
{
const int A = (8 - x) * (8 - y);
const int B = x * (8 - y);
- const int C = (8 - x) * y;
- const int D = x * y;
+ const int C = (8 - x) * y;
+ const int D = x * y;
const int E = B + C;
double ftmp[8];
uint64_t tmp[1];
@@ -586,31 +518,29 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
"pshufh %[D], %[D], %[ftmp0] \n\t"
"1: \n\t"
- PTR_ADDU "%[addr0], %[src], %[stride] \n\t"
MMI_ULWC1(%[ftmp1], %[src], 0x00)
MMI_ULWC1(%[ftmp2], %[src], 0x01)
- MMI_ULWC1(%[ftmp3], %[addr0], 0x00)
- MMI_ULWC1(%[ftmp4], %[addr0], 0x01)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULWC1(%[ftmp3], %[src], 0x00)
+ MMI_ULWC1(%[ftmp4], %[src], 0x01)
"punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
"punpcklbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
"pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
"pmullh %[ftmp6], %[ftmp6], %[B] \n\t"
"paddh %[ftmp1], %[ftmp5], %[ftmp6] \n\t"
-
"punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
"punpcklbh %[ftmp6], %[ftmp4], %[ftmp0] \n\t"
"pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
"pmullh %[ftmp6], %[ftmp6], %[D] \n\t"
"paddh %[ftmp2], %[ftmp5], %[ftmp6] \n\t"
-
"paddh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
"paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
"psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
"packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
+
"addi %[h], %[h], -0x01 \n\t"
MMI_SWC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
@@ -619,7 +549,6 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
[ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
[tmp0]"=&r"(tmp[0]),
RESTRICT_ASM_LOW32
- [addr0]"=&r"(addr[0]),
[dst]"+&r"(dst), [src]"+&r"(src),
[h]"+&r"(h)
: [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
@@ -629,7 +558,6 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
);
} else if (E) {
const int step = C ? stride : 1;
-
__asm__ volatile (
"xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
"dli %[tmp0], 0x06 \n\t"
@@ -638,22 +566,20 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
"mtc1 %[tmp0], %[ftmp5] \n\t"
"1: \n\t"
- PTR_ADDU "%[addr0], %[src], %[step] \n\t"
MMI_ULWC1(%[ftmp1], %[src], 0x00)
+ PTR_ADDU "%[addr0], %[src], %[step] \n\t"
MMI_ULWC1(%[ftmp2], %[addr0], 0x00)
-
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ "addi %[h], %[h], -0x01 \n\t"
"punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
"punpcklbh %[ftmp4], %[ftmp2], %[ftmp0] \n\t"
"pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
"pmullh %[ftmp4], %[ftmp4], %[E] \n\t"
"paddh %[ftmp1], %[ftmp3], %[ftmp4] \n\t"
-
"paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
"psrlh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
"packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
- "addi %[h], %[h], -0x01 \n\t"
MMI_SWC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
@@ -671,42 +597,22 @@ void ff_put_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
);
} else {
__asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp3] \n\t"
-
"1: \n\t"
- MMI_ULWC1(%[ftmp1], %[src], 0x00)
- "punpcklbh %[ftmp2], %[ftmp1], %[ftmp0] \n\t"
- "pmullh %[ftmp1], %[ftmp2], %[A] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
+ MMI_ULWC1(%[ftmp0], %[src], 0x00)
PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_SWC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
-
MMI_ULWC1(%[ftmp1], %[src], 0x00)
- "punpcklbh %[ftmp2], %[ftmp1], %[ftmp0] \n\t"
- "pmullh %[ftmp1], %[ftmp2], %[A] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
"addi %[h], %[h], -0x02 \n\t"
+ MMI_SWC1(%[ftmp0], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
MMI_SWC1(%[ftmp1], %[dst], 0x00)
-
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
- [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
- [tmp0]"=&r"(tmp[0]),
- RESTRICT_ASM_LOW32
[dst]"+&r"(dst), [src]"+&r"(src),
+ RESTRICT_ASM_LOW32
[h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A)
+ : [stride]"r"((mips_reg)stride)
: "memory"
);
}
@@ -736,33 +642,31 @@ void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
"pshufh %[D], %[D], %[ftmp0] \n\t"
"1: \n\t"
- PTR_ADDU "%[addr0], %[src], %[stride] \n\t"
MMI_ULWC1(%[ftmp1], %[src], 0x00)
MMI_ULWC1(%[ftmp2], %[src], 0x01)
- MMI_ULWC1(%[ftmp3], %[addr0], 0x00)
- MMI_ULWC1(%[ftmp4], %[addr0], 0x01)
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ MMI_ULWC1(%[ftmp3], %[src], 0x00)
+ MMI_ULWC1(%[ftmp4], %[src], 0x01)
"punpcklbh %[ftmp5], %[ftmp1], %[ftmp0] \n\t"
"punpcklbh %[ftmp6], %[ftmp2], %[ftmp0] \n\t"
"pmullh %[ftmp5], %[ftmp5], %[A] \n\t"
"pmullh %[ftmp6], %[ftmp6], %[B] \n\t"
"paddh %[ftmp1], %[ftmp5], %[ftmp6] \n\t"
-
"punpcklbh %[ftmp5], %[ftmp3], %[ftmp0] \n\t"
"punpcklbh %[ftmp6], %[ftmp4], %[ftmp0] \n\t"
"pmullh %[ftmp5], %[ftmp5], %[C] \n\t"
"pmullh %[ftmp6], %[ftmp6], %[D] \n\t"
"paddh %[ftmp2], %[ftmp5], %[ftmp6] \n\t"
-
"paddh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
"paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
"psrlh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
"packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
MMI_LWC1(%[ftmp2], %[dst], 0x00)
"pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+
"addi %[h], %[h], -0x01 \n\t"
MMI_SWC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
@@ -771,7 +675,6 @@ void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
[ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
[tmp0]"=&r"(tmp[0]),
RESTRICT_ASM_LOW32
- [addr0]"=&r"(addr[0]),
[dst]"+&r"(dst), [src]"+&r"(src),
[h]"+&r"(h)
: [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
@@ -781,32 +684,30 @@ void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
);
} else if (E) {
const int step = C ? stride : 1;
-
__asm__ volatile (
"xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
"dli %[tmp0], 0x06 \n\t"
"pshufh %[A], %[A], %[ftmp0] \n\t"
"pshufh %[E], %[E], %[ftmp0] \n\t"
"mtc1 %[tmp0], %[ftmp5] \n\t"
+
"1: \n\t"
- PTR_ADDU "%[addr0], %[src], %[step] \n\t"
MMI_ULWC1(%[ftmp1], %[src], 0x00)
+ PTR_ADDU "%[addr0], %[src], %[step] \n\t"
MMI_ULWC1(%[ftmp2], %[addr0], 0x00)
-
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
+ "addi %[h], %[h], -0x01 \n\t"
"punpcklbh %[ftmp3], %[ftmp1], %[ftmp0] \n\t"
"punpcklbh %[ftmp4], %[ftmp2], %[ftmp0] \n\t"
"pmullh %[ftmp3], %[ftmp3], %[A] \n\t"
"pmullh %[ftmp4], %[ftmp4], %[E] \n\t"
"paddh %[ftmp1], %[ftmp3], %[ftmp4] \n\t"
-
"paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
"psrlh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
"packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
MMI_LWC1(%[ftmp2], %[dst], 0x00)
"pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
- "addi %[h], %[h], -0x01 \n\t"
MMI_SWC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
@@ -824,46 +725,27 @@ void ff_avg_h264_chroma_mc4_mmi(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
);
} else {
__asm__ volatile (
- "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
- "dli %[tmp0], 0x06 \n\t"
- "pshufh %[A], %[A], %[ftmp0] \n\t"
- "mtc1 %[tmp0], %[ftmp3] \n\t"
-
"1: \n\t"
- MMI_ULWC1(%[ftmp1], %[src], 0x00)
- "punpcklbh %[ftmp2], %[ftmp1], %[ftmp0] \n\t"
- "pmullh %[ftmp1], %[ftmp2], %[A] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
- MMI_LWC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ MMI_ULWC1(%[ftmp0], %[src], 0x00)
PTR_ADDU "%[src], %[src], %[stride] \n\t"
- MMI_SWC1(%[ftmp1], %[dst], 0x00)
- PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
-
MMI_ULWC1(%[ftmp1], %[src], 0x00)
- "punpcklbh %[ftmp2], %[ftmp1], %[ftmp0] \n\t"
- "pmullh %[ftmp1], %[ftmp2], %[A] \n\t"
- "paddh %[ftmp1], %[ftmp1], %[ff_pw_32] \n\t"
- "psrlh %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
- "packushb %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
- MMI_LWC1(%[ftmp2], %[dst], 0x00)
- "pavgb %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
+ PTR_ADDU "%[src], %[src], %[stride] \n\t"
"addi %[h], %[h], -0x02 \n\t"
+ MMI_LWC1(%[ftmp2], %[dst], 0x00)
+ "pavgb %[ftmp0], %[ftmp0], %[ftmp2] \n\t"
+ MMI_SWC1(%[ftmp0], %[dst], 0x00)
+ PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
+ MMI_LWC1(%[ftmp3], %[dst], 0x00)
+ "pavgb %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
MMI_SWC1(%[ftmp1], %[dst], 0x00)
-
- PTR_ADDU "%[src], %[src], %[stride] \n\t"
PTR_ADDU "%[dst], %[dst], %[stride] \n\t"
"bnez %[h], 1b \n\t"
: [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
[ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
- [tmp0]"=&r"(tmp[0]),
- RESTRICT_ASM_LOW32
[dst]"+&r"(dst), [src]"+&r"(src),
+ RESTRICT_ASM_LOW32
[h]"+&r"(h)
- : [stride]"r"((mips_reg)stride),[ff_pw_32]"f"(ff_pw_32),
- [A]"f"(A)
+ : [stride]"r"((mips_reg)stride)
: "memory"
);
}
1
0
ffmpeg | branch: master | Shiyou Yin <yinshiyou-hf(a)loongson.cn> | Thu Nov 29 17:39:41 2018 +0800| [5c806d5b54a7a261569b4d3c2053a321dcf4445f] | committer: Michael Niedermayer
configure: enable mipsfpu for loongson platform.
mipsfpu supported by loongson 3a2000,3a3000,3a4000,2k1000, Fate tests passed.
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c806d5b54a7a2615…
---
configure | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure b/configure
index 3e9222ed1b..54b7e1119b 100755
--- a/configure
+++ b/configure
@@ -4848,7 +4848,6 @@ elif enabled mips; then
enable fast_cmov
enable fast_unaligned
disable aligned_stack
- disable mipsfpu
disable mipsdsp
disable mipsdspr2
# When gcc version less than 5.3.0, add -fno-expensive-optimizations flag.
1
0