Re: [FFmpeg-devel] [PATCH 0/6] avformat/movenc: normalize on AC-3 parser usage

2022-06-09 Thread Jan Ekström
On Tue, Jun 7, 2022 at 9:58 AM Jan Ekström  wrote:
>
> On Fri, Jun 3, 2022 at 3:46 PM Jan Ekström  wrote:
> >
> > The simplified parsing currently in `mov_write_ac3_tag` trusts the content
> > of the packets a bit too much (the AC-3 parser returns all data fed to it,
> > including any possible data before the start code), while the existing 
> > E-AC-3
> > logic does proper header validation by utilizing the (E-)AC-3 parser.
> >
> > Thus, normalize on AC-3 parser usage for both AC-3 and E-AC-3.
>
> Ping on this patch set, as this seems to improve the state of affairs
> with the input being MPEG-TS muxes where PES packets do not start with
> a start code (the previous ad-hoc parsing was way too trusting and
> would write bogus values based on the last N bytes of a previous
> packet into the AC-3 sample description).
>
> When applying, `avcodec/ac3_parser{,_internal}: expose AC-3
> bit_rate_code` will have a minor bump as technically a
> private-yet-utilized-from-lavf structure has something appended to it.

If there are no further comments, I will pull this in tomorrow, as
this has been generating valid sample descriptions for a piece of
software which is picky that the data is correct.

Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/mov: Only read the primary item for AVIF

2022-06-09 Thread Gyan Doshi




On 2022-06-08 10:51 pm, Vignesh Venkatasubramanian wrote:

On Thu, Jun 2, 2022 at 1:35 PM James Zern  wrote:

On Wed, Jun 1, 2022 at 1:38 PM Vignesh Venkatasubramanian
 wrote:

On Wed, Jun 1, 2022 at 10:30 AM James Zern  wrote:

On Sun, Apr 24, 2022 at 11:35 AM Vignesh Venkatasubramanian
 wrote:

Update the still AVIF parser to only read the primary item. With this
patch, AVIF still images with exif/icc/alpha channel will no longer
fail to parse.

For example, this patch enables parsing of files in:
https://github.com/AOMediaCodec/av1-avif/tree/master/testFiles/Microsoft


Can some of the failing files or similar ones be added to fate?

There are no fate tests for AVIF parsing as of now. I was thinking
about adding some for the muxing. But i am not sure what can be done
here for the parsing.


Thanks. Are there any for general mov/mp4 parsing that could be
extended? This looks good otherwise.

 From what i see, most of the mov tests only seem to be for muxing. I'm
not entirely certain about how to add a test for AVIF parsing. If
anybody has an idea, i'd be open to adding it.


Basic test would use the framemd5 muxer to compare demuxed packets with 
a reference.

See fate-ffmpeg-streamloop

Regards,
Gyan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread Martin Storsjö

On Thu, 26 May 2022, ffmpegagent wrote:


This patchset adds support for long file and directory paths on Windows. The
implementation follows the same logic that .NET is using internally, with
the only exception that it doesn't expand short path components in 8.3
format. .NET does this as the same function is also used for other purposes,
but in our case, that's not required. Short (8.3) paths are working as well
with the extended path prefix, even when longer than 260.

Successfully tested:

* Regular paths wth drive letter
* Regular UNC paths
* Long paths wth drive letter
* Long paths wth drive letter and forward slashes
* Long UNC paths
* Prefixed paths wth drive letter
* Prefixed UNC paths

I have kept the individual functions separate on purpose, to make it easy to
compare with the .NET impl. (compilers should inlinie those anyway)

v2

* wchar_filename: Improve comments and function documentation
* os_support: adjust defines to use win32_stat

v3

* removed length check in path_is_extended()
* added path_is_device_path() check in add_extended_prefix()
* add_extended_prefix(): clarified doc and add checks
* clarified string allocation length calculation
* replaced 260 with MAX_PATH
* removed redundant checks after normalization

v4

* rebased. no changes

v5

* resolved the ugly struct duplication
* compatible with _USE_32BIT_TIME_T

v6

* wchar_filename.h: added links to .NET source code
* wchar_filename.h: free allocations on error
* os_support.hs: use clean and safe way to redirect stat() calls

v7

* os_support.h: remapped fstat with win32_stat structure
* os_support.h: use int64_t for some members
* avformat/file: remove _WIN32 condition

v8

* os_support.h: documented win32_stat structure
* os_support.h: renamed function parameters

softworkz (3):
 avutil/wchar_filename,file_open: Support long file names on Windows
 avformat/os_support: Support long file names on Windows
 avformat/file: remove _WIN32 condition

libavformat/file.c |   4 -
libavformat/os_support.h   | 116 ++--
libavutil/file_open.c  |   2 +-
libavutil/wchar_filename.h | 180 +
4 files changed, 272 insertions(+), 30 deletions(-)


This looks fine to me, and the discussion seems to have converged, so I'll 
go ahead and push this.


// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Martin Storsjö

On Sun, 5 Jun 2022, Nil Admirari wrote:


These functions are going to be used in libavformat/avisynth.c
and fftools/cmdutils.c to remove MAX_PATH limit.
---
libavutil/wchar_filename.h | 51 ++
1 file changed, 51 insertions(+)


This patchset looks good to me too, thanks! If there's no more comments on 
it, I'll push it later.


// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/2] libjxl Colorspace Fixes

2022-06-09 Thread Leo Izen

On 6/1/22 22:14, Leo Izen wrote:

Changes in v8:
- Use avutil/csp for both encoding and decoding
- Handle the non-XYB case with an attached ICC Profile on decoding
- clean up some code and segment it out to static functions

Leo Izen (2):
   avcodec/libjxldec: properly tag output colorspace
   avcodec/libjxlenc: properly read input colorspace

  libavcodec/libjxldec.c | 142 +++---
  libavcodec/libjxlenc.c | 153 +
  2 files changed, 256 insertions(+), 39 deletions(-)



I believe this should make it into 5.1 as it fixes a known bug and 
improves existing behavior.


- Leo Izen (thebombzen)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v1] ffmpeg: add optional JSON output of inputs, outputs, mapping, and progress

2022-06-09 Thread Ingo Oppermann
In order to make a running ffmpeg process easier to monitor and parse by
programs that call the ffmpeg binary and process its output, this patch adds
the command line option -jsonstats. This option is a modifier for the
(no)stats option which provides a more verbose output in JSON format than the
default output. It enables the additional output of the input streams,
their mapping to the outputs (including the filter graphs), and the output
streams as JSON. Each output is on a single line and is prefixed with
"json.inputs:", "json.mapping:", and "json.outputs:" respectively, followed by
the JSON data. The -jsonstats option is disabled by default.

The inputs and outputs are arrays and for each input and output stream, the
information in the JSON is similar to the default dump of the inputs and
outputs.

The stream mapping includes an array of the filter graphs and a mapping
representation similar to the output from to graph2dot.c program.

The current progress report is replaced by a JSON representation which is
prefixed with "json.progress:" followed by JSON data, and each report will be
on a new line. The progress data contains values similar to the default data
for each input and output stream and a summary.

Together with the -progress option, the described JSON data instead of the
default data will be written to the provided target.

Signed-off-by: Ingo Oppermann 
---
 doc/ffmpeg.texi  |  10 ++
 fftools/ffmpeg.c | 198 +++-
 fftools/ffmpeg.h |   1 +
 fftools/ffmpeg_mux.c | 307 +++
 fftools/ffmpeg_opt.c | 115 
 5 files changed, 629 insertions(+), 2 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 0d7e1a479d..16fcd9970a 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -784,6 +784,13 @@ disable it you need to specify @code{-nostats}.
 @item -stats_period @var{time} (@emph{global})
 Set period at which encoding progress/statistics are updated. Default is 0.5 
seconds.
 
+@item -jsonstats (@emph{global})
+Print inputs, outputs, stream mapping, and encoding progress/statistics. It is 
off by
+default. It modifies the output of @code{-stats} to be JSON. The inputs, 
outputs,
+stream mapping, and progress information are written on one line and are 
prefixed
+with @var{json.inputs:}, @var{json.outputs:}, @var{json.mapping:}, and 
@var{json.progress:}
+respectively followed by the JSON data.
+
 @item -progress @var{url} (@emph{global})
 Send program-friendly progress information to @var{url}.
 
@@ -792,6 +799,9 @@ the encoding process. It is made of "@var{key}=@var{value}" 
lines. @var{key}
 consists of only alphanumeric characters. The last key of a sequence of
 progress information is always "progress".
 
+If @code{-jsonstats} is enabled, the progress information is written as JSON 
with
+the prefixes and data 
+
 The update period is set using @code{-stats_period}.
 
 @anchor{stdin option}
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 5ed287c522..eea1491ed1 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1505,7 +1505,7 @@ static void print_final_stats(int64_t total_size)
 }
 }
 
-static void print_report(int is_last_report, int64_t timer_start, int64_t 
cur_time)
+static void print_default_report(int is_last_report, int64_t timer_start, 
int64_t cur_time)
 {
 AVBPrint buf, buf_script;
 OutputStream *ost;
@@ -1695,7 +1695,7 @@ static void print_report(int is_last_report, int64_t 
timer_start, int64_t cur_ti
 }
 av_bprint_finalize(&buf, NULL);
 
-if (progress_avio) {
+if (progress_avio && !print_jsonstats) {
 av_bprintf(&buf_script, "progress=%s\n",
is_last_report ? "end" : "continue");
 avio_write(progress_avio, buf_script.str,
@@ -1715,6 +1715,200 @@ static void print_report(int is_last_report, int64_t 
timer_start, int64_t cur_ti
 print_final_stats(total_size);
 }
 
+/**
+ * Print progress report in JSON format
+ *
+ * @param is_last_report Whether this is the last report
+ * @param timer_start Time when the processing started
+ * @param cur_time Current processing time of the stream
+ */
+static void print_json_report(int is_last_report, int64_t timer_start, int64_t 
cur_time)
+{
+AVBPrint buf;
+InputStream *ist;
+OutputStream *ost;
+uint64_t stream_size, total_packets = 0, total_size = 0;
+AVCodecContext *enc;
+int i, j;
+double speed;
+int64_t pts = INT64_MIN + 1;
+static int first_report = 1;
+static int64_t last_time = -1;
+int hours, mins, secs, us;
+const char *hours_sign;
+float t, q;
+
+if (!is_last_report) {
+if (last_time == -1) {
+last_time = cur_time;
+}
+if (((cur_time - last_time) < stats_period && !first_report) ||
+(first_report && nb_output_dumped < nb_output_files))
+return;
+last_time = cur_time;
+}
+
+t = (cur_time - timer_start) / 100.0;
+
+av_bpri

Re: [FFmpeg-devel] [PATCH v1 2/4] lavc/hevcdec: do not let missing ref frames invovled in dpb process

2022-06-09 Thread Michael Niedermayer
On Thu, Jun 09, 2022 at 05:34:47AM +, Wang, Fei W wrote:
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Michael Niedermayer
> > Sent: Tuesday, June 7, 2022 8:07 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH v1 2/4] lavc/hevcdec: do not let missing 
> > ref
> > frames invovled in dpb process
> > 
> > On Tue, Jun 07, 2022 at 03:08:28PM +0800, Fei Wang wrote:
> > > From: Xu Guangxin 
> > >
> > > We will generate a new frame for a missed reference. The frame can
> > > only be used for reference. We assign an invalid decode sequence to
> > > it, so it will not be involved in any dpb process.
> > >
> > > Tested-by: Fei Wang 
> > > Signed-off-by: Xu Guangxin 
> > > ---
> > >  libavcodec/hevc_refs.c | 13 -
> > >  libavcodec/hevcdec.c   |  4 ++--
> > >  libavcodec/hevcdec.h   |  3 +++
> > >  3 files changed, 17 insertions(+), 3 deletions(-)
> > 
> > This causes segfaults
> 
> Thanks Michael, could you share your clip to me? I can't reproduce this with 
> all my clips.

file sent by private mail

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Martin
> Storsjö
> Sent: Thursday, June 9, 2022 12:10 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add
> whcartoutf8, wchartoansi and utf8toansi
> 
> On Sun, 5 Jun 2022, Nil Admirari wrote:
> 
> > These functions are going to be used in libavformat/avisynth.c
> > and fftools/cmdutils.c to remove MAX_PATH limit.
> > ---
> > libavutil/wchar_filename.h | 51 ++
> > 1 file changed, 51 insertions(+)
> 
> This patchset looks good to me too, thanks! If there's no more comments on
> it, I'll push it later.

I missed to take another look at it.

I'm wondering why it converts wchar back to ansi instead of utf8 in 4/4 and
whether it won't fail then, when a path contains non-ANSI chars.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Soft Works
> Sent: Thursday, June 9, 2022 6:47 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add
> whcartoutf8, wchartoansi and utf8toansi
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Martin
> > Storsjö
> > Sent: Thursday, June 9, 2022 12:10 PM
> > To: FFmpeg development discussions and patches 
> > Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add
> > whcartoutf8, wchartoansi and utf8toansi
> >
> > On Sun, 5 Jun 2022, Nil Admirari wrote:
> >
> > > These functions are going to be used in libavformat/avisynth.c
> > > and fftools/cmdutils.c to remove MAX_PATH limit.
> > > ---
> > > libavutil/wchar_filename.h | 51 ++
> > > 1 file changed, 51 insertions(+)
> >
> > This patchset looks good to me too, thanks! If there's no more comments on
> > it, I'll push it later.
> 
> I missed to take another look at it.
> 
> I'm wondering why it converts wchar back to ansi instead of utf8 in 4/4 and
> whether it won't fail then, when a path contains non-ANSI chars.

@Nil - would you mind rebasing your patchset, it doesn't apply anymore.

Thanks,
sw
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] ffmpeg: add option fps_mode

2022-06-09 Thread Gyan Doshi

Plan to push in a day.

On 2022-06-07 05:44 pm, Gyan Doshi wrote:

fps_mode sets video sync per output stream. Overrides vsync for matching
streams.
---
  doc/ffmpeg.texi  |  8 +---
  fftools/ffmpeg.c |  9 +
  fftools/ffmpeg.h |  3 +++
  fftools/ffmpeg_mux.c |  2 +-
  fftools/ffmpeg_opt.c | 41 ++---
  5 files changed, 44 insertions(+), 19 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 0d7e1a479d..395ddc34ba 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1618,10 +1618,12 @@ it may cause packet loss.
  It is useful for when flow speed of output packets is important, such as live 
streaming.
  @item -re (@emph{input})
  Read input at native frame rate. This is equivalent to setting 
@code{-readrate 1}.
-@item -vsync @var{parameter}
-Video sync method.
+@item -vsync @var{parameter} (@emph{global})
+@itemx -fps_mode[:@var{stream_specifier}] @var{parameter} 
(@emph{output,per-stream})
+Set video sync method / framerate mode. vsync is applied to all output video 
streams
+but can be overridden for a stream by setting fps_mode.
  
-For compatibility reasons some of the values can be specified as numbers (shown

+For compatibility reasons some of the values for vsync can be specified as 
numbers (shown
  in parentheses in the following table). This is deprecated and will stop 
working
  in the future.
  
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c

index 5ed287c522..2922a1e707 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3018,11 +3018,12 @@ static int init_output_stream_encode(OutputStream *ost, 
AVFrame *frame)
  
  if (!(enc_ctx->time_base.num && enc_ctx->time_base.den))

  enc_ctx->time_base = 
av_buffersink_get_time_base(ost->filter->filter);
-if (   av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != 
VSYNC_PASSTHROUGH
-   && (video_sync_method == VSYNC_CFR || video_sync_method == 
VSYNC_VSCFR ||
-   (video_sync_method == VSYNC_AUTO && !(of->format->flags & 
AVFMT_VARIABLE_FPS{
+if (   av_q2d(enc_ctx->time_base) < 0.001 && ost->vsync_method != 
VSYNC_PASSTHROUGH
+   && (ost->vsync_method == VSYNC_CFR || ost->vsync_method == 
VSYNC_VSCFR ||
+   (ost->vsync_method == VSYNC_AUTO && !(of->format->flags & 
AVFMT_VARIABLE_FPS{
  av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not 
efficiently supporting it.\n"
-   "Please consider specifying a lower 
framerate, a different muxer or -vsync 2\n");
+   "Please consider specifying a lower 
framerate, a different muxer or"
+   "setting vsync or fps_mode to vfr\n");
  }
  
  enc_ctx->width  = av_buffersink_get_w(ost->filter->filter);

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7326193caf..69a368b8d1 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -176,6 +176,8 @@ typedef struct OptionsContext {
  intnb_qscale;
  SpecifierOpt *forced_key_frames;
  intnb_forced_key_frames;
+SpecifierOpt *fps_mode;
+intnb_fps_mode;
  SpecifierOpt *force_fps;
  intnb_force_fps;
  SpecifierOpt *frame_aspect_ratios;
@@ -489,6 +491,7 @@ typedef struct OutputStream {
  AVRational max_frame_rate;
  enum VideoSyncMethod vsync_method;
  int is_cfr;
+const char *fps_mode;
  int force_fps;
  int top_field_first;
  int rotate_overridden;
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 794d580635..a55fd18f8f 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -96,7 +96,7 @@ void of_write_packet(OutputFile *of, AVPacket *pkt, 
OutputStream *ost,
  return;
  }
  
-if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) ||

+if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method 
== VSYNC_DROP) ||
  (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method 
< 0))
  pkt->pts = pkt->dts = AV_NOPTS_VALUE;
  
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c

index 2c1b3bd0dd..0993985765 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -81,6 +81,7 @@ static const char *const opt_name_codec_tags[]= {"tag", 
"atag",
  static const char *const opt_name_sample_fmts[]   = 
{"sample_fmt", NULL};
  static const char *const opt_name_qscale[]= {"q", 
"qscale", NULL};
  static const char *const opt_name_forced_key_frames[] = 
{"forced_key_frames", NULL};
+static const char *const opt_name_fps_mode[]  = {"fps_mode", 
NULL};
  static const char *const opt_name_force_fps[] = {"force_fps", 
NULL};
  static const char *const opt_name_frame_aspect_ratios[]   = {"aspect", 
NULL};
  static const char *const opt_name_rc_overrides[]  =

Re: [FFmpeg-devel] FFmpeg 5.1

2022-06-09 Thread Neal Gompa
On Tue, Jun 7, 2022 at 7:35 AM Michael Niedermayer
 wrote:
>
> Hi all
>
> As was discussed previously the 5.1 release should be in june/july
> That means in the next weeks probably!
> If you know of any regressions, security issues or other major bugs,
> please help fixing them
>
> Also as was suggested before, this release will get the "LTS" tag
> unless people feel thats a bad idea of course
>

There were a few fixes we have in Fedora on top of 5.0 that would be
nice to have in upstream 5.1:

* http://ffmpeg.org/pipermail/ffmpeg-devel/2022-February/292877.html
* http://ffmpeg.org/pipermail/ffmpeg-devel/2022-February/292853.html
* http://ffmpeg.org/pipermail/ffmpeg-devel/2022-February/293194.html

Would it be possible to make sure these are in?


-- 
真実はいつも一つ!/ Always, there's only one truth!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] ffmpeg: add option fps_mode

2022-06-09 Thread Paul B Mahol
On Thu, Jun 9, 2022 at 8:06 PM Gyan Doshi  wrote:

> Plan to push in a day.
>

Is this a hack?

>
> On 2022-06-07 05:44 pm, Gyan Doshi wrote:
> > fps_mode sets video sync per output stream. Overrides vsync for matching
> > streams.
> > ---
> >   doc/ffmpeg.texi  |  8 +---
> >   fftools/ffmpeg.c |  9 +
> >   fftools/ffmpeg.h |  3 +++
> >   fftools/ffmpeg_mux.c |  2 +-
> >   fftools/ffmpeg_opt.c | 41 ++---
> >   5 files changed, 44 insertions(+), 19 deletions(-)
> >
> > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> > index 0d7e1a479d..395ddc34ba 100644
> > --- a/doc/ffmpeg.texi
> > +++ b/doc/ffmpeg.texi
> > @@ -1618,10 +1618,12 @@ it may cause packet loss.
> >   It is useful for when flow speed of output packets is important, such
> as live streaming.
> >   @item -re (@emph{input})
> >   Read input at native frame rate. This is equivalent to setting
> @code{-readrate 1}.
> > -@item -vsync @var{parameter}
> > -Video sync method.
> > +@item -vsync @var{parameter} (@emph{global})
> > +@itemx -fps_mode[:@var{stream_specifier}] @var{parameter}
> (@emph{output,per-stream})
> > +Set video sync method / framerate mode. vsync is applied to all output
> video streams
> > +but can be overridden for a stream by setting fps_mode.
> >
> > -For compatibility reasons some of the values can be specified as
> numbers (shown
> > +For compatibility reasons some of the values for vsync can be specified
> as numbers (shown
> >   in parentheses in the following table). This is deprecated and will
> stop working
> >   in the future.
> >
> > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> > index 5ed287c522..2922a1e707 100644
> > --- a/fftools/ffmpeg.c
> > +++ b/fftools/ffmpeg.c
> > @@ -3018,11 +3018,12 @@ static int
> init_output_stream_encode(OutputStream *ost, AVFrame *frame)
> >
> >   if (!(enc_ctx->time_base.num && enc_ctx->time_base.den))
> >   enc_ctx->time_base =
> av_buffersink_get_time_base(ost->filter->filter);
> > -if (   av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method
> != VSYNC_PASSTHROUGH
> > -   && (video_sync_method == VSYNC_CFR || video_sync_method ==
> VSYNC_VSCFR ||
> > -   (video_sync_method == VSYNC_AUTO && !(of->format->flags
> & AVFMT_VARIABLE_FPS{
> > +if (   av_q2d(enc_ctx->time_base) < 0.001 && ost->vsync_method
> != VSYNC_PASSTHROUGH
> > +   && (ost->vsync_method == VSYNC_CFR || ost->vsync_method ==
> VSYNC_VSCFR ||
> > +   (ost->vsync_method == VSYNC_AUTO && !(of->format->flags
> & AVFMT_VARIABLE_FPS{
> >   av_log(oc, AV_LOG_WARNING, "Frame rate very high for a
> muxer not efficiently supporting it.\n"
> > -   "Please consider specifying a
> lower framerate, a different muxer or -vsync 2\n");
> > +   "Please consider specifying a
> lower framerate, a different muxer or"
> > +   "setting vsync or fps_mode to
> vfr\n");
> >   }
> >
> >   enc_ctx->width  = av_buffersink_get_w(ost->filter->filter);
> > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
> > index 7326193caf..69a368b8d1 100644
> > --- a/fftools/ffmpeg.h
> > +++ b/fftools/ffmpeg.h
> > @@ -176,6 +176,8 @@ typedef struct OptionsContext {
> >   intnb_qscale;
> >   SpecifierOpt *forced_key_frames;
> >   intnb_forced_key_frames;
> > +SpecifierOpt *fps_mode;
> > +intnb_fps_mode;
> >   SpecifierOpt *force_fps;
> >   intnb_force_fps;
> >   SpecifierOpt *frame_aspect_ratios;
> > @@ -489,6 +491,7 @@ typedef struct OutputStream {
> >   AVRational max_frame_rate;
> >   enum VideoSyncMethod vsync_method;
> >   int is_cfr;
> > +const char *fps_mode;
> >   int force_fps;
> >   int top_field_first;
> >   int rotate_overridden;
> > diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
> > index 794d580635..a55fd18f8f 100644
> > --- a/fftools/ffmpeg_mux.c
> > +++ b/fftools/ffmpeg_mux.c
> > @@ -96,7 +96,7 @@ void of_write_packet(OutputFile *of, AVPacket *pkt,
> OutputStream *ost,
> >   return;
> >   }
> >
> > -if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
> video_sync_method == VSYNC_DROP) ||
> > +if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
> ost->vsync_method == VSYNC_DROP) ||
> >   (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
> audio_sync_method < 0))
> >   pkt->pts = pkt->dts = AV_NOPTS_VALUE;
> >
> > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> > index 2c1b3bd0dd..0993985765 100644
> > --- a/fftools/ffmpeg_opt.c
> > +++ b/fftools/ffmpeg_opt.c
> > @@ -81,6 +81,7 @@ static const char *const opt_name_codec_tags[]
> = {"tag", "atag",
> >   static const char *const opt_name_sample_fmts[]   =
> {"sample_fmt", NULL};
> >   static const char *const opt_name_qscale[]= {"q",

Re: [FFmpeg-devel] [PATCH v6] libx264: Set min build version to 158

2022-06-09 Thread Marton Balint




On Wed, 8 Jun 2022, Soft Works wrote:


-   { require libx264 "stdint.h x264.h"

x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&

- warn "using libx264 without pkg-config";

} } &&

x264 without pkg-config feature got removed. If this is intentonal,
then maybe you should mention this in the commit message?


I cannot honestly say that I would be sure about this part. Matt had
this removed in his original patch and objections were made about the version
requirement, but none about the removal of the "non-pkg-config" condition.

Would there be any reasons to keep it?


Probably not. Removing it is fine by me, but the removal should be 
stated in the commit message.







- require_cpp_condition libx264 x264.h

"X264_BUILD >= 118" &&

- check_cpp_condition libx262 x264.h

"X264_MPEG2"

Why is the x262 check got silently removed? This does not seem to belong
to this commit.`


Matt had removed it and there was a comment about it saying that it
would by dysfunctional for a long time already.

By a funny coincidence, Gyan has submitted a patch for complete removal
of this:

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20220527082922.994-1-ffm...@gyani.pro/

Whether it belongs into this patch or not could be seen from two sides:

On one side, you could say that THIS patch is about updating and adapting
the x264 conditions to the state of time, but you could also say that
it must rather be in Gyan's patch (which it is anyway).

Just let me know when you think I should change it.


I'd rather keep the X262 cpp check for now.

Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 3/5] avformat/asfdec_f: Check packet_frag_timestamp

2022-06-09 Thread Michael Niedermayer
On Mon, Mar 21, 2022 at 12:30:54AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -9223372036854775808 - 4607 cannot be 
> represented in type 'long'
> Fixes: 
> 45685/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5280102802391040
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/asfdec_f.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/5] avformat/bfi: Check offsets better

2022-06-09 Thread Michael Niedermayer
On Mon, Mar 21, 2022 at 12:30:55AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -2145378272 - 538976288 cannot be represented 
> in type 'int'
> Fixes: 
> 45690/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5015496544616448
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/bfi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 5/5] avformat/aviobuf: Check buf_size in ffio_ensure_seekback()

2022-06-09 Thread Michael Niedermayer
On Mon, Mar 21, 2022 at 12:30:56AM +0100, Michael Niedermayer wrote:
> buffer_size is an int
> 
> Fixes: signed integer overflow: 9223372036854775754 + 32767 cannot be 
> represented in type 'long'
> Fixes: 
> 45691/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5263458831040512
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/aviobuf.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] ffmpeg: document -d option

2022-06-09 Thread Marton Balint




On Fri, 8 Apr 2022, Stefano Sabatini wrote:


On date Wednesday 2022-04-06 16:43:02 +0200, Michael Niedermayer wrote:

On Tue, Apr 05, 2022 at 11:27:08PM +0200, Stefano Sabatini wrote:

On date Tuesday 2022-04-05 07:23:27 +0200, Anton Khirnov wrote:

Quoting Stefano Sabatini (2022-04-03 17:27:06)

Option was added in commit 39aafa5ee90e10382e.

Fix trac issue: http://trac.ffmpeg.org/ticket/1698
---
 doc/ffmpeg.texi  | 12 
 fftools/ffmpeg_opt.c |  3 +++
 2 files changed, 15 insertions(+)


Does this option do anything useful? Shouldn't it rather be removed?


Works for me.

Do we have a use case for this? This basically disables logs and
detaches ffmpeg from the terminal.

@Michael, can you comment about this (this was added by you)?


i have a few udp&tcp tests that used it but i tried now and they work fine
if i remove it so iam not aware of a current use case


Updated.



Will apply.

Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] lavf/avio: add avio_vprintf()

2022-06-09 Thread Marton Balint




On Sun, 3 Apr 2022, Stefano Sabatini wrote:


On date Wednesday 2021-04-21 23:53:35 +0200, Stefano Sabatini wrote:

On date Sunday 2021-04-18 23:30:57 +0200, Stefano Sabatini wrote:

This new function makes it possible to use avio_printf() functionality from
a function taking a variable list of arguments.
---
 doc/APIchanges|  3 +++
 libavformat/avio.h|  6 ++
 libavformat/aviobuf.c | 17 +
 libavformat/version.h |  2 +-
 4 files changed, 23 insertions(+), 5 deletions(-)


Updated against master.


Updated.



Will rebase and apply soon.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v13 4/4] fftools/cmdutils.c: Remove MAX_PATH limit

2022-06-09 Thread Nil Admirari
---
 fftools/cmdutils.c | 31 +--
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 5d7cdc3..d42bb04 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -50,6 +50,7 @@
 #include "opt_common.h"
 #ifdef _WIN32
 #include 
+#include "compat/w32dlfcn.h"
 #endif
 
 AVDictionary *sws_dict;
@@ -812,6 +813,9 @@ FILE *get_preset_file(char *filename, size_t filename_size,
 {
 FILE *f = NULL;
 int i;
+#if HAVE_GETMODULEHANDLE && defined(_WIN32)
+char *datadir = NULL;
+#endif
 const char *base[3] = { getenv("FFMPEG_DATADIR"),
 getenv("HOME"),
 FFMPEG_DATADIR, };
@@ -821,19 +825,31 @@ FILE *get_preset_file(char *filename, size_t 
filename_size,
 f = fopen(filename, "r");
 } else {
 #if HAVE_GETMODULEHANDLE && defined(_WIN32)
-char datadir[MAX_PATH], *ls;
+wchar_t *datadir_w = get_module_filename(NULL);
 base[2] = NULL;
 
-if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, 
sizeof(datadir) - 1))
+if (wchartoansi(datadir_w, &datadir))
+datadir = NULL;
+av_free(datadir_w);
+
+if (datadir)
 {
-for (ls = datadir; ls < datadir + strlen(datadir); ls++)
+char *ls;
+for (ls = datadir; *ls; ls++)
 if (*ls == '\\') *ls = '/';
 
 if (ls = strrchr(datadir, '/'))
 {
-*ls = 0;
-strncat(datadir, "/ffpresets",  sizeof(datadir) - 1 - 
strlen(datadir));
-base[2] = datadir;
+ptrdiff_t datadir_len = ls - datadir;
+size_t desired_size = datadir_len + strlen("/ffpresets") + 1;
+char *new_datadir = av_realloc_array(
+datadir, desired_size, sizeof *datadir);
+if (new_datadir) {
+datadir = new_datadir;
+datadir[datadir_len] = 0;
+strncat(datadir, "/ffpresets",  desired_size - 1 - 
datadir_len);
+base[2] = datadir;
+}
 }
 }
 #endif
@@ -853,6 +869,9 @@ FILE *get_preset_file(char *filename, size_t filename_size,
 }
 }
 
+#if HAVE_GETMODULEHANDLE && defined(_WIN32)
+av_free(datadir);
+#endif
 return f;
 }
 
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v13 3/4] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW

2022-06-09 Thread Nil Admirari
---
 compat/w32dlfcn.h | 80 +--
 1 file changed, 64 insertions(+), 16 deletions(-)

diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h
index 52a94ef..6b0dd7d 100644
--- a/compat/w32dlfcn.h
+++ b/compat/w32dlfcn.h
@@ -22,9 +22,31 @@
 #ifdef _WIN32
 #include 
 #include "config.h"
-#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT
 #include "libavutil/wchar_filename.h"
-#endif
+
+static inline wchar_t *get_module_filename(HMODULE module)
+{
+wchar_t *path = NULL, *new_path = NULL;
+DWORD path_size = 0, path_len = 0;
+
+do {
+path_size = path_size ? 2 * path_size : MAX_PATH;
+new_path = av_realloc_array(path, path_size, sizeof *path);
+if (!new_path) {
+av_free(path);
+return NULL;
+}
+path = new_path;
+path_len = GetModuleFileNameW(module, path, path_size);
+} while (path_len && path_size <= 32768 && path_size <= path_len);
+
+if (!path_len) {
+av_free(path);
+return NULL;
+}
+return path;
+}
+
 /**
  * Safe function used to open dynamic libs. This attempts to improve program 
security
  * by removing the current directory from the dll search path. Only dll's 
found in the
@@ -34,29 +56,53 @@
  */
 static inline HMODULE win32_dlopen(const char *name)
 {
+wchar_t *name_w = NULL;
+if (utf8towchar(name, &name_w))
+name_w = NULL;
 #if _WIN32_WINNT < 0x0602
 // Need to check if KB2533623 is available
 if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), 
"SetDefaultDllDirectories")) {
 HMODULE module = NULL;
-wchar_t *path = NULL, *name_w = NULL;
-DWORD pathlen;
-if (utf8towchar(name, &name_w))
+wchar_t *path = NULL, *new_path = NULL;
+DWORD pathlen, pathsize, namelen;
+if (!name_w)
 goto exit;
-path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t));
+namelen = wcslen(name_w);
 // Try local directory first
-pathlen = GetModuleFileNameW(NULL, path, MAX_PATH);
-pathlen = wcsrchr(path, '\\') - path;
-if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
+path = get_module_filename(NULL);
+if (!path)
 goto exit;
-path[pathlen] = '\\';
+new_path = wcsrchr(path, '\\');
+if (!new_path)
+goto exit;
+pathlen = new_path - path;
+pathsize = pathlen + namelen + 2;
+new_path = av_realloc_array(path, pathsize, sizeof *path);
+if (!new_path)
+goto exit;
+path = new_path;
 wcscpy(path + pathlen + 1, name_w);
 module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
 if (module == NULL) {
 // Next try System32 directory
-pathlen = GetSystemDirectoryW(path, MAX_PATH);
-if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
+pathlen = GetSystemDirectoryW(path, pathsize);
+if (!pathlen)
 goto exit;
-path[pathlen] = '\\';
+// Buffer is not enough in two cases:
+// 1. system directory + \ + module name
+// 2. system directory even without module name.
+if (pathlen + namelen + 2 > pathsize) {
+pathsize = pathlen + namelen + 2;
+new_path = av_realloc_array(path, pathsize, sizeof *path);
+if (!new_path)
+goto exit;
+path = new_path;
+// Query again to handle case #2.
+pathlen = GetSystemDirectoryW(path, pathsize);
+if (!pathlen)
+goto exit;
+}
+path[pathlen] = L'\\';
 wcscpy(path + pathlen + 1, name_w);
 module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
 }
@@ -73,15 +119,17 @@ exit:
 #   define LOAD_LIBRARY_SEARCH_SYSTEM320x0800
 #endif
 #if HAVE_WINRT
-wchar_t *name_w = NULL;
 int ret;
-if (utf8towchar(name, &name_w))
+if (!name_w)
 return NULL;
 ret = LoadPackagedLibrary(name_w, 0);
 av_free(name_w);
 return ret;
 #else
-return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | 
LOAD_LIBRARY_SEARCH_SYSTEM32);
+/* filename may be be in CP_ACP */
+if (!name_w)
+return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR 
| LOAD_LIBRARY_SEARCH_SYSTEM32);
+return LoadLibraryExW(name_w, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | 
LOAD_LIBRARY_SEARCH_SYSTEM32);
 #endif
 }
 #define dlopen(name, flags) win32_dlopen(name)
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v13 2/4] libavformat/avisynth.c: Remove MAX_PATH limit

2022-06-09 Thread Nil Admirari
---
 libavformat/avisynth.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 8ba2bde..f7bea8c 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -34,6 +34,7 @@
 /* Platform-specific directives. */
 #ifdef _WIN32
   #include "compat/w32dlfcn.h"
+  #include "libavutil/wchar_filename.h"
   #undef EXTERN_C
   #define AVISYNTH_LIB "avisynth"
 #else
@@ -810,8 +811,7 @@ static int avisynth_open_file(AVFormatContext *s)
 AVS_Value arg, val;
 int ret;
 #ifdef _WIN32
-char filename_ansi[MAX_PATH * 4];
-wchar_t filename_wc[MAX_PATH * 4];
+char *filename_ansi = NULL;
 #endif
 
 if (ret = avisynth_context_create(s))
@@ -819,10 +819,12 @@ static int avisynth_open_file(AVFormatContext *s)
 
 #ifdef _WIN32
 /* Convert UTF-8 to ANSI code page */
-MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4);
-WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi,
-MAX_PATH * 4, NULL, NULL);
+if (utf8toansi(s->url, &filename_ansi)) {
+ret = AVERROR_UNKNOWN;
+goto fail;
+}
 arg = avs_new_value_string(filename_ansi);
+av_free(filename_ansi);
 #else
 arg = avs_new_value_string(s->url);
 #endif
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v13 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Nil Admirari
These functions are going to be used in libavformat/avisynth.c
and fftools/cmdutils.c to remove MAX_PATH limit.
---
 libavutil/wchar_filename.h | 51 ++
 1 file changed, 51 insertions(+)

diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index f36d9df..90f6a53 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -41,6 +41,57 @@ static inline int utf8towchar(const char *filename_utf8, 
wchar_t **filename_w)
 return 0;
 }
 
+av_warn_unused_result
+static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w,
+char **filename)
+{
+DWORD flags = code_page == CP_UTF8 ? MB_ERR_INVALID_CHARS : 0;
+int num_chars = WideCharToMultiByte(code_page, flags, filename_w, -1,
+NULL, 0, NULL, NULL);
+if (num_chars <= 0) {
+*filename = NULL;
+return 0;
+}
+*filename = av_calloc(num_chars, sizeof(char));
+if (!*filename) {
+errno = ENOMEM;
+return -1;
+}
+WideCharToMultiByte(code_page, flags, filename_w, -1,
+*filename, num_chars, NULL, NULL);
+return 0;
+}
+
+av_warn_unused_result
+static inline int wchartoutf8(const wchar_t *filename_w, char **filename)
+{
+return wchartocp(CP_UTF8, filename_w, filename);
+}
+
+av_warn_unused_result
+static inline int wchartoansi(const wchar_t *filename_w, char **filename)
+{
+return wchartocp(CP_ACP, filename_w, filename);
+}
+
+av_warn_unused_result
+static inline int utf8toansi(const char *filename_utf8, char **filename)
+{
+wchar_t *filename_w = NULL;
+int ret = -1;
+if (utf8towchar(filename_utf8, &filename_w))
+return -1;
+
+if (!filename_w) {
+*filename = NULL;
+return 0;
+}
+
+ret = wchartoansi(filename_w, filename);
+av_free(filename_w);
+return ret;
+}
+
 /**
  * Checks for extended path prefixes for which normalization needs to be 
skipped.
  * see .NET6: PathInternal.IsExtended()
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/2] ffprobe: add -o option

2022-06-09 Thread Marton Balint




On Sun, 3 Apr 2022, Stefano Sabatini wrote:


On date Wednesday 2021-04-21 23:57:04 +0200, Stefano Sabatini wrote:

On date Monday 2021-04-19 11:26:49 +0200, Michael Niedermayer wrote:

On Sun, Apr 18, 2021 at 11:30:58PM +0200, Stefano Sabatini wrote:

This enables printing to a resource specified with -o OUTPUT.

Address issue: http://trac.ffmpeg.org/ticket/8024
---
 doc/ffprobe.texi  |   7 ++
 fftools/ffprobe.c | 174 ++
 2 files changed, 120 insertions(+), 61 deletions(-)


This seems breaking some fate tests like fate-gaplessenc-itunes-to-ipod-aac

I see 0 bytes in the output:
  73 3D 4B 44  00 73 69 64  65 5F 64 61  74 61 7C 0A  0A

thx


That's right, I'm still forgetting to run make fate :-)
(avio_put_str() was adding the 0), should be fixed now.

Thanks.


Updated again, now it's locally passing fate with FATE samples (don't
remember if other issues were spotted the past time).


This looks good to me in general, so I intend to apply. One thing that we 
might do is to keep writing to the standard output if no output file is 
specified instead of using the special "pipe:" URL. This way ffprobe 
keeps working even if the pipe protocol is not compiled into 
ffmpeg/libavformat.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Martin Storsjö

On Thu, 9 Jun 2022, Soft Works wrote:





-Original Message-
From: ffmpeg-devel  On Behalf Of Martin
Storsjö
Sent: Thursday, June 9, 2022 12:10 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add
whcartoutf8, wchartoansi and utf8toansi

On Sun, 5 Jun 2022, Nil Admirari wrote:


These functions are going to be used in libavformat/avisynth.c
and fftools/cmdutils.c to remove MAX_PATH limit.
---
libavutil/wchar_filename.h | 51 ++
1 file changed, 51 insertions(+)


This patchset looks good to me too, thanks! If there's no more comments on
it, I'll push it later.


I missed to take another look at it.

I'm wondering why it converts wchar back to ansi instead of utf8 in 4/4 and
whether it won't fail then, when a path contains non-ANSI chars.


Yes, that's a preexisting problem there. That patch gets rid of the fixed 
path lengths without touching the rest of the charset handling there.


There's paths from two sources; getenv() and from GetModuleFileName(). 
These are passed to plain fopen() (which uses ANSI filenames).


To make it entirely unicode compliant, we'd need to replace getenv() with 
a wrapper that uses _wgetenv() and converts that to utf8, then convert the 
GetModuleFileName() output to utf8 too, and switch the fopen() to 
fopen_utf8.


So the patch in itself is fine - it fixes one aspect, and doesn't make the 
other aspect worse.


// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] ffmpeg: add option fps_mode

2022-06-09 Thread Gyan Doshi




On 2022-06-10 12:14 am, Paul B Mahol wrote:

On Thu, Jun 9, 2022 at 8:06 PM Gyan Doshi  wrote:


Plan to push in a day.


Is this a hack?


No.





On 2022-06-07 05:44 pm, Gyan Doshi wrote:

fps_mode sets video sync per output stream. Overrides vsync for matching
streams.
---
   doc/ffmpeg.texi  |  8 +---
   fftools/ffmpeg.c |  9 +
   fftools/ffmpeg.h |  3 +++
   fftools/ffmpeg_mux.c |  2 +-
   fftools/ffmpeg_opt.c | 41 ++---
   5 files changed, 44 insertions(+), 19 deletions(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 0d7e1a479d..395ddc34ba 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1618,10 +1618,12 @@ it may cause packet loss.
   It is useful for when flow speed of output packets is important, such

as live streaming.

   @item -re (@emph{input})
   Read input at native frame rate. This is equivalent to setting

@code{-readrate 1}.

-@item -vsync @var{parameter}
-Video sync method.
+@item -vsync @var{parameter} (@emph{global})
+@itemx -fps_mode[:@var{stream_specifier}] @var{parameter}

(@emph{output,per-stream})

+Set video sync method / framerate mode. vsync is applied to all output

video streams

+but can be overridden for a stream by setting fps_mode.

-For compatibility reasons some of the values can be specified as

numbers (shown

+For compatibility reasons some of the values for vsync can be specified

as numbers (shown

   in parentheses in the following table). This is deprecated and will

stop working

   in the future.

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 5ed287c522..2922a1e707 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3018,11 +3018,12 @@ static int

init_output_stream_encode(OutputStream *ost, AVFrame *frame)

   if (!(enc_ctx->time_base.num && enc_ctx->time_base.den))
   enc_ctx->time_base =

av_buffersink_get_time_base(ost->filter->filter);

-if (   av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method

!= VSYNC_PASSTHROUGH

-   && (video_sync_method == VSYNC_CFR || video_sync_method ==

VSYNC_VSCFR ||

-   (video_sync_method == VSYNC_AUTO && !(of->format->flags

& AVFMT_VARIABLE_FPS{

+if (   av_q2d(enc_ctx->time_base) < 0.001 && ost->vsync_method

!= VSYNC_PASSTHROUGH

+   && (ost->vsync_method == VSYNC_CFR || ost->vsync_method ==

VSYNC_VSCFR ||

+   (ost->vsync_method == VSYNC_AUTO && !(of->format->flags

& AVFMT_VARIABLE_FPS{

   av_log(oc, AV_LOG_WARNING, "Frame rate very high for a

muxer not efficiently supporting it.\n"

-   "Please consider specifying a

lower framerate, a different muxer or -vsync 2\n");

+   "Please consider specifying a

lower framerate, a different muxer or"

+   "setting vsync or fps_mode to

vfr\n");

   }

   enc_ctx->width  = av_buffersink_get_w(ost->filter->filter);
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7326193caf..69a368b8d1 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -176,6 +176,8 @@ typedef struct OptionsContext {
   intnb_qscale;
   SpecifierOpt *forced_key_frames;
   intnb_forced_key_frames;
+SpecifierOpt *fps_mode;
+intnb_fps_mode;
   SpecifierOpt *force_fps;
   intnb_force_fps;
   SpecifierOpt *frame_aspect_ratios;
@@ -489,6 +491,7 @@ typedef struct OutputStream {
   AVRational max_frame_rate;
   enum VideoSyncMethod vsync_method;
   int is_cfr;
+const char *fps_mode;
   int force_fps;
   int top_field_first;
   int rotate_overridden;
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 794d580635..a55fd18f8f 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -96,7 +96,7 @@ void of_write_packet(OutputFile *of, AVPacket *pkt,

OutputStream *ost,

   return;
   }

-if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&

video_sync_method == VSYNC_DROP) ||

+if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&

ost->vsync_method == VSYNC_DROP) ||

   (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&

audio_sync_method < 0))

   pkt->pts = pkt->dts = AV_NOPTS_VALUE;

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 2c1b3bd0dd..0993985765 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -81,6 +81,7 @@ static const char *const opt_name_codec_tags[]

 = {"tag", "atag",

   static const char *const opt_name_sample_fmts[]   =

{"sample_fmt", NULL};

   static const char *const opt_name_qscale[]= {"q",

"qscale", NULL};

   static const char *const opt_name_forced_key_frames[] =

{"forced_key_frames", NULL};

+static const char *const opt_name_fps_mode[]  =

{"fps_mode", NULL};

   static const char *const opt_name_force_fps[] =

{

Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread nil-admirari
>> I'm wondering why it converts wchar back to ansi instead of utf8 in 4/4 and
>> whether it won't fail then, when a path contains non-ANSI chars.
>
> Yes, that's a preexisting problem there. That patch gets rid of the fixed 
> path lengths without touching the rest of the charset handling there.
>
> There's paths from two sources; getenv() and from GetModuleFileName(). 
> These are passed to plain fopen() (which uses ANSI filenames).
>
> To make it entirely unicode compliant, we'd need to replace getenv() with 
> a wrapper that uses _wgetenv() and converts that to utf8, then convert the 
> GetModuleFileName() output to utf8 too, and switch the fopen() to 
> fopen_utf8.

Actually utf8toansi() was created for AviSynth, which doesn't have a Unicode 
API.

getenv() and plain fopen() are used in cmdutils.c, which is the only file that
haven't transitioned to avpriv_fopen_utf8() yet, but utf8toansi() is not used 
in cmdutils.c.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v6] libx264: Set min build version to 158

2022-06-09 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Marton
> Balint
> Sent: Thursday, June 9, 2022 8:44 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v6] libx264: Set min build version to 158
> 
> 
> 
> On Wed, 8 Jun 2022, Soft Works wrote:
> 
> >>> -   { require libx264 "stdint.h x264.h"
> >> x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
> >>> - warn "using libx264 without pkg-
> config";
> >> } } &&
> >>
> >> x264 without pkg-config feature got removed. If this is intentonal,
> >> then maybe you should mention this in the commit message?
> >
> > I cannot honestly say that I would be sure about this part. Matt had
> > this removed in his original patch and objections were made about the
> version
> > requirement, but none about the removal of the "non-pkg-config" condition.
> >
> > Would there be any reasons to keep it?
> 
> Probably not. Removing it is fine by me, but the removal should be
> stated in the commit message.

Yup. Done.



> >>> - require_cpp_condition libx264 x264.h
> >> "X264_BUILD >= 118" &&
> >>> - check_cpp_condition libx262 x264.h
> >> "X264_MPEG2"
> >>
> >> Why is the x262 check got silently removed? This does not seem to belong
> >> to this commit.`
> >
> > Matt had removed it and there was a comment about it saying that it
> > would by dysfunctional for a long time already.
> >
> > By a funny coincidence, Gyan has submitted a patch for complete removal
> > of this:
> >
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20220527082922.994-1-
> ffm...@gyani.pro/
> >
> > Whether it belongs into this patch or not could be seen from two sides:
> >
> > On one side, you could say that THIS patch is about updating and adapting
> > the x264 conditions to the state of time, but you could also say that
> > it must rather be in Gyan's patch (which it is anyway).
> >
> > Just let me know when you think I should change it.
> 
> I'd rather keep the X262 cpp check for now.

Ok agreed. The situation is not fully clear to me after re-reading Kieran's 
response to Gyan's patch.

Thanks,
sw 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread nil-admirari
> This looks fine to me, and the discussion seems to have converged, so I'll 
> go ahead and push this.

Build is now failing: 
https://github.com/yt-dlp/FFmpeg-Builds/runs/6819319105?check_suite_focus=true.

In file included from 
/opt/ct-ng/i686-w64-mingw32/sysroot/mingw/include/dshow.h:33,
 from libavcodec/mf_utils.h:32,
 from libavcodec/mfenc.c:26:
./libavutil/wchar_filename.h: In function 'add_extended_prefix':
./libavutil/wchar_filename.h:211:9: error: 
'wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW' undeclared (first use in 
this function)
  211 | wcscpy(temp_w, unc_prefix);
  | ^~
./libavutil/wchar_filename.h:211:9: note: each undeclared identifier is 
reported only once for each function it appears in

wchar.h is indeed not included in wchar_filename.h.



Incompatible pointer types warning is still there as well:

In file included from ./libavformat/internal.h:30,
 from libavdevice/alldevices.c:21:
./libavformat/os_support.h: In function 'win32_stat':
./libavformat/os_support.h:241:36: warning: passing argument 2 of '_wstat64' 
from incompatible pointer type [-Wincompatible-pointer-types]
  241 | ret = _wstat64(filename_w, &crtstat);
  |^~~~
  ||
  |struct _stati64 *
In file included from ./libavformat/os_support.h:32,
 from ./libavformat/internal.h:30,
 from libavdevice/alldevices.c:21:
/opt/ct-ng/i686-w64-mingw32/sysroot/mingw/include/sys/stat.h:129:69: note: 
expected 'struct _stat64 *' but argument is of type 'struct _stati64 *'
  129 |   _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 
*_Stat);
  | 
^





___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Soft Works


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Martin
> Storsjö
> Sent: Thursday, June 9, 2022 9:09 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add
> whcartoutf8, wchartoansi and utf8toansi
> 
> On Thu, 9 Jun 2022, Soft Works wrote:
> 
> >
> >
> >> -Original Message-
> >> From: ffmpeg-devel  On Behalf Of Martin
> >> Storsjö
> >> Sent: Thursday, June 9, 2022 12:10 PM
> >> To: FFmpeg development discussions and patches 
> >> Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h:
> Add
> >> whcartoutf8, wchartoansi and utf8toansi
> >>
> >> On Sun, 5 Jun 2022, Nil Admirari wrote:
> >>
> >>> These functions are going to be used in libavformat/avisynth.c
> >>> and fftools/cmdutils.c to remove MAX_PATH limit.
> >>> ---
> >>> libavutil/wchar_filename.h | 51 ++
> >>> 1 file changed, 51 insertions(+)
> >>
> >> This patchset looks good to me too, thanks! If there's no more comments on
> >> it, I'll push it later.
> >
> > I missed to take another look at it.
> >
> > I'm wondering why it converts wchar back to ansi instead of utf8 in 4/4 and
> > whether it won't fail then, when a path contains non-ANSI chars.
> 
> Yes, that's a preexisting problem there. That patch gets rid of the fixed
> path lengths without touching the rest of the charset handling there.
> 
> There's paths from two sources; getenv() and from GetModuleFileName().
> These are passed to plain fopen() (which uses ANSI filenames).

What I meant is the use of wchartoansi() in patch 4/4.

The current code calls GetModuleFileNameA()
the new code calls GetModuleFileNameW() and then converts the output
file name with wchartoansi().

Can we be sure that this is always the same? 
Especially when the path contains non-ANSI chars?





That's something quite different. GetModuleFileNameA() will return a 
valid and usable path (but it could be an 8.3 path or have some 
replacement chars)

Same applies to GetModuleFileNameW()
when using the wchar output - but not when using a string conversion to
an Ansi string.

> > So the patch in itself is fine - it fixes one aspect, and doesn't make the
> other aspect worse.

Wouldn't it make it worse in the case above?


Thanks,
sw


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] Unsubscribe

2022-06-09 Thread Ewa Bzdęga
Please, unsubscribe me from the mailing list
thank you

-- 
*Ewa Bzdęga*

*kom. +34 692 417 503*



Wolny
od wirusów. www.avg.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of nil-
> admir...@mailo.com
> Sent: Thursday, June 9, 2022 9:37 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows
> 
> > This looks fine to me, and the discussion seems to have converged, so I'll
> > go ahead and push this.
> 
> Build is now failing: https://github.com/yt-dlp/FFmpeg-
> Builds/runs/6819319105?check_suite_focus=true.
> 
> In file included from /opt/ct-ng/i686-w64-
> mingw32/sysroot/mingw/include/dshow.h:33,
>  from libavcodec/mf_utils.h:32,
>  from libavcodec/mfenc.c:26:
> ./libavutil/wchar_filename.h: In function 'add_extended_prefix':
> ./libavutil/wchar_filename.h:211:9: error:
> 'wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW' undeclared (first use in
> this function)
>   211 | wcscpy(temp_w, unc_prefix);
>   | ^~
> ./libavutil/wchar_filename.h:211:9: note: each undeclared identifier is
> reported only once for each function it appears in
> 
> wchar.h is indeed not included in wchar_filename.h.

wcscpy is defined in corecrt_wstring.h, included in string.h, 
included in winnt.h included in windef.h, included in windows.h


> Incompatible pointer types warning is still there as well:
> 
> In file included from ./libavformat/internal.h:30,
>  from libavdevice/alldevices.c:21:
> ./libavformat/os_support.h: In function 'win32_stat':
> ./libavformat/os_support.h:241:36: warning: passing argument 2 of '_wstat64'
> from incompatible pointer type [-Wincompatible-pointer-types]
>   241 | ret = _wstat64(filename_w, &crtstat);
>   |^~~~
>   ||
>   |struct _stati64 *
> In file included from ./libavformat/os_support.h:32,
>  from ./libavformat/internal.h:30,
>  from libavdevice/alldevices.c:21:
> /opt/ct-ng/i686-w64-mingw32/sysroot/mingw/include/sys/stat.h:129:69: note:
> expected 'struct _stat64 *' but argument is of type 'struct _stati64 *'
>   129 |   _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64
> *_Stat);
>   |
> ^

Yea, right. We need to get rid of the 'i' in the struct
types for getting fully independent of USE_32BIT_TIME_T.

Will send an update in a minute.

Thanks for reporting.

sw
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread Martin Storsjö

On Thu, 9 Jun 2022, nil-admir...@mailo.com wrote:


This looks fine to me, and the discussion seems to have converged, so I'll
go ahead and push this.


Build is now failing: 
https://github.com/yt-dlp/FFmpeg-Builds/runs/6819319105?check_suite_focus=true.

In file included from 
/opt/ct-ng/i686-w64-mingw32/sysroot/mingw/include/dshow.h:33,
from libavcodec/mf_utils.h:32,
from libavcodec/mfenc.c:26:
./libavutil/wchar_filename.h: In function 'add_extended_prefix':
./libavutil/wchar_filename.h:211:9: error: 
'wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW' undeclared (first use in 
this function)
 211 | wcscpy(temp_w, unc_prefix);
 | ^~
./libavutil/wchar_filename.h:211:9: note: each undeclared identifier is 
reported only once for each function it appears in


This error isn't reproducible in git master - it's triggered by your 
yet-unmerged patches (that include wchar_filename.h in w32dlfcn.h).



Incompatible pointer types warning is still there as well:

In file included from ./libavformat/internal.h:30,
from libavdevice/alldevices.c:21:
./libavformat/os_support.h: In function 'win32_stat':
./libavformat/os_support.h:241:36: warning: passing argument 2 of '_wstat64' 
from incompatible pointer type [-Wincompatible-pointer-types]
 241 | ret = _wstat64(filename_w, &crtstat);
 |^~~~
 ||
 |struct _stati64 *
In file included from ./libavformat/os_support.h:32,
from ./libavformat/internal.h:30,
from libavdevice/alldevices.c:21:
/opt/ct-ng/i686-w64-mingw32/sysroot/mingw/include/sys/stat.h:129:69: note: 
expected 'struct _stat64 *' but argument is of type 'struct _stati64 *'
 129 |   _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 
*_Stat);
 | ^


This I can indeed reproduce now. I did build these patches in a couple 
other environments (both mingw and msvc) where those warnings didn't 
appear, but now I managed to find one that shows those warnings.


// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread nil-admirari
> wcscpy is defined in corecrt_wstring.h, included in string.h, 
> included in winnt.h included in windef.h, included in windows.h

Not so easy, it's the same as https://trac.ffmpeg.org/ticket/999:

> In file included from /opt/ct-ng/i686-w64-
> mingw32/sysroot/mingw/include/dshow.h:33

NO_DSHOW_STRSAFE must be defined somewhere.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Martin Storsjö

On Thu, 9 Jun 2022, Soft Works wrote:


-Original Message-
From: ffmpeg-devel  On Behalf Of Martin
Storsjö
Sent: Thursday, June 9, 2022 9:09 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add
whcartoutf8, wchartoansi and utf8toansi

On Thu, 9 Jun 2022, Soft Works wrote:





-Original Message-
From: ffmpeg-devel  On Behalf Of Martin
Storsjö
Sent: Thursday, June 9, 2022 12:10 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h:

Add

whcartoutf8, wchartoansi and utf8toansi

On Sun, 5 Jun 2022, Nil Admirari wrote:


These functions are going to be used in libavformat/avisynth.c
and fftools/cmdutils.c to remove MAX_PATH limit.
---
libavutil/wchar_filename.h | 51 ++
1 file changed, 51 insertions(+)


This patchset looks good to me too, thanks! If there's no more comments on
it, I'll push it later.


I missed to take another look at it.

I'm wondering why it converts wchar back to ansi instead of utf8 in 4/4 and
whether it won't fail then, when a path contains non-ANSI chars.


Yes, that's a preexisting problem there. That patch gets rid of the fixed
path lengths without touching the rest of the charset handling there.

There's paths from two sources; getenv() and from GetModuleFileName().
These are passed to plain fopen() (which uses ANSI filenames).


What I meant is the use of wchartoansi() in patch 4/4.

The current code calls GetModuleFileNameA()
the new code calls GetModuleFileNameW() and then converts the output
file name with wchartoansi().

Can we be sure that this is always the same?
Especially when the path contains non-ANSI chars?

That's something quite different. GetModuleFileNameA() will return a
valid and usable path (but it could be an 8.3 path or have some
replacement chars)


Right, I wasn't aware that the -A version would return a 
guaranteed-ansi-compatible version of the filename. If that's really the 
case, this patch would indeed be a minor step backwards.


// Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread nil-admirari
> This error isn't reproducible in git master - it's triggered by your 
> yet-unmerged patches (that include wchar_filename.h in w32dlfcn.h).

Ok. It can be fixed by either
- defining NO_DSHOW_STRSAFE in libavcodec/mf_utils.h
- or by migrating os_support.h to StrSafe.h functions.

Which way is preferable?



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread Martin Storsjö

On Thu, 9 Jun 2022, nil-admir...@mailo.com wrote:


This error isn't reproducible in git master - it's triggered by your
yet-unmerged patches (that include wchar_filename.h in w32dlfcn.h).


Ok. It can be fixed by either
- defining NO_DSHOW_STRSAFE in libavcodec/mf_utils.h
- or by migrating os_support.h to StrSafe.h functions.

Which way is preferable?


I think avoiding wcscat (with whatever usable alternative, not necessarily 
from strsafe.h) is the more robust solution, instead of having to play 
whack-a-mole with silencing such warnings. The 10 year old trac you 
referenced mentioned that the strsafe.h alternative functions weren't 
available in all toolchains used at that time though.


Or if we'd add the define projectwide in e.g. configure it probably 
wouldn't be that bad? Kinda like how we already add 
"-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS" in MSVC builds. 
Then we wouldn't need to worry about missing it somewhere accidentally.


// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of nil-
> admir...@mailo.com
> Sent: Thursday, June 9, 2022 10:58 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows
> 
> > This error isn't reproducible in git master - it's triggered by your
> > yet-unmerged patches (that include wchar_filename.h in w32dlfcn.h).
> 
> Ok. It can be fixed by either
> - defining NO_DSHOW_STRSAFE in libavcodec/mf_utils.h
> - or by migrating os_support.h to StrSafe.h functions.
> 
> Which way is preferable?

I think the def is at least better for an instant fix.
Also, nowhere in ffmpeg are those "secure" functions being used, so it
aligns to current practice.

sw
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread nil-admirari
> Right, I wasn't aware that the -A version would return a 
> guaranteed-ansi-compatible version of the filename. If that's really the 
> case, this patch would indeed be a minor step backwards.

Two options are available:
1. fopen() is replaced with avpriv_fopen_utf8(), getenv() is made Unicode-aware
on Windows, and wide version of get_module_filename() is used as it is now.
2. A wrapper around GetModuleFilenameA() created specifically for this case,
only to be replaced later by option one, when avpriv_fopen_utf8() gets 
merged.

If option one is chosen, the patch will have to wait for avpriv_fopen_utf8() 
patches.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v12 1/4] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-06-09 Thread Martin Storsjö

On Thu, 9 Jun 2022, nil-admir...@mailo.com wrote:


Right, I wasn't aware that the -A version would return a
guaranteed-ansi-compatible version of the filename. If that's really the
case, this patch would indeed be a minor step backwards.


Two options are available:
1. fopen() is replaced with avpriv_fopen_utf8(), getenv() is made Unicode-aware
   on Windows, and wide version of get_module_filename() is used as it is now.
2. A wrapper around GetModuleFilenameA() created specifically for this case,
   only to be replaced later by option one, when avpriv_fopen_utf8() gets 
merged.

If option one is chosen, the patch will have to wait for avpriv_fopen_utf8() 
patches.


For that, the first option sounds better - that sounds to me more like a 
direction forward, not backwards.


The patches for *_fopen_utf8 have already been merged - within the 
libraries, you can use avpriv_fopen_utf8, and fftools has got a separate 
"fopen_utf8" function it can use.


// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-06-09 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Soft Works
> Sent: Thursday, June 9, 2022 10:16 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of nil-
> > admir...@mailo.com
> > Sent: Thursday, June 9, 2022 9:37 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v8 0/3] Support long file names on
> Windows
> >
> > > This looks fine to me, and the discussion seems to have converged, so
> I'll
> > > go ahead and push this.
> >
> > Build is now failing: https://github.com/yt-dlp/FFmpeg-
> > Builds/runs/6819319105?check_suite_focus=true.
> >
> > In file included from /opt/ct-ng/i686-w64-
> > mingw32/sysroot/mingw/include/dshow.h:33,
> >  from libavcodec/mf_utils.h:32,
> >  from libavcodec/mfenc.c:26:
> > ./libavutil/wchar_filename.h: In function 'add_extended_prefix':
> > ./libavutil/wchar_filename.h:211:9: error:
> > 'wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW' undeclared (first use
> in
> > this function)
> >   211 | wcscpy(temp_w, unc_prefix);
> >   | ^~
> > ./libavutil/wchar_filename.h:211:9: note: each undeclared identifier is
> > reported only once for each function it appears in
> >
> > wchar.h is indeed not included in wchar_filename.h.
> 
> wcscpy is defined in corecrt_wstring.h, included in string.h,
> included in winnt.h included in windef.h, included in windows.h
> 
> 
> > Incompatible pointer types warning is still there as well:
> >
> > In file included from ./libavformat/internal.h:30,
> >  from libavdevice/alldevices.c:21:
> > ./libavformat/os_support.h: In function 'win32_stat':
> > ./libavformat/os_support.h:241:36: warning: passing argument 2 of
> '_wstat64'
> > from incompatible pointer type [-Wincompatible-pointer-types]
> >   241 | ret = _wstat64(filename_w, &crtstat);
> >   |^~~~
> >   ||
> >   |struct _stati64 *
> > In file included from ./libavformat/os_support.h:32,
> >  from ./libavformat/internal.h:30,
> >  from libavdevice/alldevices.c:21:
> > /opt/ct-ng/i686-w64-mingw32/sysroot/mingw/include/sys/stat.h:129:69: note:
> > expected 'struct _stat64 *' but argument is of type 'struct _stati64 *'
> >   129 |   _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64
> > *_Stat);
> >   |
> > ^
> 
> Yea, right. We need to get rid of the 'i' in the struct
> types for getting fully independent of USE_32BIT_TIME_T.
> 
> Will send an update in a minute.

Here's a patch for this part:

https://github.com/ffstaging/FFmpeg/pull/34

https://github.com/ffstaging/FFmpeg/pull/34.patch

Can't send it right now because Google decided to no longer
username/password login (which affects ffmpegagent). It's
said to work with an "app password" which in turn can only
be used when 2step verification is set up, and that again
requires either a phone or a security key :-(

Does anybody know a "security key" emulator.

softworkz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/3] avcodec/jpeglsdec: fix end check for xfrm

2022-06-09 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
47871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMV_fuzzer-5646305956855808

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/jpeglsdec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 399837cf2f..ab663dc1fc 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -484,19 +484,19 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int 
near,
 for (i = 0; i < s->height; i++) {
 switch(s->xfrm) {
 case 1:
-for (x = off; x < w; x += 3) {
+for (x = off; x + 2 < w; x += 3) {
 src[x  ] += src[x+1] + 128;
 src[x+2] += src[x+1] + 128;
 }
 break;
 case 2:
-for (x = off; x < w; x += 3) {
+for (x = off; x + 2 < w; x += 3) {
 src[x  ] += src[x+1] + 128;
 src[x+2] += ((src[x  ] + src[x+1])>>1) + 128;
 }
 break;
 case 3:
-for (x = off; x < w; x += 3) {
+for (x = off; x + 2 < w; x += 3) {
 int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
 src[x+0] = src[x+2] + g + 128;
 src[x+2] = src[x+1] + g + 128;
@@ -504,7 +504,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int 
near,
 }
 break;
 case 4:
-for (x = off; x < w; x += 3) {
+for (x = off; x + 2 < w; x += 3) {
 int r= src[x+0] - ((   359 * 
(src[x+2]-128) + 490) >> 8);
 int g= src[x+0] - (( 88 * (src[x+1]-128) - 183 * 
(src[x+2]-128) +  30) >> 8);
 int b= src[x+0] + ((454 * (src[x+1]-128)   
 + 574) >> 8);
-- 
2.17.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/3] avcodec/cdgraphics: limit scrolling to the line

2022-06-09 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
47877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5690504626438144

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/cdgraphics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index b851ec430b..73654019e6 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -240,7 +240,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
 for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, 
CDG_FULL_HEIGHT); y++)
 memcpy(out + FFMAX(0, hinc) + stride * y,
in + FFMAX(0, hinc) - hinc + (y - vinc) * stride,
-   FFMIN(stride + hinc, stride));
+   FFABS(stride) - FFABS(hinc));
 
 if (vinc > 0)
 cdg_fill_wrapper(0, 0, out,
-- 
2.17.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/3] avcodec/hevcdsp_template: stay within tables in sao_band_filter()

2022-06-09 Thread Michael Niedermayer
Fixes: out of array read
Fixes: 
47875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5719393113341952

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/hevcdsp_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index 56cd9e605d..61425975cd 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -313,7 +313,7 @@ static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t 
*_src,
 offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
 for (y = 0; y < height; y++) {
 for (x = 0; x < width; x++)
-dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
+dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 
31]);
 dst += stride_dst;
 src += stride_src;
 }
-- 
2.17.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] libRIST: allow setting fifo size and fail on overflow.

2022-06-09 Thread Marton Balint




On Tue, 1 Feb 2022, Marton Balint wrote:




On Tue, 11 Jan 2022, Gijs Peskens wrote:


 Introduce fifo_size and overrun_nonfatal params to configure fifo buffer
 behavior.

 Use newly introduced RIST_DATA_FLAGS_OVERFLOW flag to check for overrun
 and error out in that case.
 ---
 doc/protocols.texi|  9 +
 libavformat/librist.c | 37 +
 2 files changed, 46 insertions(+)


Applied with some fixes.

Regards,
Marton



 diff --git a/doc/protocols.texi b/doc/protocols.texi
 index d207df0b52..f1acf0cc77 100644
 --- a/doc/protocols.texi
 +++ b/doc/protocols.texi
@@  -745,6 +745,15 @@ Set internal RIST buffer size in milliseconds for 
@@  retransmission of data.

 Default value is 0 which means the librist default (1 sec). Maximum value
 is 30
 seconds.

 +@item fifo_size
 +Size of the librist receiver output fifo in number of packets. This must
 be a
 +power of 2.
 +Defaults to 8192 (vs the libRIST default of 1024).
 +
 +@item overrun_nonfatal=@var{1|0}
 +Survive in case of libRIST fifo buffer overrun. Default
 +value is 0.


Please use "librist" (all lowercase) consistently.


 +
@ item pkt_size
 Set maximum packet size for sending data. 1316 by default.

 diff --git a/libavformat/librist.c b/libavformat/librist.c
 index 378b635ea7..87c14eb265 100644
 --- a/libavformat/librist.c
 +++ b/libavformat/librist.c
@@  -43,6 +43,9 @@
 ((patch) + ((minor)* 0x100) + ((major) *0x1))
 #define FF_LIBRIST_VERSION
 FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR,
 LIBRIST_API_VERSION_MINOR, LIBRIST_API_VERSION_PATCH)
 #define FF_LIBRIST_VERSION_41 FF_LIBRIST_MAKE_VERSION(4, 1, 0)
 +#define FF_LIBRIST_VERSION_42 FF_LIBRIST_MAKE_VERSION(4, 2, 0)
 +
 +#define FF_LIBRIST_FIFO_SIZE_DEFAULT 8192


FF_LIBRIST prefix is not really needed, as this is not in a header.



 typedef struct RISTContext {
 const AVClass *class;
@@  -52,6 +55,8 @@ typedef struct RISTContext {
 int packet_size;
 int log_level;
 int encryption;
 +int fifo_size;
 +int overrun_nonfatal;
 char *secret;

 struct rist_logging_settings logging_settings;
@@  -70,6 +75,8 @@ static const AVOption librist_options[] = {
 { "main",NULL,  0,
 AV_OPT_TYPE_CONST, {.i64=RIST_PROFILE_MAIN}, 0, 0, .flags = D|E,
 "profile" },
 { "advanced",NULL,  0,
 AV_OPT_TYPE_CONST, {.i64=RIST_PROFILE_ADVANCED}, 0, 0, .flags = D|E,
 "profile" },
 { "buffer_size", "set buffer_size in ms", OFFSET(buffer_size),
 AV_OPT_TYPE_INT, {.i64=0}, 0, 3, .flags = D|E },
 +{ "fifo_size", "Set libRIST fifo buffer. Size must be power of 2",
 OFFSET(fifo_size), AV_OPT_TYPE_INT, {.i64=FF_LIBRIST_FIFO_SIZE_DEFAULT}, 2
 << 9, 2 << 15, .flags = D|E },


Minimum and maximum binary notation is very strange. Use 1= FF_LIBRIST_VERSION_42
 +if (flags & AVIO_FLAG_READ) {
 +ret = rist_receiver_set_output_fifo_size(s->ctx, s->fifo_size);
 +if (ret != 0) {
 +goto err;
 +}
 +}
 +#else
 +if (s->fifo_size != FF_LIBRIST_FIFO_SIZE_DEFAULT) {


Isn't this supposed to be if (s->fifo_size != 1024)? Considering that we are 
aiming for a bigger default in ffmpeg compared to what is in the library as 
default, maybe the user should be aware that we cannot set it?



 +av_log(h, AV_LOG_ERROR, "libRIST prior to 0.2.7 has a bug which
 fails setting the fifo buffer size\n");
 +}
 +#endif
 +


Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ..

[FFmpeg-devel] [PATCH] avformat/librist: bump required version to 0.2.7

2022-06-09 Thread Marton Balint
This is the first version for which fifo size setting actually works.

Signed-off-by: Marton Balint 
---
 configure |  2 +-
 libavformat/librist.c | 32 
 2 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/configure b/configure
index 5a167613a4..69d93090c6 100755
--- a/configure
+++ b/configure
@@ -6604,7 +6604,7 @@ enabled libplacebo&& require_pkg_config 
libplacebo "libplacebo >= 4.192.
 enabled libpulse  && require_pkg_config libpulse libpulse 
pulse/pulseaudio.h pa_context_new
 enabled librabbitmq   && require_pkg_config librabbitmq "librabbitmq >= 
0.7.1" amqp.h amqp_new_connection
 enabled librav1e  && require_pkg_config librav1e "rav1e >= 0.4.0" 
rav1e.h rav1e_context_new
-enabled librist   && require_pkg_config librist "librist >= 0.2" 
librist/librist.h rist_receiver_create
+enabled librist   && require_pkg_config librist "librist >= 0.2.7" 
librist/librist.h rist_receiver_create
 enabled librsvg   && require_pkg_config librsvg librsvg-2.0 
librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
 enabled librtmp   && require_pkg_config librtmp librtmp librtmp/rtmp.h 
RTMP_Socket
 enabled librubberband && require_pkg_config librubberband "rubberband >= 
1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append 
librubberband_extralibs "-lstdc++"
diff --git a/libavformat/librist.c b/libavformat/librist.c
index 58dfd7c44b..5f27cacd44 100644
--- a/libavformat/librist.c
+++ b/libavformat/librist.c
@@ -38,13 +38,6 @@
 
 // RIST_MAX_PACKET_SIZE - 28 minimum protocol overhead
 #define MAX_PAYLOAD_SIZE (1-28)
-
-#define FF_LIBRIST_MAKE_VERSION(major, minor, patch) \
-((patch) + ((minor)* 0x100) + ((major) *0x1))
-#define FF_LIBRIST_VERSION FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR, 
LIBRIST_API_VERSION_MINOR, LIBRIST_API_VERSION_PATCH)
-#define FF_LIBRIST_VERSION_41 FF_LIBRIST_MAKE_VERSION(4, 1, 0)
-#define FF_LIBRIST_VERSION_42 FF_LIBRIST_MAKE_VERSION(4, 2, 0)
-
 #define FIFO_SIZE_DEFAULT 8192
 
 typedef struct RISTContext {
@@ -160,24 +153,14 @@ static int librist_open(URLContext *h, const char *uri, 
int flags)
 if (ret < 0)
 goto err;
 
-#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
-ret = rist_parse_address(uri, (const struct rist_peer_config 
**)&peer_config);
-#else
 ret = rist_parse_address2(uri, &peer_config);
-#endif
 if (ret < 0)
 goto err;
 
 if (flags & AVIO_FLAG_READ) {
-//Prior to 4.2.0 there was a bug in librist which made this call always fail.
-#if FF_LIBRIST_VERSION >= FF_LIBRIST_VERSION_42
 ret = rist_receiver_set_output_fifo_size(s->ctx, s->fifo_size);
 if (ret != 0)
 goto err;
-#else
-if (s->fifo_size != FIFO_SIZE_DEFAULT)
-av_log(h, AV_LOG_ERROR, "librist prior to 0.2.7 has a bug which 
fails setting the fifo buffer size\n");
-#endif
 }
 
 if (((s->encryption == 128 || s->encryption == 256) && !s->secret) ||
@@ -219,13 +202,8 @@ static int librist_read(URLContext *h, uint8_t *buf, int 
size)
 RISTContext *s = h->priv_data;
 int ret;
 
-#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
-const struct rist_data_block *data_block;
-ret = rist_receiver_data_read(s->ctx, &data_block, POLLING_TIME);
-#else
 struct rist_data_block *data_block;
 ret = rist_receiver_data_read2(s->ctx, &data_block, POLLING_TIME);
-#endif
 
 if (ret < 0)
 return risterr2ret(ret);
@@ -234,15 +212,10 @@ static int librist_read(URLContext *h, uint8_t *buf, int 
size)
 return AVERROR(EAGAIN);
 
 if (data_block->payload_len > MAX_PAYLOAD_SIZE) {
-#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
-rist_receiver_data_block_free((struct rist_data_block**)&data_block);
-#else
 rist_receiver_data_block_free2(&data_block);
-#endif
 return AVERROR_EXTERNAL;
 }
 
-#if FF_LIBRIST_VERSION >= FF_LIBRIST_VERSION_42
 if (data_block->flags & RIST_DATA_FLAGS_OVERFLOW) {
 if (!s->overrun_nonfatal) {
 av_log(h, AV_LOG_ERROR, "Fifo buffer overrun. "
@@ -252,16 +225,11 @@ static int librist_read(URLContext *h, uint8_t *buf, int 
size)
 goto out_free;
 }
 }
-#endif
 
 size = data_block->payload_len;
 memcpy(buf, data_block->payload, size);
 out_free:
-#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41
-rist_receiver_data_block_free((struct rist_data_block**)&data_block);
-#else
 rist_receiver_data_block_free2(&data_block);
-#endif
 return size;
 }
 
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 00/41] Stop including superseded functions for x64

2022-06-09 Thread Andreas Rheinhardt
x64 requires MMX, MMXEXT, SSE and SSE2; yet there is no shortage
of code like the following:

if (EXTERNAL_MMX(cpu_flags)) {
c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_mmx;
}
if (EXTERNAL_SSE2(cpu_flags)) {
c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_sse2;
}

Given that SSE2 is always present on x64, the only way
for the mmx version to be chosen in the above example
is if SSE2 has been disabled either at compile-time
or at runtime, i.e. it is never used unless one shoots
oneself in the foot.
This patchset therefore disables such functions for x64
by #if'ing them away; x86 has not been affected. This
saves about 140KB.

(Another way to handle this would be to remove every function
that would be overridden if one had a processor capable of
MMX, MMXEXT, SSE and SSE2. x86 processors not fulfilling
this requirement (which are truely ancient nowadays)
would still work, but would be slower, i.e. they would be treated
as second-class citizens. This would have the advantage of
avoiding #ifs and would lighten x86 binaries of code that is
not used at all by the overwhelming majority of users.
I'll update this patchset if it is preferred to do it that way.)

Andreas Rheinhardt (41):
  avcodec/x86/qpeldsp: Remove unused ff_put_no_rnd_pixels16_l2_3dnow
  avcodec/x86/hevcdsp_init: Remove unnecessary inclusion of get_bits.h
  avcodec/hevcdec: Make ff_hevc_pel_weight static
  avcodec/v4l2_m2m: Remove unused ff_v4l2_m2m_codec_full_reinit
  avcodec/videodsp: Make ff_emulated_edge_mc_16 static
  avcodec/x86/fpel: Remove unused ff_avg_pixels4_mmx
  avcodec/x86/rv34dsp: Remove unused ff_rv34_idct_dc_mmxext
  avcodec/x86/h264_qpel_8bit: Remove unused function
  avcodec/x86/vc1dsp_init: Disable overridden functions on x64
  avcodec/x86/ac3dsp_init: Disable overridden functions on x64
  avcodec/x86/audiodsp_init: Disable overridden functions on x64
  avcodec/x86/diracdsp_init: Disable overridden functions on x64
  avcodec/x86/mpegvideoenc: Disable overridden functions on x64
  avcodec/x86/fdct: Disable overridden functions on x64
  avcodec/x86/hevcdsp_init: Disable overridden functions on x64
  avcodec/x86/rv40dsp_init: Disable overridden functions on x64
  avcodec/x86/cavsdsp: Disable overridden functions on x64
  avcodec/x86/h264_intrapred_init: Disable overridden functions on x64
  avfilter/x86/vf_noise: Disable overridden functions on x64
  avcodec/x86/me_cmp: Disable overridden functions on x64
  avcodec/x86/mpegvideoencdsp: Disable ff_pix_norm1_mmx on x64
  avcodec/x86/h264dsp_init: Disable overridden functions on x64
  avcodec/x86/sbrdsp_init: Disable overridden functions on x64
  avcodec/x86/idctdsp_init: Disable overridden functions on x64
  avcodec/x86/blockdsp_init: Disable overridden functions on x64
  avcodec/x86/pixblockdsp_init: Disable overridden functions on x64
  avcodec/x86/lossless_audiodsp_init: Disable overridden functions on
x64
  avcodec/x86/svq1enc_init: Disable overridden functions on x64
  avcodec/x86/fmtconvert_init: Disable overridden functions on x64
  avcodec/x86/hpeldsp_vp3_init: Disable overridden functions on x64
  avcodec/x86/hpeldsp_init: Disable overridden functions on x64
  avcodec/x86/h264_qpel: Make functions only used here static
  avcodec/x86/h264_qpel: Disable overridden functions on x64
  avcodec/x86/h264chroma_init: Disable overridden functions on x64
  swresample/x86/audio_convert_init: Disable overridden functions on x64
  swresample/x86/rematrix_init: Disable overridden functions on x64
  swscale/x86/rgb2rgb: Disable overridden functions on x64
  swscale/x86/yuv2rgb: Disable overridden functions on x64
  swscale/x86/swscale: Disable overridden functions on x64
  avfilter/x86/vf_eq_init: Disable overridden functions on x64
  avutil/x86/pixelutils_init: Disable overridden functions on x64

 libavcodec/hevcdec.c| 10 +--
 libavcodec/tests/x86/dct.c  |  4 +-
 libavcodec/v4l2_m2m.c   | 76 -
 libavcodec/videodsp.c   |  4 ++
 libavcodec/videodsp.h   |  1 -
 libavcodec/videodsp_template.c  |  1 +
 libavcodec/x86/ac3dsp.asm   |  5 ++
 libavcodec/x86/ac3dsp_init.c|  2 +
 libavcodec/x86/audiodsp.asm |  4 ++
 libavcodec/x86/audiodsp_init.c  |  2 +
 libavcodec/x86/blockdsp.asm |  4 ++
 libavcodec/x86/blockdsp_init.c  |  2 +
 libavcodec/x86/cavsdsp.c| 20 --
 libavcodec/x86/cavsidct.asm |  2 +
 libavcodec/x86/diracdsp_init.c  |  4 +-
 libavcodec/x86/fdct.c   | 12 ++--
 libavcodec/x86/fdctdsp_init.c   |  2 +
 libavcodec/x86/fmtconvert.asm   |  4 ++
 libavcodec/x86/fmtconvert_init.c|  2 +
 libavcodec/x86/fpel.asm |  3 +-
 libavcodec/x86/h264_chromamc.asm|  4 +-
 libavcodec/x86/h264_deblock.asm | 24 ++-
 libavcodec/x86/h264_idct.asm| 57 
 libavcodec/x86/h2

[FFmpeg-devel] [PATCH] avformat/os_support: use windows stat structs with 64bit time_t

2022-06-09 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
avformat/os_support: use windows stat structs with 64bit time_t

Signed-off-by: softworkz softwo...@hotmail.com

Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-35%2Fsoftworkz%2Fsubmit_long_filenames2-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-35/softworkz/submit_long_filenames2-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/35

 libavformat/os_support.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index 958976cc6f..b419efa408 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -213,7 +213,7 @@ fallback:
 return _access(filename_utf8, mode);
 }
 
-static inline void copy_stat(struct _stati64 *crtstat, struct win32_stat *buf)
+static inline void copy_stat(struct _stat64 *crtstat, struct win32_stat *buf)
 {
 buf->st_dev   = crtstat->st_dev;
 buf->st_ino   = crtstat->st_ino;
@@ -230,7 +230,7 @@ static inline void copy_stat(struct _stati64 *crtstat, 
struct win32_stat *buf)
 
 static inline int win32_stat(const char *filename_utf8, struct win32_stat *buf)
 {
-struct _stati64 crtstat = { 0 };
+struct _stat64 crtstat = { 0 };
 wchar_t *filename_w;
 int ret;
 
@@ -250,7 +250,7 @@ static inline int win32_stat(const char *filename_utf8, 
struct win32_stat *buf)
 
 static inline int win32_fstat(int fd, struct win32_stat *buf)
 {
-struct _stati64 crtstat = { 0 };
+struct _stat64 crtstat = { 0 };
 int ret;
 
 ret = _fstat64(fd, &crtstat);

base-commit: 5d5a01419928d0c00bae54f730eede150cd5b268
-- 
ffmpeg-codebot
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v7] libx264: Set min build version to 158

2022-06-09 Thread Matt Oliver
From: Matt Oliver 

Was "[PATCH] libx264: Do not explicitly set X264_API_IMPORTS"

Setting X264_API_IMPORTS only affects msvc builds and it breaks
linking to static builds (although is required for shared builds).
This flag is set by x264 in its pkgconfig as required since build
158 (a615f027ed172e2dd5380e736d487aa858a0c4ff) from July 2019.
So this patch updates configure to require a newer x264 build that
correctly sets the imports flag.

The min version requirement of 158 is applied for msvc builds only.

This is also removing the check for 'libx264 without pkg-config'
which was left for compatibility reasons about 7 years ago when
the pkg-config check was introduced by commit
e06263ef1e0e172b2c76070b3dc739411af08e82.

Co-authored-by: softworkz 
Signed-off-by: softworkz 
Signed-off-by: Matt Oliver 
---
libx264: Set min build version to 158

I'm submitting this patch on behalf of Matt with his permission.

There was agreement that the >= 158 version requirement should be
applied to MSVC builds only.

v2: restrict the version requirement to msvc builds
v3: fix unintended author change
v4: add missing braces
v5: fixed condition (again ;-)
v6: hope I got it now..
v7: add comment about dropping non-pkg-conf check, re-add libx262 check

Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-30%2Fsoftworkz%2Fsubmit_x264_api_imports_matt-v7
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-30/softworkz/submit_x264_api_imports_matt-v7
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/30

Range-diff vs v6:

 1:  47843fb51e ! 1:  3baec48834 libx264: Set min build version to 158
 @@ Commit message
  So this patch updates configure to require a newer x264 build that
  correctly sets the imports flag.
  
 -The requirement for 158 is applied for msvc builds only,
 -no change is made for all other cases.
 +The min version requirement of 158 is applied for msvc builds only.
 +
 +This is also removing the check for 'libx264 without pkg-config'
 +which was left for compatibility reasons about 7 years ago when
 +the pkg-config check was introduced by commit
 +e06263ef1e0e172b2c76070b3dc739411af08e82.
  
  Co-authored-by: softworkz 
  Signed-off-by: softworkz 
 @@ configure: enabled libvpx&& {
  -   { require libx264 "stdint.h x264.h" 
x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
  - warn "using libx264 without 
pkg-config"; } } &&
  - require_cpp_condition libx264 x264.h 
"X264_BUILD >= 118" &&
 -- check_cpp_condition libx262 x264.h 
"X264_MPEG2"
  +enabled libx264   && check_pkg_config libx264 x264 "stdint.h 
x264.h" x264_encoder_encode &&
  + require_cpp_condition libx264 x264.h 
"X264_BUILD >= 118" && {
  + [ "$toolchain" != "msvc" ] ||
 -+ require_cpp_condition libx264 x264.h 
"X264_BUILD >= 158"; }
 ++ require_cpp_condition libx264 x264.h 
"X264_BUILD >= 158"; } &&
 +  check_cpp_condition libx262 x264.h 
"X264_MPEG2"
   enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
require_cpp_condition libx265 x265.h 
"X265_BUILD >= 70"
 - enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
  
   ## libavcodec/libx264.c ##
  @@


 configure| 8 
 libavcodec/libx264.c | 4 
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index 5a167613a4..3dca1c4bd3 100755
--- a/configure
+++ b/configure
@@ -6658,10 +6658,10 @@ enabled libvpx&& {
 enabled libwebp   && {
 enabled libwebp_encoder  && require_pkg_config libwebp "libwebp >= 
0.2.0" webp/encode.h WebPGetEncoderVersion
 enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder 
"libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264   && { check_pkg_config libx264 x264 "stdint.h x264.h" 
x264_encoder_encode ||
-   { require libx264 "stdint.h x264.h" 
x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
- warn "using libx264 without pkg-config"; } } 
&&
- require_cpp_condition libx264 x264.h "X264_BUILD 
>= 118" &&
+enabled libx264   && check_pkg_config libx264 x264 "stdint.h x264.h" 
x264_encoder_encode &&
+ require_cpp_condition libx264 x264.h "X264_BUILD 
>= 118" && {
+ [ "$toolchain"

[FFmpeg-devel] [PATCH 01/41] avcodec/x86/qpeldsp: Remove unused ff_put_no_rnd_pixels16_l2_3dnow

2022-06-09 Thread Andreas Rheinhardt
qpeldsp does not use 3dnow, it is MMXEXT-only.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/qpeldsp.asm | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/x86/qpeldsp.asm b/libavcodec/x86/qpeldsp.asm
index 282faed14f..3a6a650654 100644
--- a/libavcodec/x86/qpeldsp.asm
+++ b/libavcodec/x86/qpeldsp.asm
@@ -166,8 +166,6 @@ cglobal put_no_rnd_pixels16_l2, 6,6
 
 INIT_MMX mmxext
 PUT_NO_RND_PIXELS16_l2
-INIT_MMX 3dnow
-PUT_NO_RND_PIXELS16_l2
 
 %macro MPEG4_QPEL16_H_LOWPASS 1
 cglobal %1_mpeg4_qpel16_h_lowpass, 5, 5, 0, 16
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 02/41] avcodec/x86/hevcdsp_init: Remove unnecessary inclusion of get_bits.h

2022-06-09 Thread Andreas Rheinhardt
This file does not use anything from get_bits.h at all;
furthermore hevcdsp.h now includes get_bits.h itself.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/hevcdsp_init.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/x86/hevcdsp_init.c b/libavcodec/x86/hevcdsp_init.c
index f3061bda84..48f48a925f 100644
--- a/libavcodec/x86/hevcdsp_init.c
+++ b/libavcodec/x86/hevcdsp_init.c
@@ -25,7 +25,6 @@
 #include "libavutil/mem_internal.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
-#include "libavcodec/get_bits.h" /* required for hevcdsp.h GetBitContext */
 #include "libavcodec/hevcdsp.h"
 #include "libavcodec/x86/hevcdsp.h"
 
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 03/41] avcodec/hevcdec: Make ff_hevc_pel_weight static

2022-06-09 Thread Andreas Rheinhardt
Only used here.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/hevcdec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index f782ea6394..e84c30dd13 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -52,7 +52,7 @@
 #include "thread.h"
 #include "threadframe.h"
 
-const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, 
[12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };
+static const uint8_t hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 
3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 };
 
 /**
  * NOTE: Each function hls_foo correspond to the function foo in the
@@ -1509,7 +1509,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, 
ptrdiff_t dststride,
 int my   = mv->y & 3;
 int weight_flag  = (s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag);
-int idx  = ff_hevc_pel_weight[block_w];
+int idx  = hevc_pel_weight[block_w];
 
 x_off += mv->x >> 2;
 y_off += mv->y >> 2;
@@ -1576,7 +1576,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, 
ptrdiff_t dststride,
 int y_off0   = y_off + (mv0->y >> 2);
 int x_off1   = x_off + (mv1->x >> 2);
 int y_off1   = y_off + (mv1->y >> 2);
-int idx  = ff_hevc_pel_weight[block_w];
+int idx  = hevc_pel_weight[block_w];
 
 uint8_t *src0  = ref0->data[0] + y_off0 * src0stride + 
(int)((unsigned)x_off0 << s->ps.sps->pixel_shift);
 uint8_t *src1  = ref1->data[0] + y_off1 * src1stride + 
(int)((unsigned)x_off1 << s->ps.sps->pixel_shift);
@@ -1658,7 +1658,7 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0,
 const Mv *mv = ¤t_mv->mv[reflist];
 int weight_flag  = (s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag);
-int idx  = ff_hevc_pel_weight[block_w];
+int idx  = hevc_pel_weight[block_w];
 int hshift   = s->ps.sps->hshift[1];
 int vshift   = s->ps.sps->vshift[1];
 intptr_t mx  = av_mod_uintp2(mv->x, 2 + hshift);
@@ -1743,7 +1743,7 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, 
ptrdiff_t dststride, AVF
 int y_off0 = y_off + (mv0->y >> (2 + vshift));
 int x_off1 = x_off + (mv1->x >> (2 + hshift));
 int y_off1 = y_off + (mv1->y >> (2 + vshift));
-int idx = ff_hevc_pel_weight[block_w];
+int idx = hevc_pel_weight[block_w];
 src1  += y_off0 * src1stride + (int)((unsigned)x_off0 << 
s->ps.sps->pixel_shift);
 src2  += y_off1 * src2stride + (int)((unsigned)x_off1 << 
s->ps.sps->pixel_shift);
 
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 04/41] avcodec/v4l2_m2m: Remove unused ff_v4l2_m2m_codec_full_reinit

2022-06-09 Thread Andreas Rheinhardt
Unused since df701ed0b582a6b5c763310b4225446089cbcfb1.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/v4l2_m2m.c | 76 ---
 1 file changed, 76 deletions(-)

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 3178ef06b8..51932baf84 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -244,82 +244,6 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mContext *s)
 return 0;
 }
 
-int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *s)
-{
-void *log_ctx = s->avctx;
-int ret;
-
-av_log(log_ctx, AV_LOG_DEBUG, "%s full reinit\n", s->devname);
-
-/* wait for pending buffer references */
-if (atomic_load(&s->refcount))
-while(sem_wait(&s->refsync) == -1 && errno == EINTR);
-
-ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "output VIDIOC_STREAMOFF\n");
-goto error;
-}
-
-ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "capture VIDIOC_STREAMOFF\n");
-goto error;
-}
-
-/* release and unmmap the buffers */
-ff_v4l2_context_release(&s->output);
-ff_v4l2_context_release(&s->capture);
-
-/* start again now that we know the stream dimensions */
-s->draining = 0;
-s->reinit = 0;
-
-ret = ff_v4l2_context_get_format(&s->output, 0);
-if (ret) {
-av_log(log_ctx, AV_LOG_DEBUG, "v4l2 output format not supported\n");
-goto error;
-}
-
-ret = ff_v4l2_context_get_format(&s->capture, 0);
-if (ret) {
-av_log(log_ctx, AV_LOG_DEBUG, "v4l2 capture format not supported\n");
-goto error;
-}
-
-ret = ff_v4l2_context_set_format(&s->output);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "can't set v4l2 output format\n");
-goto error;
-}
-
-ret = ff_v4l2_context_set_format(&s->capture);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "can't to set v4l2 capture format\n");
-goto error;
-}
-
-ret = ff_v4l2_context_init(&s->output);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "no v4l2 output context's buffers\n");
-goto error;
-}
-
-/* decoder's buffers need to be updated at a later stage */
-if (s->avctx && !av_codec_is_decoder(s->avctx->codec)) {
-ret = ff_v4l2_context_init(&s->capture);
-if (ret) {
-av_log(log_ctx, AV_LOG_ERROR, "no v4l2 capture context's 
buffers\n");
-goto error;
-}
-}
-
-return 0;
-
-error:
-return ret;
-}
-
 static void v4l2_m2m_destroy_context(void *opaque, uint8_t *context)
 {
 V4L2m2mContext *s = (V4L2m2mContext*)context;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 05/41] avcodec/videodsp: Make ff_emulated_edge_mc_16 static

2022-06-09 Thread Andreas Rheinhardt
Only ff_emulated_edge_mc_8() is used outside of lavc/videodsp.c.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/videodsp.c  | 4 
 libavcodec/videodsp.h  | 1 -
 libavcodec/videodsp_template.c | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
index 2198d46c15..02af046b81 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -25,11 +25,15 @@
 #include "videodsp.h"
 
 #define BIT_DEPTH 8
+#define STATIC
 #include "videodsp_template.c"
+#undef STATIC
 #undef BIT_DEPTH
 
 #define BIT_DEPTH 16
+#define STATIC static
 #include "videodsp_template.c"
+#undef STATIC
 #undef BIT_DEPTH
 
 static void just_return(uint8_t *buf, ptrdiff_t stride, int h)
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h
index ac971dc57f..b5219d236c 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -36,7 +36,6 @@ void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const 
uint8_t *src, \
int src_x, int src_y, int w, int h);
 
 EMULATED_EDGE(8)
-EMULATED_EDGE(16)
 
 typedef struct VideoDSPContext {
 /**
diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
index 55123a5844..8bc3290248 100644
--- a/libavcodec/videodsp_template.c
+++ b/libavcodec/videodsp_template.c
@@ -20,6 +20,7 @@
  */
 
 #include "bit_depth_template.c"
+STATIC
 void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
ptrdiff_t buf_linesize,
ptrdiff_t src_linesize,
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 06/41] avcodec/x86/fpel: Remove unused ff_avg_pixels4_mmx

2022-06-09 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/fpel.asm | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/x86/fpel.asm b/libavcodec/x86/fpel.asm
index 961a1587a7..d38a1b1035 100644
--- a/libavcodec/x86/fpel.asm
+++ b/libavcodec/x86/fpel.asm
@@ -90,7 +90,6 @@ cglobal %1_pixels%2, 4,5,4
 
 INIT_MMX mmx
 OP_PIXELS put, 4
-OP_PIXELS avg, 4
 OP_PIXELS put, 8
 OP_PIXELS avg, 8
 OP_PIXELS put, 16
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 07/41] avcodec/x86/rv34dsp: Remove unused ff_rv34_idct_dc_mmxext

2022-06-09 Thread Andreas Rheinhardt
Forgotten in 9ba9c3402499d90e54f8aa111b62c278206d11af.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/rv34dsp.asm | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavcodec/x86/rv34dsp.asm b/libavcodec/x86/rv34dsp.asm
index 692b4acfcd..5568ddfdf8 100644
--- a/libavcodec/x86/rv34dsp.asm
+++ b/libavcodec/x86/rv34dsp.asm
@@ -44,10 +44,10 @@ SECTION .text
 sar%1, 10
 %endmacro
 
-%macro rv34_idct 1
-cglobal rv34_idct_%1, 1, 2, 0
+INIT_MMX mmxext
+cglobal rv34_idct_dc_noround, 1, 2, 0
 movsx   r1, word [r0]
-IDCT_DC r1
+IDCT_DC_NOROUND r1
 movdm0, r1d
 pshufw  m0, m0, 0
 movq[r0+ 0], m0
@@ -55,13 +55,6 @@ cglobal rv34_idct_%1, 1, 2, 0
 movq[r0+16], m0
 movq[r0+24], m0
 REP_RET
-%endmacro
-
-INIT_MMX mmxext
-%define IDCT_DC IDCT_DC_ROUND
-rv34_idct dc
-%define IDCT_DC IDCT_DC_NOROUND
-rv34_idct dc_noround
 
 ; ff_rv34_idct_dc_add_mmx(uint8_t *dst, int stride, int dc);
 %if ARCH_X86_32
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 08/41] avcodec/x86/h264_qpel_8bit: Remove unused function

2022-06-09 Thread Andreas Rheinhardt
Namely ff_avg_h264_qpel8or16_hv1_lowpass_op_mmxext. It seems to exist
since 610e00b3594bf0f2a75713f20e9c4edf0d03a818 (a function like this
already existed before that commit, but it was static and
av_always_inline and was therefore not present in the actual binaries).

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_qpel_8bit.asm | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/x86/h264_qpel_8bit.asm 
b/libavcodec/x86/h264_qpel_8bit.asm
index 2d287ba443..03c7d88f8c 100644
--- a/libavcodec/x86/h264_qpel_8bit.asm
+++ b/libavcodec/x86/h264_qpel_8bit.asm
@@ -583,7 +583,6 @@ cglobal %1_h264_qpel8or16_hv1_lowpass_op, 4,4,8 ; src, tmp, 
srcStride, size
 
 INIT_MMX mmxext
 QPEL8OR16_HV1_LOWPASS_OP put
-QPEL8OR16_HV1_LOWPASS_OP avg
 
 INIT_XMM sse2
 QPEL8OR16_HV1_LOWPASS_OP put
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 09/41] avcodec/x86/vc1dsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables these functions
at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_chromamc.asm |  2 ++
 libavcodec/x86/vc1dsp_init.c | 41 +++-
 libavcodec/x86/vc1dsp_loopfilter.asm |  2 ++
 3 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index b5a78b537d..0421fa8695 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -448,7 +448,9 @@ chroma_mc2_mmx_func avg, h264
 
 INIT_MMX 3dnow
 chroma_mc8_mmx_func avg, h264, _rnd
+%if ARCH_X86_32
 chroma_mc8_mmx_func avg, vc1,  _nornd
+%endif
 chroma_mc8_mmx_func avg, rv40
 chroma_mc4_mmx_func avg, h264
 chroma_mc4_mmx_func avg, rv40
diff --git a/libavcodec/x86/vc1dsp_init.c b/libavcodec/x86/vc1dsp_init.c
index 2fbf0b3a74..66d894061c 100644
--- a/libavcodec/x86/vc1dsp_init.c
+++ b/libavcodec/x86/vc1dsp_init.c
@@ -33,9 +33,10 @@
 #include "vc1dsp.h"
 #include "config.h"
 
-#define LOOP_FILTER(EXT) \
+#define LOOP_FILTER4(EXT) \
 void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
-void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
+void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq);
+#define LOOP_FILTER816(EXT) \
 void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
 void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
 \
@@ -52,9 +53,13 @@ static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, 
ptrdiff_t stride, int pq)
 }
 
 #if HAVE_X86ASM
-LOOP_FILTER(mmxext)
-LOOP_FILTER(sse2)
-LOOP_FILTER(ssse3)
+LOOP_FILTER4(mmxext)
+#if ARCH_X86_32
+LOOP_FILTER816(mmxext)
+#endif
+LOOP_FILTER816(sse2)
+LOOP_FILTER4(ssse3)
+LOOP_FILTER816(ssse3)
 
 void ff_vc1_h_loop_filter8_sse4(uint8_t *src, ptrdiff_t stride, int pq);
 
@@ -71,12 +76,14 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, 
ptrdiff_t stride, int pq)
 ff_ ## OP ## pixels ## DEPTH ## INSN(dst, src, stride, DEPTH); \
 }
 
-DECLARE_FUNCTION(put_,  8, _mmx)
+#if ARCH_X86_32
 DECLARE_FUNCTION(put_, 16, _mmx)
 DECLARE_FUNCTION(avg_,  8, _mmx)
 DECLARE_FUNCTION(avg_, 16, _mmx)
-DECLARE_FUNCTION(avg_,  8, _mmxext)
 DECLARE_FUNCTION(avg_, 16, _mmxext)
+#endif
+DECLARE_FUNCTION(put_,  8, _mmx)
+DECLARE_FUNCTION(avg_,  8, _mmxext)
 DECLARE_FUNCTION(put_, 16, _sse2)
 DECLARE_FUNCTION(avg_, 16, _sse2)
 
@@ -114,9 +121,10 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
 if (EXTERNAL_MMXEXT(cpu_flags))
 ff_vc1dsp_init_mmxext(dsp);
 
-#define ASSIGN_LF(EXT) \
+#define ASSIGN_LF4(EXT) \
 dsp->vc1_v_loop_filter4  = ff_vc1_v_loop_filter4_ ## EXT; \
-dsp->vc1_h_loop_filter4  = ff_vc1_h_loop_filter4_ ## EXT; \
+dsp->vc1_h_loop_filter4  = ff_vc1_h_loop_filter4_ ## EXT
+#define ASSIGN_LF816(EXT) \
 dsp->vc1_v_loop_filter8  = ff_vc1_v_loop_filter8_ ## EXT; \
 dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_ ## EXT; \
 dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
@@ -127,19 +135,25 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
 dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_put_vc1_chroma_mc8_nornd_mmx;
 
 dsp->put_vc1_mspel_pixels_tab[1][0]  = put_vc1_mspel_mc00_8_mmx;
+#if ARCH_X86_32
 dsp->put_vc1_mspel_pixels_tab[0][0]  = put_vc1_mspel_mc00_16_mmx;
 dsp->avg_vc1_mspel_pixels_tab[1][0]  = avg_vc1_mspel_mc00_8_mmx;
 dsp->avg_vc1_mspel_pixels_tab[0][0]  = avg_vc1_mspel_mc00_16_mmx;
 }
 if (EXTERNAL_AMD3DNOW(cpu_flags)) {
 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_avg_vc1_chroma_mc8_nornd_3dnow;
+#endif
 }
 if (EXTERNAL_MMXEXT(cpu_flags)) {
-ASSIGN_LF(mmxext);
-dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_avg_vc1_chroma_mc8_nornd_mmxext;
+ASSIGN_LF4(mmxext);
+#if ARCH_X86_32
+ASSIGN_LF816(mmxext);
 
-dsp->avg_vc1_mspel_pixels_tab[1][0]  = avg_vc1_mspel_mc00_8_mmxext;
 dsp->avg_vc1_mspel_pixels_tab[0][0]  = 
avg_vc1_mspel_mc00_16_mmxext;
+#endif
+dsp->avg_vc1_mspel_pixels_tab[1][0]  = avg_vc1_mspel_mc00_8_mmxext;
+
+dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = 
ff_avg_vc1_chroma_mc8_nornd_mmxext;
 
 dsp->vc1_inv_trans_8x8_dc= 
ff_vc1_inv_trans_8x8_dc_mmxext;
 dsp->vc1_inv_trans_4x8_dc= 
ff_vc1_inv_trans_4x8_dc_mmxext;
@@ -156,7 +170,8 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
 dsp->avg_vc1_mspel_pixels_tab[0][0]  = avg_vc1_mspel_mc00_16_sse2;
 }
 if (EXTERNAL_SSSE3(cpu_flags)) {
-ASSIGN_LF(ssse3);
+ASSIGN_LF4(ssse3);
+ASSIGN_LF816(ssse3);
 dsp->put_no_rnd_vc

[FFmpeg-devel] [PATCH 10/41] avcodec/x86/ac3dsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such AC-3 functions
at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/ac3dsp.asm| 5 +
 libavcodec/x86/ac3dsp_init.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index 4ddaa94320..050cbfe06a 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -64,6 +64,7 @@ cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, 
offset
 %endmacro
 
 %define LOOP_ALIGN
+%if ARCH_X86_32
 INIT_MMX mmx
 AC3_EXPONENT_MIN
 %if HAVE_MMXEXT_EXTERNAL
@@ -71,7 +72,9 @@ AC3_EXPONENT_MIN
 INIT_MMX mmxext
 AC3_EXPONENT_MIN
 %endif
+%endif
 %if HAVE_SSE2_EXTERNAL
+%define LOOP_ALIGN ALIGN 16
 INIT_XMM sse2
 AC3_EXPONENT_MIN
 %endif
@@ -81,6 +84,7 @@ AC3_EXPONENT_MIN
 ; void ff_float_to_fixed24(int32_t *dst, const float *src, unsigned int len)
 ;-
 
+%if ARCH_X86_32
 ; The 3DNow! version is not bit-identical because pf2id uses truncation rather
 ; than round-to-nearest.
 INIT_MMX 3dnow
@@ -134,6 +138,7 @@ cglobal float_to_fixed24, 3, 3, 3, dst, src, len
 ja .loop
 emms
 RET
+%endif
 
 INIT_XMM sse2
 cglobal float_to_fixed24, 3, 3, 9, dst, src, len
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 5f20e6dc31..47ec5d8070 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -41,6 +41,7 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int 
bit_exact)
 {
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags)) {
 c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
 }
@@ -55,6 +56,7 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int 
bit_exact)
 if (EXTERNAL_SSE(cpu_flags)) {
 c->float_to_fixed24 = ff_float_to_fixed24_sse;
 }
+#endif
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
 c->float_to_fixed24 = ff_float_to_fixed24_sse2;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 11/41] avcodec/x86/audiodsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such audiodsp functions
at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/audiodsp.asm| 4 
 libavcodec/x86/audiodsp_init.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/x86/audiodsp.asm b/libavcodec/x86/audiodsp.asm
index de395e5fa8..e4a498b516 100644
--- a/libavcodec/x86/audiodsp.asm
+++ b/libavcodec/x86/audiodsp.asm
@@ -48,8 +48,10 @@ cglobal scalarproduct_int16, 3,3,3, v1, v2, order
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 SCALARPRODUCT
+%endif
 INIT_XMM sse2
 SCALARPRODUCT
 
@@ -117,8 +119,10 @@ cglobal vector_clip_int32%5, 5,5,%1, dst, src, min, max, 
len
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 VECTOR_CLIP_INT32 0, 1, 0, 0
+%endif
 INIT_XMM sse2
 VECTOR_CLIP_INT32 6, 1, 0, 0, _int
 VECTOR_CLIP_INT32 6, 2, 0, 1
diff --git a/libavcodec/x86/audiodsp_init.c b/libavcodec/x86/audiodsp_init.c
index 98e296c264..ebb28ece78 100644
--- a/libavcodec/x86/audiodsp_init.c
+++ b/libavcodec/x86/audiodsp_init.c
@@ -44,11 +44,13 @@ av_cold void ff_audiodsp_init_x86(AudioDSPContext *c)
 {
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags))
 c->vector_clip_int32 = ff_vector_clip_int32_mmx;
 
 if (EXTERNAL_MMXEXT(cpu_flags))
 c->scalarproduct_int16 = ff_scalarproduct_int16_mmxext;
+#endif
 
 if (EXTERNAL_SSE(cpu_flags))
 c->vector_clipf = ff_vector_clipf_sse;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 12/41] avcodec/x86/diracdsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such diracdsp functions
at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/diracdsp_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/x86/diracdsp_init.c b/libavcodec/x86/diracdsp_init.c
index 8baacf3129..c9dca58f1b 100644
--- a/libavcodec/x86/diracdsp_init.c
+++ b/libavcodec/x86/diracdsp_init.c
@@ -87,9 +87,11 @@ static void OPNAME ## _dirac_pixels32_ ## EXT(uint8_t *dst, 
const uint8_t *src[5
 }\
 }
 
+#if !ARCH_X86_64
 DIRAC_PIXOP(put, mmx)
 DIRAC_PIXOP(avg, mmx)
 DIRAC_PIXOP(avg, mmxext)
+#endif
 
 DIRAC_PIXOP(put, sse2)
 DIRAC_PIXOP(avg, sse2)
@@ -114,13 +116,13 @@ void ff_diracdsp_init_x86(DiracDSPContext* c)
 c->dirac_hpel_filter = dirac_hpel_filter_mmx;
 c->add_rect_clamped = ff_add_rect_clamped_mmx;
 c->put_signed_rect_clamped[0] = (void *)ff_put_signed_rect_clamped_mmx;
-#endif
 PIXFUNC(put, 0, mmx);
 PIXFUNC(avg, 0, mmx);
 }
 
 if (EXTERNAL_MMXEXT(mm_flags)) {
 PIXFUNC(avg, 0, mmxext);
+#endif
 }
 
 if (EXTERNAL_SSE2(mm_flags)) {
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 13/41] avcodec/x86/mpegvideoenc: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such mpegvideoenc
functions at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/mpegvideoenc.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
index 3691cce26c..d9c89d568b 100644
--- a/libavcodec/x86/mpegvideoenc.c
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -42,6 +42,7 @@ DECLARE_ALIGNED(16, static const uint16_t, 
inv_zigzag_direct16)[64] = {
 
 #if HAVE_6REGS
 
+#if ARCH_X86_32
 #if HAVE_MMX_INLINE
 #define COMPILE_TEMPLATE_MMXEXT 0
 #define COMPILE_TEMPLATE_SSE2   0
@@ -64,6 +65,7 @@ DECLARE_ALIGNED(16, static const uint16_t, 
inv_zigzag_direct16)[64] = {
 #define RENAME_FDCT(a) a ## _mmxext
 #include "mpegvideoenc_template.c"
 #endif /* HAVE_MMXEXT_INLINE */
+#endif /* ARCH_X86_32 */
 
 #if HAVE_SSE2_INLINE
 #undef COMPILE_TEMPLATE_MMXEXT
@@ -96,7 +98,7 @@ DECLARE_ALIGNED(16, static const uint16_t, 
inv_zigzag_direct16)[64] = {
 #endif /* HAVE_6REGS */
 
 #if HAVE_INLINE_ASM
-#if HAVE_MMX_INLINE
+#if HAVE_MMX_INLINE && ARCH_X86_32
 static void  denoise_dct_mmx(MpegEncContext *s, int16_t *block){
 const int intra= s->mb_intra;
 int *sum= s->dct_error_sum[intra];
@@ -218,17 +220,18 @@ av_cold void ff_dct_encode_init_x86(MpegEncContext *s)
 if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
 #if HAVE_MMX_INLINE
 int cpu_flags = av_get_cpu_flags();
+#if ARCH_X86_32
 if (INLINE_MMX(cpu_flags)) {
 #if HAVE_6REGS
 s->dct_quantize = dct_quantize_mmx;
 #endif
 s->denoise_dct  = denoise_dct_mmx;
 }
-#endif
 #if HAVE_6REGS && HAVE_MMXEXT_INLINE
 if (INLINE_MMXEXT(cpu_flags))
 s->dct_quantize = dct_quantize_mmxext;
 #endif
+#endif
 #if HAVE_SSE2_INLINE
 if (INLINE_SSE2(cpu_flags)) {
 #if HAVE_6REGS
@@ -240,6 +243,7 @@ av_cold void ff_dct_encode_init_x86(MpegEncContext *s)
 #if HAVE_6REGS && HAVE_SSSE3_INLINE
 if (INLINE_SSSE3(cpu_flags))
 s->dct_quantize = dct_quantize_ssse3;
+#endif
 #endif
 }
 }
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 14/41] avcodec/x86/fdct: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such mpegvideoenc
functions at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/tests/x86/dct.c|  2 ++
 libavcodec/x86/fdct.c | 12 
 libavcodec/x86/fdctdsp_init.c |  2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/tests/x86/dct.c b/libavcodec/tests/x86/dct.c
index b332c9642d..1eb9400567 100644
--- a/libavcodec/tests/x86/dct.c
+++ b/libavcodec/tests/x86/dct.c
@@ -58,12 +58,14 @@ PR_WRAP(avx)
 #endif
 
 static const struct algo fdct_tab_arch[] = {
+#if ARCH_X86_32
 #if HAVE_MMX_INLINE
 { "MMX",ff_fdct_mmx,FF_IDCT_PERM_NONE, AV_CPU_FLAG_MMX },
 #endif
 #if HAVE_MMXEXT_INLINE
 { "MMXEXT", ff_fdct_mmxext, FF_IDCT_PERM_NONE, AV_CPU_FLAG_MMXEXT },
 #endif
+#endif
 #if HAVE_SSE2_INLINE
 { "SSE2",   ff_fdct_sse2,   FF_IDCT_PERM_NONE, AV_CPU_FLAG_SSE2 },
 #endif
diff --git a/libavcodec/x86/fdct.c b/libavcodec/x86/fdct.c
index 835fcc2b28..5e00287764 100644
--- a/libavcodec/x86/fdct.c
+++ b/libavcodec/x86/fdct.c
@@ -71,8 +71,6 @@ DECLARE_ALIGNED(16, static const int16_t, ocos_4_16)[8] = {
 
 DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) };
 
-DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, 
RND_FRW_ROW };
-
 static const struct
 {
  DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4];
@@ -375,7 +373,6 @@ static av_always_inline void fdct_col_##cpu(const int16_t 
*in, int16_t *out, int
   "r" (out + offset), "r" (ocos_4_16)); \
 }
 
-FDCT_COL(mmx, mm, movq)
 FDCT_COL(sse2, xmm, movdqa)
 
 static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
@@ -443,6 +440,12 @@ static av_always_inline void fdct_row_sse2(const int16_t 
*in, int16_t *out)
 );
 }
 
+#if ARCH_X86_32
+
+DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = { RND_FRW_ROW, 
RND_FRW_ROW };
+
+FDCT_COL(mmx, mm, movq)
+
 static av_always_inline void fdct_row_mmxext(const int16_t *in, int16_t *out,
  const int16_t *table)
 {
@@ -559,9 +562,10 @@ void ff_fdct_mmx(int16_t *block)
 }
 }
 
+#endif /* ARCH_X86_32 */
 #endif /* HAVE_MMX_INLINE */
 
-#if HAVE_MMXEXT_INLINE
+#if HAVE_MMXEXT_INLINE && ARCH_X86_32
 
 void ff_fdct_mmxext(int16_t *block)
 {
diff --git a/libavcodec/x86/fdctdsp_init.c b/libavcodec/x86/fdctdsp_init.c
index 0cb5fd625b..b801e57701 100644
--- a/libavcodec/x86/fdctdsp_init.c
+++ b/libavcodec/x86/fdctdsp_init.c
@@ -31,11 +31,13 @@ av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c, 
AVCodecContext *avctx,
 
 if (!high_bit_depth) {
 if ((dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX)) {
+#if ARCH_X86_32
 if (INLINE_MMX(cpu_flags))
 c->fdct = ff_fdct_mmx;
 
 if (INLINE_MMXEXT(cpu_flags))
 c->fdct = ff_fdct_mmxext;
+#endif
 
 if (INLINE_SSE2(cpu_flags))
 c->fdct = ff_fdct_sse2;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 15/41] avcodec/x86/hevcdsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such hevcdsp
functions at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
FYI: There is a pre-existing stride/alignment bug in this code:
If one configures with --disable-sse3, one gets STRIDE_ALIGN 16.
Then the test fate-hevc-conformance-DBLK_A_MAIN10_VIXS_3 fails
when using SSE2; more exactly, if one comments out both
SAO_BAND_INIT(10, sse2); and SAO_EDGE_INIT(10, sse2); in
x86/hevcdsp_init.c, the test passes. It also passes if one hardcodes
STRIDE_ALIGN to 32 in avcodec_align_dimensions2().

 libavcodec/x86/hevc_idct.asm  | 2 ++
 libavcodec/x86/hevcdsp_init.c | 6 ++
 2 files changed, 8 insertions(+)

diff --git a/libavcodec/x86/hevc_idct.asm b/libavcodec/x86/hevc_idct.asm
index 1eb1973f27..eb44e06123 100644
--- a/libavcodec/x86/hevc_idct.asm
+++ b/libavcodec/x86/hevc_idct.asm
@@ -811,7 +811,9 @@ cglobal hevc_idct_32x32_%1, 1, 6, 16, 256, coeffs
 %macro INIT_IDCT_DC 1
 INIT_MMX mmxext
 IDCT_DC_NL  4,  %1
+%if ARCH_X86_32
 IDCT_DC 8,  2,  %1
+%endif
 
 INIT_XMM sse2
 IDCT_DC_NL  8,  %1
diff --git a/libavcodec/x86/hevcdsp_init.c b/libavcodec/x86/hevcdsp_init.c
index 48f48a925f..b48661fe35 100644
--- a/libavcodec/x86/hevcdsp_init.c
+++ b/libavcodec/x86/hevcdsp_init.c
@@ -712,7 +712,9 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int 
bit_depth)
 if (bit_depth == 8) {
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_mmxext;
+#if ARCH_X86_32
 c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_mmxext;
+#endif
 
 c->add_residual[0] = ff_hevc_add_residual_4_8_mmxext;
 }
@@ -889,7 +891,9 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int 
bit_depth)
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 c->add_residual[0] = ff_hevc_add_residual_4_10_mmxext;
 c->idct_dc[0] = ff_hevc_idct_4x4_dc_10_mmxext;
+#if ARCH_X86_32
 c->idct_dc[1] = ff_hevc_idct_8x8_dc_10_mmxext;
+#endif
 }
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->hevc_v_loop_filter_chroma = 
ff_hevc_v_loop_filter_chroma_10_sse2;
@@ -1105,7 +1109,9 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int 
bit_depth)
 } else if (bit_depth == 12) {
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 c->idct_dc[0] = ff_hevc_idct_4x4_dc_12_mmxext;
+#if ARCH_X86_32
 c->idct_dc[1] = ff_hevc_idct_8x8_dc_12_mmxext;
+#endif
 }
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->hevc_v_loop_filter_chroma = 
ff_hevc_v_loop_filter_chroma_12_sse2;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 16/41] avcodec/x86/rv40dsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such RV40-dsp
functions at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_chromamc.asm |  4 ++--
 libavcodec/x86/rv40dsp.asm   |  2 ++
 libavcodec/x86/rv40dsp_init.c| 10 ++
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index 0421fa8695..d59c183371 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -450,10 +450,10 @@ INIT_MMX 3dnow
 chroma_mc8_mmx_func avg, h264, _rnd
 %if ARCH_X86_32
 chroma_mc8_mmx_func avg, vc1,  _nornd
-%endif
 chroma_mc8_mmx_func avg, rv40
-chroma_mc4_mmx_func avg, h264
 chroma_mc4_mmx_func avg, rv40
+%endif
+chroma_mc4_mmx_func avg, h264
 
 %macro chroma_mc8_ssse3_func 2-3
 cglobal %1_%2_chroma_mc8%3, 6, 7, 8
diff --git a/libavcodec/x86/rv40dsp.asm b/libavcodec/x86/rv40dsp.asm
index bcad1aee80..7fa271a5d5 100644
--- a/libavcodec/x86/rv40dsp.asm
+++ b/libavcodec/x86/rv40dsp.asm
@@ -481,11 +481,13 @@ cglobal rv40_weight_func_%1_%2, 6, 7, 8
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 RV40_WEIGHT   rnd,8, 3
 RV40_WEIGHT   rnd,   16, 4
 RV40_WEIGHT   nornd,  8, 3
 RV40_WEIGHT   nornd, 16, 4
+%endif
 
 INIT_XMM sse2
 RV40_WEIGHT   rnd,8, 3
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index 7a05ab14ad..7a60a30295 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -207,10 +207,12 @@ DEFINE_FN(avg, 16, ssse3)
 
 #if HAVE_MMX_INLINE
 DEFINE_FN(put, 8, mmx)
+#if ARCH_X86_32
 DEFINE_FN(avg, 8, mmx)
 DEFINE_FN(put, 16, mmx)
 DEFINE_FN(avg, 16, mmx)
 #endif
+#endif
 
 av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
 {
@@ -218,10 +220,12 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
 
 #if HAVE_MMX_INLINE
 if (INLINE_MMX(cpu_flags)) {
-c->put_pixels_tab[0][15] = put_rv40_qpel16_mc33_mmx;
 c->put_pixels_tab[1][15] = put_rv40_qpel8_mc33_mmx;
+#if ARCH_X86_32
+c->put_pixels_tab[0][15] = put_rv40_qpel16_mc33_mmx;
 c->avg_pixels_tab[0][15] = avg_rv40_qpel16_mc33_mmx;
 c->avg_pixels_tab[1][15] = avg_rv40_qpel8_mc33_mmx;
+#endif
 }
 #endif /* HAVE_MMX_INLINE */
 
@@ -231,12 +235,10 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
 c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
 #if ARCH_X86_32
 QPEL_MC_SET(put_, _mmx)
-#endif
 }
 if (EXTERNAL_AMD3DNOW(cpu_flags)) {
 c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
 c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
-#if ARCH_X86_32
 QPEL_MC_SET(avg_, _3dnow)
 #endif
 }
@@ -244,11 +246,11 @@ av_cold void ff_rv40dsp_init_x86(RV34DSPContext *c)
 c->avg_pixels_tab[1][15]= avg_rv40_qpel8_mc33_mmxext;
 c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmxext;
 c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmxext;
+#if ARCH_X86_32
 c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_mmxext;
 c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_mmxext;
 c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_mmxext;
 c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_mmxext;
-#if ARCH_X86_32
 QPEL_MC_SET(avg_, _mmxext)
 #endif
 }
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 17/41] avcodec/x86/cavsdsp: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such CAVS-dsp
functions at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/cavsdsp.c| 20 +++-
 libavcodec/x86/cavsidct.asm |  2 ++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index f974f93fc0..fea9daa0ff 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -38,6 +38,7 @@
 
 #if HAVE_MMX_EXTERNAL
 
+#if ARCH_X86_32
 void ff_cavs_idct8_mmx(int16_t *out, const int16_t *in);
 
 static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, ptrdiff_t stride)
@@ -46,6 +47,7 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, 
ptrdiff_t stride)
 ff_cavs_idct8_mmx(b2, block);
 ff_add_pixels_clamped_mmx(b2, dst, stride);
 }
+#endif /* ARCH_X86_32 */
 
 void ff_cavs_idct8_sse2(int16_t *out, const int16_t *in);
 
@@ -335,11 +337,13 @@ static void put_cavs_qpel8_mc00_mmx(uint8_t *dst, const 
uint8_t *src,
 ff_put_pixels8_mmx(dst, src, stride, 8);
 }
 
+#if ARCH_X86_32
 static void avg_cavs_qpel8_mc00_mmx(uint8_t *dst, const uint8_t *src,
 ptrdiff_t stride)
 {
 ff_avg_pixels8_mmx(dst, src, stride, 8);
 }
+#endif
 
 static void avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
@@ -347,6 +351,7 @@ static void avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, const 
uint8_t *src,
 ff_avg_pixels8_mmxext(dst, src, stride, 8);
 }
 
+#if ARCH_X86_32
 static void put_cavs_qpel16_mc00_mmx(uint8_t *dst, const uint8_t *src,
  ptrdiff_t stride)
 {
@@ -364,6 +369,7 @@ static void avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, const 
uint8_t *src,
 {
 ff_avg_pixels16_mmxext(dst, src, stride, 16);
 }
+#endif
 
 static void put_cavs_qpel16_mc00_sse2(uint8_t *dst, const uint8_t *src,
   ptrdiff_t stride)
@@ -382,13 +388,15 @@ static av_cold void cavsdsp_init_mmx(CAVSDSPContext *c,
  AVCodecContext *avctx)
 {
 #if HAVE_MMX_EXTERNAL
-c->put_cavs_qpel_pixels_tab[0][0] = put_cavs_qpel16_mc00_mmx;
 c->put_cavs_qpel_pixels_tab[1][0] = put_cavs_qpel8_mc00_mmx;
+#if ARCH_X86_32
+c->put_cavs_qpel_pixels_tab[0][0] = put_cavs_qpel16_mc00_mmx;
 c->avg_cavs_qpel_pixels_tab[0][0] = avg_cavs_qpel16_mc00_mmx;
 c->avg_cavs_qpel_pixels_tab[1][0] = avg_cavs_qpel8_mc00_mmx;
 
 c->cavs_idct8_add = cavs_idct8_add_mmx;
 c->idct_perm  = FF_IDCT_PERM_TRANSPOSE;
+#endif /* ARCH_X86_32 */
 #endif /* HAVE_MMX_EXTERNAL */
 }
 
@@ -408,7 +416,7 @@ CAVS_MC(avg_,  8, mmxext)
 CAVS_MC(avg_, 16, mmxext)
 #endif /* HAVE_MMXEXT_INLINE */
 
-#if HAVE_AMD3DNOW_INLINE
+#if ARCH_X86_32 && HAVE_AMD3DNOW_INLINE
 QPEL_CAVS(put_,   PUT_OP, 3dnow)
 QPEL_CAVS(avg_, AVG_3DNOW_OP, 3dnow)
 
@@ -425,7 +433,7 @@ static av_cold void cavsdsp_init_3dnow(CAVSDSPContext *c,
 DSPFUNC(avg, 0, 16, 3dnow);
 DSPFUNC(avg, 1,  8, 3dnow);
 }
-#endif /* HAVE_AMD3DNOW_INLINE */
+#endif /* ARCH_X86_32 && HAVE_AMD3DNOW_INLINE */
 
 av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
 {
@@ -434,10 +442,10 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, 
AVCodecContext *avctx)
 if (X86_MMX(cpu_flags))
 cavsdsp_init_mmx(c, avctx);
 
-#if HAVE_AMD3DNOW_INLINE
+#if ARCH_X86_32 && HAVE_AMD3DNOW_INLINE
 if (INLINE_AMD3DNOW(cpu_flags))
 cavsdsp_init_3dnow(c, avctx);
-#endif /* HAVE_AMD3DNOW_INLINE */
+#endif /* ARCH_X86_32 && HAVE_AMD3DNOW_INLINE */
 #if HAVE_MMXEXT_INLINE
 if (INLINE_MMXEXT(cpu_flags)) {
 DSPFUNC(put, 0, 16, mmxext);
@@ -448,7 +456,9 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, 
AVCodecContext *avctx)
 #endif
 #if HAVE_MMX_EXTERNAL
 if (EXTERNAL_MMXEXT(cpu_flags)) {
+#if ARCH_X86_32
 c->avg_cavs_qpel_pixels_tab[0][0] = avg_cavs_qpel16_mc00_mmxext;
+#endif
 c->avg_cavs_qpel_pixels_tab[1][0] = avg_cavs_qpel8_mc00_mmxext;
 }
 #endif
diff --git a/libavcodec/x86/cavsidct.asm b/libavcodec/x86/cavsidct.asm
index 6c768c2646..070b46a6cc 100644
--- a/libavcodec/x86/cavsidct.asm
+++ b/libavcodec/x86/cavsidct.asm
@@ -107,6 +107,7 @@ SECTION .text
 SUMSUB_BA w, 1, 0   ; m1 = dst3, m0 = dst4
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 cglobal cavs_idct8, 2, 4, 8, 8 * 16, out, in, cnt, tmp
 mov   cntd, 2
@@ -168,6 +169,7 @@ cglobal cavs_idct8, 2, 4, 8, 8 * 16, out, in, cnt, tmp
 jg .loop_2
 
 RET
+%endif
 
 INIT_XMM sse2
 cglobal cavs_idct8, 2, 2, 8 + ARCH_X86_64, 0 - 8 * 16, out, in
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To uns

[FFmpeg-devel] [PATCH 18/41] avcodec/x86/h264_intrapred_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such
H.264-intrapred-dsp functions at compile-time.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_intrapred.asm   | 26 +
 libavcodec/x86/h264_intrapred_10bit.asm | 16 +++
 libavcodec/x86/h264_intrapred_init.c| 20 +++
 3 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/libavcodec/x86/h264_intrapred.asm 
b/libavcodec/x86/h264_intrapred.asm
index b36c198fbb..9426598a63 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -48,6 +48,7 @@ cextern pw_8
 ; void ff_pred16x16_vertical_8(uint8_t *src, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 INIT_MMX mmx
 cglobal pred16x16_vertical_8, 2,3
 sub   r0, r1
@@ -63,6 +64,7 @@ cglobal pred16x16_vertical_8, 2,3
 dec   r2
 jg .loop
 REP_RET
+%endif
 
 INIT_XMM sse
 cglobal pred16x16_vertical_8, 2,3
@@ -114,8 +116,10 @@ cglobal pred16x16_horizontal_8, 2,3
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 PRED16x16_H
+%endif
 INIT_MMX mmxext
 PRED16x16_H
 INIT_XMM ssse3
@@ -176,8 +180,10 @@ cglobal pred16x16_dc_8, 2,7
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 PRED16x16_DC
+%endif
 INIT_XMM sse2
 PRED16x16_DC
 INIT_XMM ssse3
@@ -187,6 +193,7 @@ PRED16x16_DC
 ; void ff_pred16x16_tm_vp8_8(uint8_t *src, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 %macro PRED16x16_TM 0
 cglobal pred16x16_tm_vp8_8, 2,5
 subr0, r1
@@ -227,6 +234,7 @@ INIT_MMX mmx
 PRED16x16_TM
 INIT_MMX mmxext
 PRED16x16_TM
+%endif
 
 INIT_XMM sse2
 cglobal pred16x16_tm_vp8_8, 2,6,6
@@ -565,6 +573,7 @@ cglobal pred16x16_plane_%1_8, 2,9,7
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 H264_PRED16x16_PLANE h264
 H264_PRED16x16_PLANE rv40
@@ -573,6 +582,7 @@ INIT_MMX mmxext
 H264_PRED16x16_PLANE h264
 H264_PRED16x16_PLANE rv40
 H264_PRED16x16_PLANE svq3
+%endif
 INIT_XMM sse2
 H264_PRED16x16_PLANE h264
 H264_PRED16x16_PLANE rv40
@@ -747,10 +757,12 @@ ALIGN 16
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 H264_PRED8x8_PLANE
 INIT_MMX mmxext
 H264_PRED8x8_PLANE
+%endif
 INIT_XMM sse2
 H264_PRED8x8_PLANE
 INIT_XMM ssse3
@@ -794,8 +806,10 @@ cglobal pred8x8_horizontal_8, 2,3
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 PRED8x8_H
+%endif
 INIT_MMX mmxext
 PRED8x8_H
 INIT_MMX ssse3
@@ -937,6 +951,7 @@ cglobal pred8x8_dc_rv40_8, 2,7
 ; void ff_pred8x8_tm_vp8_8(uint8_t *src, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 %macro PRED8x8_TM 0
 cglobal pred8x8_tm_vp8_8, 2,6
 subr0, r1
@@ -976,6 +991,7 @@ INIT_MMX mmx
 PRED8x8_TM
 INIT_MMX mmxext
 PRED8x8_TM
+%endif
 
 INIT_XMM sse2
 cglobal pred8x8_tm_vp8_8, 2,6,4
@@ -1333,6 +1349,7 @@ PRED8x8L_VERTICAL
 ;  int has_topright, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 cglobal pred8x8l_down_left_8, 4,5
 sub  r0, r3
@@ -1440,6 +1457,7 @@ cglobal pred8x8l_down_left_8, 4,5
 por mm1, mm0
 movq  [r0+r3*1], mm1
 RET
+%endif
 
 %macro PRED8x8L_DOWN_LEFT 0
 cglobal pred8x8l_down_left_8, 4,4
@@ -1534,6 +1552,7 @@ PRED8x8L_DOWN_LEFT
 ;  int has_topright, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 cglobal pred8x8l_down_right_8, 4,5
 sub  r0, r3
@@ -1665,6 +1684,7 @@ cglobal pred8x8l_down_right_8, 4,5
 pormm0, mm1
 movq [r0+r3*1], mm0
 RET
+%endif
 
 %macro PRED8x8L_DOWN_RIGHT 0
 cglobal pred8x8l_down_right_8, 4,5
@@ -1786,6 +1806,7 @@ PRED8x8L_DOWN_RIGHT
 ;   int has_topright, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 cglobal pred8x8l_vertical_right_8, 4,5
 sub  r0, r3
@@ -1892,6 +1913,7 @@ cglobal pred8x8l_vertical_right_8, 4,5
 PALIGNRmm5, mm0, 7, mm1
 movq [r4+r3*2], mm5
 RET
+%endif
 
 %macro PRED8x8L_VERTICAL_RIGHT 0
 cglobal pred8x8l_vertical_right_8, 4,5,7
@@ -2192,6 +2214,7 @@ PRED8x8L_HORIZONTAL_UP
 ;int has_topright, ptrdiff_t stride)
 ;-
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 cglobal pred8x8l_horizontal_down_8, 4,5
 sub  r0, r3
@@ -2306,6 +2329,7 @@ cglobal pred8x8l_horizontal_down_8, 4,5
 PALIGNRmm3, mm4, 6, mm4
 movq [r0+r3*1], mm3
  

[FFmpeg-devel] [PATCH 19/41] avfilter/x86/vf_noise: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables line_noise_mmx
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/x86/vf_noise.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/x86/vf_noise.c b/libavfilter/x86/vf_noise.c
index f7a4d00336..ce7260e94f 100644
--- a/libavfilter/x86/vf_noise.c
+++ b/libavfilter/x86/vf_noise.c
@@ -25,6 +25,7 @@
 #include "libavfilter/vf_noise.h"
 
 #if HAVE_INLINE_ASM
+#if ARCH_X86_32
 static void line_noise_mmx(uint8_t *dst, const uint8_t *src,
const int8_t *noise, int len, int shift)
 {
@@ -52,6 +53,7 @@ static void line_noise_mmx(uint8_t *dst, const uint8_t *src,
 if (mmx_len != len)
 ff_line_noise_c(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 
0);
 }
+#endif
 
 #if HAVE_6REGS
 static void line_noise_avg_mmx(uint8_t *dst, const uint8_t *src,
@@ -132,7 +134,9 @@ av_cold void ff_noise_init_x86(NoiseContext *n)
 int cpu_flags = av_get_cpu_flags();
 
 if (INLINE_MMX(cpu_flags)) {
+#if ARCH_X86_32
 n->line_noise = line_noise_mmx;
+#endif
 #if HAVE_6REGS
 n->line_noise_avg = line_noise_avg_mmx;
 #endif
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 20/41] avcodec/x86/me_cmp: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such me_cmp functions
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/me_cmp.asm|  6 
 libavcodec/x86/me_cmp_init.c | 61 +---
 2 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/libavcodec/x86/me_cmp.asm b/libavcodec/x86/me_cmp.asm
index ad06d485ab..05e521cb08 100644
--- a/libavcodec/x86/me_cmp.asm
+++ b/libavcodec/x86/me_cmp.asm
@@ -261,11 +261,15 @@ hadamard8_16_wrapper 0, 14
 %endif
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 HADAMARD8_DIFF
+%endif
 
+%if ARCH_X86_32 || HAVE_ALIGNED_STACK == 0
 INIT_MMX mmxext
 HADAMARD8_DIFF
+%endif
 
 INIT_XMM sse2
 %if ARCH_X86_64
@@ -385,10 +389,12 @@ cglobal sum_abs_dctelem, 1, 1, %1, block
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 SUM_ABS_DCTELEM 0, 4
 INIT_MMX mmxext
 SUM_ABS_DCTELEM 0, 4
+%endif
 INIT_XMM sse2
 SUM_ABS_DCTELEM 7, 2
 INIT_XMM ssse3
diff --git a/libavcodec/x86/me_cmp_init.c b/libavcodec/x86/me_cmp_init.c
index 9af911bb88..6144bb9496 100644
--- a/libavcodec/x86/me_cmp_init.c
+++ b/libavcodec/x86/me_cmp_init.c
@@ -126,6 +126,7 @@ static int nsse8_mmx(MpegEncContext *c, uint8_t *pix1, 
uint8_t *pix2,
 
 #if HAVE_INLINE_ASM
 
+#if ARCH_X86_32
 static int vsad_intra16_mmx(MpegEncContext *v, uint8_t *pix, uint8_t *dummy,
 ptrdiff_t stride, int h)
 {
@@ -270,6 +271,7 @@ static int vsad16_mmx(MpegEncContext *v, uint8_t *pix1, 
uint8_t *pix2,
 return tmp & 0x7FFF;
 }
 #undef SUM
+#endif
 
 DECLARE_ASM_CONST(8, uint64_t, round_tab)[3] = {
 0xULL,
@@ -478,20 +480,6 @@ static int sad8_y2_ ## suf(MpegEncContext *v, uint8_t 
*blk2,\
 return sum_ ## suf();   \
 }   \
 \
-static int sad8_xy2_ ## suf(MpegEncContext *v, uint8_t *blk2,   \
-uint8_t *blk1, ptrdiff_t stride, int h) \
-{   \
-av_assert2(h == 8); \
-__asm__ volatile (  \
-"pxor %%mm7, %%mm7 \n\t"\
-"pxor %%mm6, %%mm6 \n\t"\
-::);\
-\
-sad8_4_ ## suf(blk1, blk2, stride, 8);  \
-\
-return sum_ ## suf();   \
-}   \
-\
 static int sad16_ ## suf(MpegEncContext *v, uint8_t *blk2,  \
  uint8_t *blk1, ptrdiff_t stride, int h)\
 {   \
@@ -535,7 +523,8 @@ static int sad16_y2_ ## suf(MpegEncContext *v, uint8_t 
*blk2,   \
 \
 return sum_ ## suf();   \
 }   \
-\
+
+#define PIX_SADXY(suf)  \
 static int sad16_xy2_ ## suf(MpegEncContext *v, uint8_t *blk2,  \
  uint8_t *blk1, ptrdiff_t stride, int h)\
 {   \
@@ -549,8 +538,25 @@ static int sad16_xy2_ ## suf(MpegEncContext *v, uint8_t 
*blk2,  \
 \
 return sum_ ## suf();   \
 }   \
+\
+static int sad8_xy2_ ## suf(MpegEncContext *v, uint8_t *blk2,   \
+uint8_t *blk1, ptrdiff_t stride, int h) \
+{   \
+av_assert2(h == 8); \
+__asm__ volatile (  \
+"pxor %%mm7, %%mm7 \n\t"\
+"pxor %%mm6, %%mm6 \n\t" 

[FFmpeg-devel] [PATCH 21/41] avcodec/x86/mpegvideoencdsp: Disable ff_pix_norm1_mmx on x64

2022-06-09 Thread Andreas Rheinhardt
Forgotten in acebff8e5dc0789c228b10ffcae2f2eb6c30a91d.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/mpegvideoencdsp.asm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/x86/mpegvideoencdsp.asm 
b/libavcodec/x86/mpegvideoencdsp.asm
index aec73f82dc..639abc429d 100644
--- a/libavcodec/x86/mpegvideoencdsp.asm
+++ b/libavcodec/x86/mpegvideoencdsp.asm
@@ -147,8 +147,10 @@ cglobal pix_norm1, 2, 3, %1
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 PIX_NORM1 0, 16
+%endif
 INIT_XMM sse2
 PIX_NORM1 6, 8
 
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 22/41] avcodec/x86/h264dsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables such h264dsp functions
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_deblock.asm | 24 +++---
 libavcodec/x86/h264_idct.asm| 57 +++--
 libavcodec/x86/h264_weight.asm  |  8 +
 libavcodec/x86/h264dsp_init.c   | 21 
 4 files changed, 38 insertions(+), 72 deletions(-)

diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm
index a2e745cd8e..9e671af45c 100644
--- a/libavcodec/x86/h264_deblock.asm
+++ b/libavcodec/x86/h264_deblock.asm
@@ -867,7 +867,6 @@ DEBLOCK_LUMA_INTRA v
 %if ARCH_X86_64 == 0
 INIT_MMX mmxext
 DEBLOCK_LUMA_INTRA v8
-%endif
 
 INIT_MMX mmxext
 
@@ -911,17 +910,8 @@ cglobal deblock_v_chroma_8, 5,6
 ;  int8_t *tc0)
 ;-
 cglobal deblock_h_chroma_8, 5,7
-%if ARCH_X86_64
-; This could use the red zone on 64 bit unix to avoid the stack pointer
-; readjustment, but valgrind assumes the red zone is clobbered on
-; function calls and returns.
-sub   rsp, 16
-%define buf0 [rsp]
-%define buf1 [rsp+8]
-%else
 %define buf0 r0m
 %define buf1 r2m
-%endif
 CHROMA_H_START
 TRANSPOSE4x8_LOAD  bw, wd, dq, PASS8ROWS(t5, r0, r1, t6)
 movq  buf0, m0
@@ -934,9 +924,6 @@ cglobal deblock_h_chroma_8, 5,7
 movq  m0, buf0
 movq  m3, buf1
 TRANSPOSE8x4B_STORE PASS8ROWS(t5, r0, r1, t6)
-%if ARCH_X86_64
-add   rsp, 16
-%endif
 RET
 
 ALIGN 16
@@ -953,13 +940,8 @@ ff_chroma_inter_body_mmxext:
 
 cglobal deblock_h_chroma422_8, 5, 6
 SUB rsp, (1+ARCH_X86_64*2)*mmsize
-%if ARCH_X86_64
-%define buf0 [rsp+16]
-%define buf1 [rsp+8]
-%else
-%define buf0 r0m
-%define buf1 r2m
-%endif
+%define buf0 r0m
+%define buf1 r2m
 
 movd m6, [r4]
 punpcklbw m6, m6
@@ -1059,6 +1041,8 @@ ff_chroma_intra_body_mmxext:
 paddb  m2, m6
 ret
 
+%endif ; ARCH_X86_64 == 0
+
 %macro LOAD_8_ROWS 8
 movd m0, %1
 movd m1, %2
diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
index c54f9f1a68..17c7af388c 100644
--- a/libavcodec/x86/h264_idct.asm
+++ b/libavcodec/x86/h264_idct.asm
@@ -87,12 +87,14 @@ SECTION .text
 STORE_DIFFx2 m2, m3, m4, m5, m7, 6, %1, %3
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 ; void ff_h264_idct_add_8_mmx(uint8_t *dst, int16_t *block, int stride)
 cglobal h264_idct_add_8, 3, 3, 0
 movsxdifnidn r2, r2d
 IDCT4_ADDr0, r1, r2
 RET
+%endif
 
 %macro IDCT8_1D 2
 psrawm0, m1, 1
@@ -207,6 +209,7 @@ cglobal h264_idct_add_8, 3, 3, 0
 STORE_DIFFx2 m1, m2, m5, m6, m7, 6, %1, %3
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 ; void ff_h264_idct8_add_8_mmx(uint8_t *dst, int16_t *block, int stride)
 cglobal h264_idct8_add_8, 3, 4, 0
@@ -223,6 +226,7 @@ cglobal h264_idct8_add_8, 3, 4, 0
 
 ADD rsp, pad
 RET
+%endif
 
 ; %1=uint8_t *dst, %2=int16_t *block, %3=int stride
 %macro IDCT8_ADD_SSE 4
@@ -315,16 +319,7 @@ cglobal h264_idct8_add_8, 3, 4, 10
 %endmacro
 
 INIT_MMX mmxext
-; void ff_h264_idct_dc_add_8_mmxext(uint8_t *dst, int16_t *block, int stride)
 %if ARCH_X86_64
-cglobal h264_idct_dc_add_8, 3, 4, 0
-movsxd   r2, r2d
-movsxr3, word [r1]
-mov  dword [r1], 0
-DC_ADD_MMXEXT_INIT r3, r2
-DC_ADD_MMXEXT_OP movh, r0, r2, r3
-RET
-
 ; void ff_h264_idct8_dc_add_8_mmxext(uint8_t *dst, int16_t *block, int stride)
 cglobal h264_idct8_dc_add_8, 3, 4, 0
 movsxd   r2, r2d
@@ -358,6 +353,7 @@ cglobal h264_idct8_dc_add_8, 2, 3, 0
 %endif
 
 INIT_MMX mmx
+%if ARCH_X86_32
 ; void ff_h264_idct_add16_8_mmx(uint8_t *dst, const int *block_offset,
 ;   int16_t *block, int stride,
 ;   const uint8_t nnzc[6 * 8])
@@ -438,16 +434,12 @@ cglobal h264_idct_add16_8, 5, 8 + npicregs, 0, dst1, 
block_offset, block, stride
 jz .no_dc
 mov   word [r2], 0
 DC_ADD_MMXEXT_INIT r6, r3
-%if ARCH_X86_64 == 0
 %define dst2q r1
 %define dst2d r1d
-%endif
 mov   dst2d, dword [r1+r5*4]
 lea   dst2q, [r0+dst2q]
 DC_ADD_MMXEXT_OP movh, dst2q, r3, r6
-%if ARCH_X86_64 == 0
 mov  r1, r1m
-%endif
 inc  r5
 add  r2, 32
 cmp  r5, 16
@@ -519,16 +511,12 @@ cglobal h264_idct_add16intra_8, 5, 8 + npicregs, 0, dst1, 
block_offset, block, s
 jz .skipblock
 mov   word [r2], 0
 DC_ADD_MMXEXT_INIT r6, r3
-%if ARCH_X86_64 == 0
 %define dst2q r1
 %define dst2d r1d
-%endif
 mov   dst2d, dword [r1+r5*4]
 add   dst2q, r0
 DC_ADD_MMXEXT_OP movh, dst2q, r3, r6
-%if ARCH_X86_64 == 0
 mov  r1, r1m
-%endif
 .skipblock:
 inc  r5
 a

[FFmpeg-devel] [PATCH 23/41] avcodec/x86/sbrdsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
ff_sbr_qmf_deint_bfly_sse (which is overridden by an SSE2 function)
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/sbrdsp.asm| 2 ++
 libavcodec/x86/sbrdsp_init.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index 62bbe512ec..ea5099a5d1 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -286,8 +286,10 @@ cglobal sbr_qmf_deint_bfly, 3,5,8, v,src0,src1,vrev,c
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_XMM sse
 SBR_QMF_DEINT_BFLY
+%endif
 
 INIT_XMM sse2
 SBR_QMF_DEINT_BFLY
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index 6911a1a515..a710f10dc1 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -67,7 +67,9 @@ av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
 s->hf_g_filt  = ff_sbr_hf_g_filt_sse;
 s->hf_gen = ff_sbr_hf_gen_sse;
 s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_sse;
+#if ARCH_X86_32
 s->qmf_deint_bfly   = ff_sbr_qmf_deint_bfly_sse;
+#endif
 s->qmf_deint_neg= ff_sbr_qmf_deint_neg_sse;
 s->autocorrelate= ff_sbr_autocorrelate_sse;
 }
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 24/41] avcodec/x86/idctdsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX as well as the non-64 bit (which are overridden by the 64bit
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/tests/x86/dct.c | 2 +-
 libavcodec/x86/idctdsp.asm | 6 ++
 libavcodec/x86/idctdsp_init.c  | 4 
 libavcodec/x86/simple_idct.asm | 2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tests/x86/dct.c b/libavcodec/tests/x86/dct.c
index 1eb9400567..144d055cff 100644
--- a/libavcodec/tests/x86/dct.c
+++ b/libavcodec/tests/x86/dct.c
@@ -73,7 +73,7 @@ static const struct algo fdct_tab_arch[] = {
 };
 
 static const struct algo idct_tab_arch[] = {
-#if HAVE_MMX_EXTERNAL
+#if ARCH_X86_32 && HAVE_MMX_EXTERNAL
 { "SIMPLE-MMX",  ff_simple_idct_mmx,  FF_IDCT_PERM_SIMPLE, AV_CPU_FLAG_MMX 
},
 #endif
 #if CONFIG_MPEG4_DECODER && HAVE_X86ASM
diff --git a/libavcodec/x86/idctdsp.asm b/libavcodec/x86/idctdsp.asm
index 089425a9ab..701a8c5a43 100644
--- a/libavcodec/x86/idctdsp.asm
+++ b/libavcodec/x86/idctdsp.asm
@@ -74,8 +74,10 @@ cglobal put_signed_pixels_clamped, 3, 4, %1, block, pixels, 
lsize, lsize3
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 PUT_SIGNED_PIXELS_CLAMPED 0
+%endif
 INIT_XMM sse2
 PUT_SIGNED_PIXELS_CLAMPED 3
 
@@ -117,8 +119,10 @@ cglobal put_pixels_clamped, 3, 4, 2, block, pixels, lsize, 
lsize3
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 PUT_PIXELS_CLAMPED
+%endif
 INIT_XMM sse2
 PUT_PIXELS_CLAMPED
 
@@ -177,7 +181,9 @@ cglobal add_pixels_clamped, 3, 3, 5, block, pixels, lsize
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 ADD_PIXELS_CLAMPED
+%endif
 INIT_XMM sse2
 ADD_PIXELS_CLAMPED
diff --git a/libavcodec/x86/idctdsp_init.c b/libavcodec/x86/idctdsp_init.c
index 9103b92ce7..41ba9d68cb 100644
--- a/libavcodec/x86/idctdsp_init.c
+++ b/libavcodec/x86/idctdsp_init.c
@@ -63,6 +63,7 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, 
AVCodecContext *avctx,
 {
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags)) {
 c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx;
 c->put_pixels_clamped= ff_put_pixels_clamped_mmx;
@@ -79,12 +80,14 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, 
AVCodecContext *avctx,
 c->perm_type = FF_IDCT_PERM_SIMPLE;
 }
 }
+#endif
 
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_sse2;
 c->put_pixels_clamped= ff_put_pixels_clamped_sse2;
 c->add_pixels_clamped= ff_add_pixels_clamped_sse2;
 
+#if ARCH_X86_32
 if (!high_bit_depth &&
 avctx->lowres == 0 &&
 (avctx->idct_algo == FF_IDCT_AUTO ||
@@ -94,6 +97,7 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, 
AVCodecContext *avctx,
 c->idct_add  = ff_simple_idct_add_sse2;
 c->perm_type = FF_IDCT_PERM_SIMPLE;
 }
+#endif
 
 if (ARCH_X86_64 &&
 !high_bit_depth &&
diff --git a/libavcodec/x86/simple_idct.asm b/libavcodec/x86/simple_idct.asm
index 6fedbb5784..002fdede90 100644
--- a/libavcodec/x86/simple_idct.asm
+++ b/libavcodec/x86/simple_idct.asm
@@ -25,6 +25,7 @@
 
 %include "libavutil/x86/x86util.asm"
 
+%if ARCH_X86_32
 SECTION_RODATA
 
 cextern pb_80
@@ -887,3 +888,4 @@ cglobal simple_idct_add, 3, 4, 8, 128, pixels, lsize, 
block, t0
 leapixelsq, [pixelsq+lsizeq*2]
 ADD_PIXELS_CLAMPED 96
 RET
+%endif
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 25/41] avcodec/x86/blockdsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/blockdsp.asm| 4 
 libavcodec/x86/blockdsp_init.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/x86/blockdsp.asm b/libavcodec/x86/blockdsp.asm
index 9d203df8f5..dfa38f1d3d 100644
--- a/libavcodec/x86/blockdsp.asm
+++ b/libavcodec/x86/blockdsp.asm
@@ -46,9 +46,11 @@ cglobal clear_block, 1, 1, %1, blocks
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 %define ZERO pxor
 CLEAR_BLOCK 0, 4
+%endif
 INIT_XMM sse
 %define ZERO xorps
 CLEAR_BLOCK 1, 2
@@ -78,9 +80,11 @@ cglobal clear_blocks, 1, 2, %1, blocks, len
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 %define ZERO pxor
 CLEAR_BLOCKS 0
+%endif
 INIT_XMM sse
 %define ZERO xorps
 CLEAR_BLOCKS 1
diff --git a/libavcodec/x86/blockdsp_init.c b/libavcodec/x86/blockdsp_init.c
index d7f8a8e508..3b857a51b6 100644
--- a/libavcodec/x86/blockdsp_init.c
+++ b/libavcodec/x86/blockdsp_init.c
@@ -37,10 +37,12 @@ av_cold void ff_blockdsp_init_x86(BlockDSPContext *c,
 #if HAVE_X86ASM
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags)) {
 c->clear_block  = ff_clear_block_mmx;
 c->clear_blocks = ff_clear_blocks_mmx;
 }
+#endif
 
 if (EXTERNAL_SSE(cpu_flags)) {
 c->clear_block  = ff_clear_block_sse;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 26/41] avcodec/x86/pixblockdsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/pixblockdsp.asm| 4 
 libavcodec/x86/pixblockdsp_init.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/x86/pixblockdsp.asm b/libavcodec/x86/pixblockdsp.asm
index 440fe29bcc..4a6369d7da 100644
--- a/libavcodec/x86/pixblockdsp.asm
+++ b/libavcodec/x86/pixblockdsp.asm
@@ -25,6 +25,7 @@
 
 SECTION .text
 
+%if ARCH_X86_32
 INIT_MMX mmx
 ; void ff_get_pixels_mmx(int16_t *block, const uint8_t *pixels, ptrdiff_t 
stride)
 cglobal get_pixels, 3,4
@@ -48,6 +49,7 @@ cglobal get_pixels, 3,4
 add  r3, 32
 js .loop
 REP_RET
+%endif
 
 INIT_XMM sse2
 cglobal get_pixels, 3, 4, 5
@@ -121,8 +123,10 @@ cglobal diff_pixels, 4,5,5
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 DIFF_PIXELS
+%endif
 
 INIT_XMM sse2
 DIFF_PIXELS
diff --git a/libavcodec/x86/pixblockdsp_init.c 
b/libavcodec/x86/pixblockdsp_init.c
index 3a5eb6959c..684879598e 100644
--- a/libavcodec/x86/pixblockdsp_init.c
+++ b/libavcodec/x86/pixblockdsp_init.c
@@ -36,6 +36,7 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c,
 {
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags)) {
 if (!high_bit_depth) {
 c->get_pixels_unaligned =
@@ -44,6 +45,7 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c,
 c->diff_pixels_unaligned =
 c->diff_pixels = ff_diff_pixels_mmx;
 }
+#endif
 
 if (EXTERNAL_SSE2(cpu_flags)) {
 if (!high_bit_depth) {
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 27/41] avcodec/x86/lossless_audiodsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/lossless_audiodsp.asm| 2 ++
 libavcodec/x86/lossless_audiodsp_init.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/x86/lossless_audiodsp.asm 
b/libavcodec/x86/lossless_audiodsp.asm
index 063d7b41af..ad8a34531a 100644
--- a/libavcodec/x86/lossless_audiodsp.asm
+++ b/libavcodec/x86/lossless_audiodsp.asm
@@ -63,8 +63,10 @@ cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, 
order, mul
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 SCALARPRODUCT
+%endif
 INIT_XMM sse2
 SCALARPRODUCT
 
diff --git a/libavcodec/x86/lossless_audiodsp_init.c 
b/libavcodec/x86/lossless_audiodsp_init.c
index f74c7e4361..f90cab55d3 100644
--- a/libavcodec/x86/lossless_audiodsp_init.c
+++ b/libavcodec/x86/lossless_audiodsp_init.c
@@ -40,8 +40,10 @@ av_cold void ff_llauddsp_init_x86(LLAudDSPContext *c)
 #if HAVE_X86ASM
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMXEXT(cpu_flags))
 c->scalarproduct_and_madd_int16 = 
ff_scalarproduct_and_madd_int16_mmxext;
+#endif
 
 if (EXTERNAL_SSE2(cpu_flags))
 c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 28/41] avcodec/x86/svq1enc_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/svq1enc.asm| 2 ++
 libavcodec/x86/svq1enc_init.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/x86/svq1enc.asm b/libavcodec/x86/svq1enc.asm
index a87632836d..a43d3b4029 100644
--- a/libavcodec/x86/svq1enc.asm
+++ b/libavcodec/x86/svq1enc.asm
@@ -55,7 +55,9 @@ cglobal ssd_int8_vs_int16, 3, 3, 3, pix1, pix2, size
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 SSD_INT8_VS_INT16
+%endif
 INIT_XMM sse2
 SSD_INT8_VS_INT16
diff --git a/libavcodec/x86/svq1enc_init.c b/libavcodec/x86/svq1enc_init.c
index 40b4b0e183..aaebbb92cc 100644
--- a/libavcodec/x86/svq1enc_init.c
+++ b/libavcodec/x86/svq1enc_init.c
@@ -33,9 +33,11 @@ av_cold void ff_svq1enc_init_x86(SVQ1EncContext *c)
 {
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags)) {
 c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_mmx;
 }
+#endif
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_sse2;
 }
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 29/41] avcodec/x86/fmtconvert_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the SSE implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/fmtconvert.asm| 4 
 libavcodec/x86/fmtconvert_init.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index 8f62a0a093..5b7578825a 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -71,8 +71,10 @@ cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, mul, 
len
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_XMM sse
 INT32_TO_FLOAT_FMUL_SCALAR 5
+%endif
 INIT_XMM sse2
 INT32_TO_FLOAT_FMUL_SCALAR 3
 
@@ -117,8 +119,10 @@ cglobal int32_to_float_fmul_array8, 5, 5, 5, c, dst, src, 
mul, len
 RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_XMM sse
 INT32_TO_FLOAT_FMUL_ARRAY8
+%endif
 INIT_XMM sse2
 INT32_TO_FLOAT_FMUL_ARRAY8
 
diff --git a/libavcodec/x86/fmtconvert_init.c b/libavcodec/x86/fmtconvert_init.c
index df097054e4..0883cd8a56 100644
--- a/libavcodec/x86/fmtconvert_init.c
+++ b/libavcodec/x86/fmtconvert_init.c
@@ -43,10 +43,12 @@ av_cold void ff_fmt_convert_init_x86(FmtConvertContext *c, 
AVCodecContext *avctx
 #if HAVE_X86ASM
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_SSE(cpu_flags)) {
 c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse;
 c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_sse;
 }
+#endif
 if (EXTERNAL_SSE2(cpu_flags)) {
 c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2;
 c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_sse2;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 30/41] avcodec/x86/hpeldsp_vp3_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the 3dnow implementation (which is overridden by the MMXEXT
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/hpeldsp_vp3.asm| 4 
 libavcodec/x86/hpeldsp_vp3_init.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/x86/hpeldsp_vp3.asm b/libavcodec/x86/hpeldsp_vp3.asm
index cba96d06cb..284babfd70 100644
--- a/libavcodec/x86/hpeldsp_vp3.asm
+++ b/libavcodec/x86/hpeldsp_vp3.asm
@@ -65,8 +65,10 @@ cglobal put_no_rnd_pixels8_x2_exact, 4,5
 
 INIT_MMX mmxext
 PUT_NO_RND_PIXELS8_X2_EXACT
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_NO_RND_PIXELS8_X2_EXACT
+%endif
 
 
 ; void ff_put_no_rnd_pixels8_y2_exact(uint8_t *block, const uint8_t *pixels, 
ptrdiff_t line_size, int h)
@@ -107,5 +109,7 @@ cglobal put_no_rnd_pixels8_y2_exact, 4,5
 
 INIT_MMX mmxext
 PUT_NO_RND_PIXELS8_Y2_EXACT
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_NO_RND_PIXELS8_Y2_EXACT
+%endif
diff --git a/libavcodec/x86/hpeldsp_vp3_init.c 
b/libavcodec/x86/hpeldsp_vp3_init.c
index 5979f4123c..3c52f9d6f4 100644
--- a/libavcodec/x86/hpeldsp_vp3_init.c
+++ b/libavcodec/x86/hpeldsp_vp3_init.c
@@ -40,12 +40,14 @@ void ff_put_no_rnd_pixels8_y2_exact_3dnow(uint8_t *block,
 
 av_cold void ff_hpeldsp_vp3_init_x86(HpelDSPContext *c, int cpu_flags, int 
flags)
 {
+#if ARCH_X86_32
 if (EXTERNAL_AMD3DNOW(cpu_flags)) {
 if (flags & AV_CODEC_FLAG_BITEXACT) {
 c->put_no_rnd_pixels_tab[1][1] = 
ff_put_no_rnd_pixels8_x2_exact_3dnow;
 c->put_no_rnd_pixels_tab[1][2] = 
ff_put_no_rnd_pixels8_y2_exact_3dnow;
 }
 }
+#endif
 
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 if (flags & AV_CODEC_FLAG_BITEXACT) {
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 31/41] avcodec/x86/hpeldsp_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the 3dnow implementation (which is overridden by the MMXEXT
specific implementation) as well as some MMX functions
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/fpel.asm   |  2 ++
 libavcodec/x86/hpeldsp.asm| 22 +++
 libavcodec/x86/hpeldsp_init.c | 40 +--
 libavcodec/x86/rnd_template.c |  2 ++
 4 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/libavcodec/x86/fpel.asm b/libavcodec/x86/fpel.asm
index d38a1b1035..8c810265c3 100644
--- a/libavcodec/x86/fpel.asm
+++ b/libavcodec/x86/fpel.asm
@@ -91,7 +91,9 @@ cglobal %1_pixels%2, 4,5,4
 INIT_MMX mmx
 OP_PIXELS put, 4
 OP_PIXELS put, 8
+%if ARCH_X86_32
 OP_PIXELS avg, 8
+%endif
 OP_PIXELS put, 16
 OP_PIXELS avg, 16
 
diff --git a/libavcodec/x86/hpeldsp.asm b/libavcodec/x86/hpeldsp.asm
index ce5d7a4e28..97f9f06539 100644
--- a/libavcodec/x86/hpeldsp.asm
+++ b/libavcodec/x86/hpeldsp.asm
@@ -83,8 +83,10 @@ cglobal put_pixels8_x2, 4,5
 
 INIT_MMX mmxext
 PUT_PIXELS8_X2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_PIXELS8_X2
+%endif
 
 
 ; void ff_put_pixels16_x2(uint8_t *block, const uint8_t *pixels, ptrdiff_t 
line_size, int h)
@@ -127,8 +129,10 @@ cglobal put_pixels16_x2, 4,5
 
 INIT_MMX mmxext
 PUT_PIXELS_16
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_PIXELS_16
+%endif
 ; The 8_X2 macro can easily be used here
 INIT_XMM sse2
 PUT_PIXELS8_X2
@@ -171,8 +175,10 @@ cglobal put_no_rnd_pixels8_x2, 4,5
 
 INIT_MMX mmxext
 PUT_NO_RND_PIXELS8_X2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_NO_RND_PIXELS8_X2
+%endif
 
 
 ; void ff_put_pixels8_y2(uint8_t *block, const uint8_t *pixels, ptrdiff_t 
line_size, int h)
@@ -209,8 +215,10 @@ cglobal put_pixels8_y2, 4,5
 
 INIT_MMX mmxext
 PUT_PIXELS8_Y2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_PIXELS8_Y2
+%endif
 ; actually, put_pixels16_y2_sse2
 INIT_XMM sse2
 PUT_PIXELS8_Y2
@@ -249,8 +257,10 @@ cglobal put_no_rnd_pixels8_y2, 4,5
 
 INIT_MMX mmxext
 PUT_NO_RND_PIXELS8_Y2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 PUT_NO_RND_PIXELS8_Y2
+%endif
 
 
 ; void ff_avg_pixels8(uint8_t *block, const uint8_t *pixels, ptrdiff_t 
line_size, int h)
@@ -279,8 +289,10 @@ cglobal avg_pixels8, 4,5
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX 3dnow
 AVG_PIXELS8
+%endif
 
 
 ; void ff_avg_pixels8_x2(uint8_t *block, const uint8_t *pixels, ptrdiff_t 
line_size, int h)
@@ -335,12 +347,16 @@ cglobal avg_pixels8_x2, 4,5
 REP_RET
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 AVG_PIXELS8_X2
+%endif
 INIT_MMX mmxext
 AVG_PIXELS8_X2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 AVG_PIXELS8_X2
+%endif
 ; actually avg_pixels16_x2
 INIT_XMM sse2
 AVG_PIXELS8_X2
@@ -384,8 +400,10 @@ cglobal avg_pixels8_y2, 4,5
 
 INIT_MMX mmxext
 AVG_PIXELS8_Y2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 AVG_PIXELS8_Y2
+%endif
 ; actually avg_pixels16_y2
 INIT_XMM sse2
 AVG_PIXELS8_Y2
@@ -433,8 +451,10 @@ cglobal avg_approx_pixels8_xy2, 4,5
 
 INIT_MMX mmxext
 AVG_APPROX_PIXELS8_XY2
+%if ARCH_X86_32
 INIT_MMX 3dnow
 AVG_APPROX_PIXELS8_XY2
+%endif
 
 
 ; void ff_avg_pixels16_xy2(uint8_t *block, const uint8_t *pixels, ptrdiff_t 
line_size, int h)
@@ -517,8 +537,10 @@ cglobal %1_pixels8_xy2, 4,5
 
 INIT_MMX mmxext
 SET_PIXELS_XY2 avg
+%if ARCH_X86_32
 INIT_MMX 3dnow
 SET_PIXELS_XY2 avg
+%endif
 INIT_XMM sse2
 SET_PIXELS_XY2 put
 SET_PIXELS_XY2 avg
diff --git a/libavcodec/x86/hpeldsp_init.c b/libavcodec/x86/hpeldsp_init.c
index 6336587281..06ba5390d7 100644
--- a/libavcodec/x86/hpeldsp_init.c
+++ b/libavcodec/x86/hpeldsp_init.c
@@ -131,19 +131,25 @@ CALL_2X_PIXELS(put_no_rnd_pixels16_xy2_mmx, 
put_no_rnd_pixels8_xy2_mmx, 8)
 #undef DEF
 #define DEF(x, y) ff_ ## x ## _ ## y ## _mmx
 #define STATIC
+#if ARCH_X86_64
+#define NO_AVG
+#endif
 
 #include "rnd_template.c"
 
+#undef NO_AVG
 #undef DEF
 #undef SET_RND
 #undef PAVGBP
 #undef PAVGB
 
 #if HAVE_MMX
+#if ARCH_X86_32
 CALL_2X_PIXELS(avg_pixels16_y2_mmx, avg_pixels8_y2_mmx, 8)
 CALL_2X_PIXELS(put_pixels16_y2_mmx, put_pixels8_y2_mmx, 8)
 
 CALL_2X_PIXELS_EXPORT(ff_avg_pixels16_xy2_mmx, ff_avg_pixels8_xy2_mmx, 8)
+#endif
 CALL_2X_PIXELS_EXPORT(ff_put_pixels16_xy2_mmx, ff_put_pixels8_xy2_mmx, 8)
 #endif
 
@@ -162,38 +168,49 @@ CALL_2X_PIXELS_EXPORT(ff_put_pixels16_xy2_mmx, 
ff_put_pixels8_xy2_mmx, 8)
 CALL_2X_PIXELS(avg_pixels16_xy2   ## CPUEXT, ff_avg_pixels8_xy2   
## CPUEXT, 8) \
 CALL_2X_PIXELS(avg_approx_pixels16_xy2## CPUEXT, 
ff_avg_approx_pixels8_xy2## CPUEXT, 8)
 
+#if ARCH_X86_32
 HPELDSP_AVG_PIXELS16(_3dnow)
+#endif
 HPELDSP_AVG_PIXELS16(_mmxext)
 
 #endif /* HAVE_X86ASM */
 
 #define SET_HPEL_FUNCS_EXT(PFX, IDX, SIZE, CPU) \
 if (HAVE_MMX_EXTERNAL)  \
-c->PFX ## _pixels_tab IDX [0] = PFX ## _pixels ## SIZE ## _ ## CPU;
+c->PFX ## _

[FFmpeg-devel] [PATCH 32/41] avcodec/x86/h264_qpel: Make functions only used here static

2022-06-09 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_qpel.c | 44 ++
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index dda50ded89..fd1070247b 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -409,13 +409,11 @@ H264_MC_816(H264_MC_HV, ssse3)
 void ff_ ## OP ## _h264_qpel ## NUM ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT \
 (uint8_t *dst, const uint8_t *src, ptrdiff_t stride);
 
-#define LUMA_MC_ALL(DEPTH, TYPE, OPT) \
+#define LUMA_MC_48(DEPTH, TYPE, OPT) \
 LUMA_MC_OP(put,  4, DEPTH, TYPE, OPT) \
 LUMA_MC_OP(avg,  4, DEPTH, TYPE, OPT) \
 LUMA_MC_OP(put,  8, DEPTH, TYPE, OPT) \
-LUMA_MC_OP(avg,  8, DEPTH, TYPE, OPT) \
-LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
-LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
+LUMA_MC_OP(avg,  8, DEPTH, TYPE, OPT)
 
 #define LUMA_MC_816(DEPTH, TYPE, OPT) \
 LUMA_MC_OP(put,  8, DEPTH, TYPE, OPT) \
@@ -423,22 +421,22 @@ void ff_ ## OP ## _h264_qpel ## NUM ## _ ## TYPE ## _ ## 
DEPTH ## _ ## OPT \
 LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
 LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
 
-LUMA_MC_ALL(10, mc00, mmxext)
-LUMA_MC_ALL(10, mc10, mmxext)
-LUMA_MC_ALL(10, mc20, mmxext)
-LUMA_MC_ALL(10, mc30, mmxext)
-LUMA_MC_ALL(10, mc01, mmxext)
-LUMA_MC_ALL(10, mc11, mmxext)
-LUMA_MC_ALL(10, mc21, mmxext)
-LUMA_MC_ALL(10, mc31, mmxext)
-LUMA_MC_ALL(10, mc02, mmxext)
-LUMA_MC_ALL(10, mc12, mmxext)
-LUMA_MC_ALL(10, mc22, mmxext)
-LUMA_MC_ALL(10, mc32, mmxext)
-LUMA_MC_ALL(10, mc03, mmxext)
-LUMA_MC_ALL(10, mc13, mmxext)
-LUMA_MC_ALL(10, mc23, mmxext)
-LUMA_MC_ALL(10, mc33, mmxext)
+LUMA_MC_48(10, mc00, mmxext)
+LUMA_MC_48(10, mc10, mmxext)
+LUMA_MC_48(10, mc20, mmxext)
+LUMA_MC_48(10, mc30, mmxext)
+LUMA_MC_48(10, mc01, mmxext)
+LUMA_MC_48(10, mc11, mmxext)
+LUMA_MC_48(10, mc21, mmxext)
+LUMA_MC_48(10, mc31, mmxext)
+LUMA_MC_48(10, mc02, mmxext)
+LUMA_MC_48(10, mc12, mmxext)
+LUMA_MC_48(10, mc22, mmxext)
+LUMA_MC_48(10, mc32, mmxext)
+LUMA_MC_48(10, mc03, mmxext)
+LUMA_MC_48(10, mc13, mmxext)
+LUMA_MC_48(10, mc23, mmxext)
+LUMA_MC_48(10, mc33, mmxext)
 
 LUMA_MC_816(10, mc00, sse2)
 LUMA_MC_816(10, mc10, sse2)
@@ -464,7 +462,7 @@ LUMA_MC_816(10, mc23, sse2)
 LUMA_MC_816(10, mc33, sse2)
 
 #define QPEL16_OPMC(OP, MC, MMX)\
-void ff_ ## OP ## _h264_qpel16_ ## MC ## _10_ ## MMX(uint8_t *dst, const 
uint8_t *src, ptrdiff_t stride){\
+static void OP ## _h264_qpel16_ ## MC ## _10_ ## MMX(uint8_t *dst, const 
uint8_t *src, ptrdiff_t stride){\
 ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst   , src   , stride);\
 ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
 src += 8*stride;\
@@ -553,8 +551,8 @@ av_cold void ff_h264qpel_init_x86(H264QpelContext *c, int 
bit_depth)
 SET_QPEL_FUNCS(avg_h264_qpel, 2,  4, mmxext, );
 } else if (bit_depth == 10) {
 #if ARCH_X86_32
-SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_mmxext, ff_);
-SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_mmxext, ff_);
+SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_mmxext, );
+SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_mmxext, );
 SET_QPEL_FUNCS(put_h264_qpel, 1,  8, 10_mmxext, ff_);
 SET_QPEL_FUNCS(avg_h264_qpel, 1,  8, 10_mmxext, ff_);
 #endif
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 33/41] avcodec/x86/h264_qpel: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables several MMXEXT
functions (that are overridden by SSE2 functions)
at compile-time for x64.

Notice that some 10-bit SSE2 functions are overridden by sse2_cache64
functions in the same code block. This is suboptimal and the functions
that are overridden should either be removed or the sse2_cache64
functions be put behind suitable checks. This commit does neither.

Signed-off-by: Andreas Rheinhardt 
---
I would love to get input on what to do with these sse2_cache64
functions. If no one says anything, I will send a patch that
retains the current behaviour and removes the functions
overridden by the sse2_cache64 functions.

 libavcodec/x86/h264_qpel.c| 44 +--
 libavcodec/x86/h264_qpel_8bit.asm |  4 +++
 2 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index fd1070247b..cb5f8a126c 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -236,7 +236,11 @@ static av_always_inline void ff_ ## OPNAME ## 
h264_qpel16_hv_lowpass_ ## MMX(uin
 #define ff_put_h264_qpel8or16_hv2_lowpass_sse2 
ff_put_h264_qpel8or16_hv2_lowpass_mmxext
 #define ff_avg_h264_qpel8or16_hv2_lowpass_sse2 
ff_avg_h264_qpel8or16_hv2_lowpass_mmxext
 
-#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \
+#define H264_MC_C_H(OPNAME, SIZE, MMX, ALIGN) \
+H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\
+H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\
+
+#define H264_MC_C_V_H_HV(OPNAME, SIZE, MMX, ALIGN) \
 H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\
 H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\
 H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\
@@ -372,13 +376,9 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## 
MMX(uint8_t *dst, const uin
 ff_ ## OPNAME ## pixels ## SIZE ## _l2_shift5_mmxext(dst, halfV+3, halfHV, 
stride, SIZE, SIZE);\
 }\
 
-#define H264_MC_4816(MMX)\
-H264_MC(put_, 4, MMX, 8)\
-H264_MC(put_, 8, MMX, 8)\
-H264_MC(put_, 16,MMX, 8)\
-H264_MC(avg_, 4, MMX, 8)\
-H264_MC(avg_, 8, MMX, 8)\
-H264_MC(avg_, 16,MMX, 8)\
+#define H264_MC(QPEL, SIZE, MMX, ALIGN)\
+QPEL(put_, SIZE, MMX, ALIGN) \
+QPEL(avg_, SIZE, MMX, ALIGN) \
 
 #define H264_MC_816(QPEL, XMM)\
 QPEL(put_, 8, XMM, 16)\
@@ -397,7 +397,14 @@ QPEL_H264_H_XMM(avg_,AVG_MMXEXT_OP, ssse3)
 QPEL_H264_HV_XMM(put_,   PUT_OP, ssse3)
 QPEL_H264_HV_XMM(avg_,AVG_MMXEXT_OP, ssse3)
 
-H264_MC_4816(mmxext)
+H264_MC(H264_MC_C_V_H_HV, 4, mmxext, 8)
+#if ARCH_X86_32
+H264_MC(H264_MC_C_V_H_HV, 8, mmxext, 8)
+H264_MC(H264_MC_C_V_H_HV, 16, mmxext, 8)
+#else
+H264_MC(H264_MC_C_H, 8, mmxext, 8)
+H264_MC(H264_MC_C_H, 16, mmxext, 8)
+#endif
 H264_MC_816(H264_MC_V, sse2)
 H264_MC_816(H264_MC_HV, sse2)
 H264_MC_816(H264_MC_H, ssse3)
@@ -499,12 +506,16 @@ QPEL16(mmxext)
 
 #endif /* HAVE_X86ASM */
 
-#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX)  \
+#define SET_QPEL_FUNCS0123(PFX, IDX, SIZE, CPU, PREFIX)  \
 do { \
 c->PFX ## _pixels_tab[IDX][ 0] = PREFIX ## PFX ## SIZE ## _mc00_ ## CPU; \
 c->PFX ## _pixels_tab[IDX][ 1] = PREFIX ## PFX ## SIZE ## _mc10_ ## CPU; \
 c->PFX ## _pixels_tab[IDX][ 2] = PREFIX ## PFX ## SIZE ## _mc20_ ## CPU; \
 c->PFX ## _pixels_tab[IDX][ 3] = PREFIX ## PFX ## SIZE ## _mc30_ ## CPU; \
+} while (0)
+#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX)  \
+do { \
+SET_QPEL_FUNCS0123(PFX, IDX, SIZE, CPU, PREFIX); \
 c->PFX ## _pixels_tab[IDX][ 4] = PREFIX ## PFX ## SIZE ## _mc01_ ## CPU; \
 c->PFX ## _pixels_tab[IDX][ 5] = PREFIX ## PFX ## SIZE ## _mc11_ ## CPU; \
 c->PFX ## _pixels_tab[IDX][ 6] = PREFIX ## PFX ## SIZE ## _mc21_ ## CPU; \
@@ -543,11 +554,16 @@ av_cold void ff_h264qpel_init_x86(H264QpelContext *c, int 
bit_depth)
 
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 if (!high_bit_depth) {
-SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmxext, );
-SET_QPEL_FUNCS(put_h264_qpel, 1,  8, mmxext, );
+#if ARCH_X86_32
+#define SET_MMXEXT_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) SET_QPEL_FUNCS(PFX, 
IDX, SIZE, CPU, PREFIX)
+#else
+#define SET_MMXEXT_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) 
SET_QPEL_FUNCS0123(PFX, IDX, SIZE, CPU, PREFIX)
+#endif
+SET_MMXEXT_QPEL_FUNCS(put_h264_qpel, 0, 16, mmxext, );
+SET_MMXEXT_QPEL_FUNCS(put_h264_qpel, 1,  8, mmxext, );
 SET_QPEL_FUNCS(put_h264_qpel, 2,  4, mmxext, );
-SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmxext, );
-SET_QPEL_FUNCS(avg_h264_qpel, 1,  8, mmxext, );
+SET_MMXEXT_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmxext, );
+SET_MMXEXT_QPEL_FUNCS(avg_h264_qpel, 1,  8, mmxext, );

[FFmpeg-devel] [PATCH 34/41] avcodec/x86/h264chroma_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the 3dnow implementation (which is overridden by the MMXEXT
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/x86/h264_chromamc.asm | 4 ++--
 libavcodec/x86/h264chroma_init.c | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index d59c183371..5704deed1c 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -446,14 +446,14 @@ chroma_mc4_mmx_func avg, h264
 chroma_mc4_mmx_func avg, rv40
 chroma_mc2_mmx_func avg, h264
 
+%if ARCH_X86_32
 INIT_MMX 3dnow
 chroma_mc8_mmx_func avg, h264, _rnd
-%if ARCH_X86_32
 chroma_mc8_mmx_func avg, vc1,  _nornd
 chroma_mc8_mmx_func avg, rv40
 chroma_mc4_mmx_func avg, rv40
-%endif
 chroma_mc4_mmx_func avg, h264
+%endif
 
 %macro chroma_mc8_ssse3_func 2-3
 cglobal %1_%2_chroma_mc8%3, 6, 7, 8
diff --git a/libavcodec/x86/h264chroma_init.c b/libavcodec/x86/h264chroma_init.c
index 36bf29df02..26883d57e9 100644
--- a/libavcodec/x86/h264chroma_init.c
+++ b/libavcodec/x86/h264chroma_init.c
@@ -77,10 +77,12 @@ av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, 
int bit_depth)
 c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_mmx;
 }
 
+#if ARCH_X86_32
 if (EXTERNAL_AMD3DNOW(cpu_flags) && !high_bit_depth) {
 c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_3dnow;
 c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_3dnow;
 }
+#endif
 
 if (EXTERNAL_MMXEXT(cpu_flags) && !high_bit_depth) {
 c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_mmxext;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 35/41] swresample/x86/audio_convert_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libswresample/x86/audio_convert.asm| 2 ++
 libswresample/x86/audio_convert_init.c | 4 
 2 files changed, 6 insertions(+)

diff --git a/libswresample/x86/audio_convert.asm 
b/libswresample/x86/audio_convert.asm
index d441636d3c..d2413f9f04 100644
--- a/libswresample/x86/audio_convert.asm
+++ b/libswresample/x86/audio_convert.asm
@@ -608,6 +608,7 @@ pack_8ch_%2_to_%1_u_int %+ SUFFIX:
 %macro NOP_N 0-6
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmx
 CONV int32, int16, u, 2, 1, INT16_TO_INT32_N, NOP_N
 CONV int32, int16, a, 2, 1, INT16_TO_INT32_N, NOP_N
@@ -616,6 +617,7 @@ CONV int16, int32, a, 1, 2, INT32_TO_INT16_N, NOP_N
 
 PACK_6CH float, float, u, 2, 2, 0, NOP_N, NOP_N
 PACK_6CH float, float, a, 2, 2, 0, NOP_N, NOP_N
+%endif
 
 INIT_XMM sse
 PACK_6CH float, float, u, 2, 2, 7, NOP_N, NOP_N
diff --git a/libswresample/x86/audio_convert_init.c 
b/libswresample/x86/audio_convert_init.c
index a7d5ab89f8..7728c9ae00 100644
--- a/libswresample/x86/audio_convert_init.c
+++ b/libswresample/x86/audio_convert_init.c
@@ -52,15 +52,19 @@ av_cold void swri_audio_convert_init_x86(struct 
AudioConvert *ac,
 ac->simd_f =  ff_int32_to_int16_a_ ## cap;\
 }
 
+#if ARCH_X86_32
 MULTI_CAPS_FUNC(MMX, mmx)
+#endif
 MULTI_CAPS_FUNC(SSE2, sse2)
 
+#if ARCH_X86_32
 if(EXTERNAL_MMX(mm_flags)) {
 if(channels == 6) {
 if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == 
AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == 
AV_SAMPLE_FMT_S32P)
 ac->simd_f =  ff_pack_6ch_float_to_float_a_mmx;
 }
 }
+#endif
 if(EXTERNAL_SSE(mm_flags)) {
 if(channels == 6) {
 if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == 
AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == 
AV_SAMPLE_FMT_S32P)
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 36/41] swresample/x86/rematrix_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by the SSE2
specific implementation) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libswresample/x86/rematrix.asm| 2 ++
 libswresample/x86/rematrix_init.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libswresample/x86/rematrix.asm b/libswresample/x86/rematrix.asm
index 7984b9a729..1c657ff72f 100644
--- a/libswresample/x86/rematrix.asm
+++ b/libswresample/x86/rematrix.asm
@@ -223,11 +223,13 @@ mix_2_1_int16_u_int %+ SUFFIX:
 %endmacro
 
 
+%if ARCH_X86_32
 INIT_MMX mmx
 MIX1_INT16 u
 MIX1_INT16 a
 MIX2_INT16 u
 MIX2_INT16 a
+%endif
 
 INIT_XMM sse
 MIX2_FLT u
diff --git a/libswresample/x86/rematrix_init.c 
b/libswresample/x86/rematrix_init.c
index 0608c74e7f..3981de4277 100644
--- a/libswresample/x86/rematrix_init.c
+++ b/libswresample/x86/rematrix_init.c
@@ -43,10 +43,12 @@ av_cold int swri_rematrix_init_x86(struct SwrContext *s){
 s->mix_2_1_simd = NULL;
 
 if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){
+#if ARCH_X86_32
 if(EXTERNAL_MMX(mm_flags)) {
 s->mix_1_1_simd = ff_mix_1_1_a_int16_mmx;
 s->mix_2_1_simd = ff_mix_2_1_a_int16_mmx;
 }
+#endif
 if(EXTERNAL_SSE2(mm_flags)) {
 s->mix_1_1_simd = ff_mix_1_1_a_int16_sse2;
 s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 37/41] swscale/x86/rgb2rgb: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX and 3dnow implementations (overridden by MMXEXT)
and a single MMXEXT function (overridden by SSE2)
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libswscale/x86/rgb2rgb.c  |  6 ++
 libswscale/x86/rgb2rgb_template.c | 10 ++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 0ab139aca4..d8dfbbca35 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -91,9 +91,11 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset);
 #define COMPILE_TEMPLATE_AVX 0
 
 //MMX versions
+#if ARCH_X86_32
 #undef RENAME
 #define RENAME(a) a ## _mmx
 #include "rgb2rgb_template.c"
+#endif
 
 // MMXEXT versions
 #undef RENAME
@@ -116,6 +118,7 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset);
 #define RENAME(a) a ## _avx
 #include "rgb2rgb_template.c"
 
+#if ARCH_X86_32
 //3DNOW versions
 #undef RENAME
 #undef COMPILE_TEMPLATE_MMXEXT
@@ -128,6 +131,7 @@ DECLARE_ALIGNED(8, extern const uint64_t, ff_bgr2UVOffset);
 #define COMPILE_TEMPLATE_AMD3DNOW 1
 #define RENAME(a) a ## _3dnow
 #include "rgb2rgb_template.c"
+#endif
 
 /*
  RGB15->RGB16 original by Strepto/Astral
@@ -165,10 +169,12 @@ av_cold void rgb2rgb_init_x86(void)
 int cpu_flags = av_get_cpu_flags();
 
 #if HAVE_INLINE_ASM
+#if ARCH_X86_32
 if (INLINE_MMX(cpu_flags))
 rgb2rgb_init_mmx();
 if (INLINE_AMD3DNOW(cpu_flags))
 rgb2rgb_init_3dnow();
+#endif
 if (INLINE_MMXEXT(cpu_flags))
 rgb2rgb_init_mmxext();
 if (INLINE_SSE2(cpu_flags))
diff --git a/libswscale/x86/rgb2rgb_template.c 
b/libswscale/x86/rgb2rgb_template.c
index ae2469e663..ae7af550e0 100644
--- a/libswscale/x86/rgb2rgb_template.c
+++ b/libswscale/x86/rgb2rgb_template.c
@@ -1822,7 +1822,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t 
*src, uint8_t *ydst, uint8_
 #endif /* HAVE_7REGS */
 #endif /* !COMPILE_TEMPLATE_SSE2 */
 
-#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX
+#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX && (ARCH_X86_32 || 
COMPILE_TEMPLATE_SSE2)
 static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, 
uint8_t *dest,
 int width, int height, int src1Stride,
 int src2Stride, int dstStride)
@@ -2185,7 +2185,7 @@ static void RENAME(extract_odd)(const uint8_t *src, 
uint8_t *dst, x86_reg count)
 }
 }
 
-#if !COMPILE_TEMPLATE_AMD3DNOW
+#if !COMPILE_TEMPLATE_AMD3DNOW && ARCH_X86_32
 static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t 
*dst1, x86_reg count)
 {
 dst0+=   count;
@@ -2465,7 +2465,7 @@ static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t 
*udst, uint8_t *vdst, co
 );
 }
 
-#if !COMPILE_TEMPLATE_AMD3DNOW
+#if !COMPILE_TEMPLATE_AMD3DNOW && ARCH_X86_32
 static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, 
const uint8_t *src,
  int width, int height,
  int lumStride, int chromStride, int srcStride)
@@ -2519,7 +2519,9 @@ static av_cold void RENAME(rgb2rgb_init)(void)
 yuy2toyv12 = RENAME(yuy2toyv12);
 vu9_to_vu12= RENAME(vu9_to_vu12);
 yvu9_to_yuy2   = RENAME(yvu9_to_yuy2);
+#if ARCH_X86_32
 uyvytoyuv422   = RENAME(uyvytoyuv422);
+#endif
 yuyvtoyuv422   = RENAME(yuyvtoyuv422);
 #endif /* !COMPILE_TEMPLATE_AMD3DNOW */
 
@@ -2534,7 +2536,7 @@ static av_cold void RENAME(rgb2rgb_init)(void)
 uyvytoyuv420   = RENAME(uyvytoyuv420);
 #endif /* !COMPILE_TEMPLATE_SSE2 */
 
-#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX
+#if !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX && (ARCH_X86_32 || 
COMPILE_TEMPLATE_SSE2)
 interleaveBytes= RENAME(interleaveBytes);
 #endif /* !COMPILE_TEMPLATE_AMD3DNOW && !COMPILE_TEMPLATE_AVX */
 #if !COMPILE_TEMPLATE_AVX || HAVE_AVX_EXTERNAL
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 38/41] swscale/x86/yuv2rgb: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
some MMX functions that are overridden by MMXEXT
at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libswscale/x86/yuv2rgb.c  | 13 +++--
 libswscale/x86/yuv2rgb_template.c |  5 +++--
 libswscale/x86/yuv_2_rgb.asm  |  5 +
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
index 47f45bd7c2..60dcb4b7be 100644
--- a/libswscale/x86/yuv2rgb.c
+++ b/libswscale/x86/yuv2rgb.c
@@ -44,23 +44,22 @@
 //MMX versions
 #if HAVE_MMX
 #undef RENAME
-#undef COMPILE_TEMPLATE_MMXEXT
-#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_MMX
 #define RENAME(a) a ## _mmx
 #include "yuv2rgb_template.c"
+#undef COMPILE_TEMPLATE_MMX
 #endif /* HAVE_MMX */
 
 // MMXEXT versions
 #undef RENAME
-#undef COMPILE_TEMPLATE_MMXEXT
-#define COMPILE_TEMPLATE_MMXEXT 1
+#define COMPILE_TEMPLATE_MMXEXT
 #define RENAME(a) a ## _mmxext
 #include "yuv2rgb_template.c"
+#undef COMPILE_TEMPLATE_MMXEXT
 
 //SSSE3 versions
 #undef RENAME
-#undef COMPILE_TEMPLATE_MMXEXT
-#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSSE3
 #define RENAME(a) a ## _ssse3
 #include "yuv2rgb_template.c"
 
@@ -127,10 +126,12 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
 break;
 } else
 return yuv420_bgr32_mmx;
+#if ARCH_X86_32
 case AV_PIX_FMT_RGB24:
 return yuv420_rgb24_mmx;
 case AV_PIX_FMT_BGR24:
 return yuv420_bgr24_mmx;
+#endif
 case AV_PIX_FMT_RGB565:
 return yuv420_rgb16_mmx;
 case AV_PIX_FMT_RGB555:
diff --git a/libswscale/x86/yuv2rgb_template.c 
b/libswscale/x86/yuv2rgb_template.c
index d506f75e15..b60567b8f6 100644
--- a/libswscale/x86/yuv2rgb_template.c
+++ b/libswscale/x86/yuv2rgb_template.c
@@ -47,7 +47,7 @@ extern void RENAME(ff_yuv_420_bgr24)(x86_reg index, uint8_t 
*image, const uint8_
  const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
  const uint8_t *py_2index);
 
-#if !COMPILE_TEMPLATE_MMXEXT
+#ifndef COMPILE_TEMPLATE_MMXEXT
 extern void RENAME(ff_yuv_420_rgb15)(x86_reg index, uint8_t *image, const 
uint8_t *pu_index,
  const uint8_t *pv_index, const uint64_t 
*pointer_c_dither,
  const uint8_t *py_2index);
@@ -165,6 +165,7 @@ static inline int RENAME(yuva420_bgr32)(SwsContext *c, 
const uint8_t *src[],
 }
 #endif
 
+#if ARCH_X86_32 || !defined(COMPILE_TEMPLATE_MMX)
 static inline int RENAME(yuv420_rgb24)(SwsContext *c, const uint8_t *src[],
int srcStride[],
int srcSliceY, int srcSliceH,
@@ -192,4 +193,4 @@ static inline int RENAME(yuv420_bgr24)(SwsContext *c, const 
uint8_t *src[],
 }
 return srcSliceH;
 }
-
+#endif
diff --git a/libswscale/x86/yuv_2_rgb.asm b/libswscale/x86/yuv_2_rgb.asm
index f968b3a0a2..542e3cb1ab 100644
--- a/libswscale/x86/yuv_2_rgb.asm
+++ b/libswscale/x86/yuv_2_rgb.asm
@@ -69,6 +69,9 @@ SECTION .text
 %ifidn %1, yuva
 %define parameters index, image, pu_index, pv_index, pointer_c_dither, 
py_2index, pa_2index
 %define GPR_num 7
+%else
+%define parameters index, image, pu_index, pv_index, pointer_c_dither, 
py_2index
+%define GPR_num 6
 %endif
 %else
 %define parameters index, image, pu_index, pv_index, pointer_c_dither, 
py_2index
@@ -356,8 +359,10 @@ REP_RET
 %endmacro
 
 INIT_MMX mmx
+%if ARCH_X86_32
 yuv2rgb_fn yuv,  rgb, 24
 yuv2rgb_fn yuv,  bgr, 24
+%endif
 yuv2rgb_fn yuv,  rgb, 32
 yuv2rgb_fn yuv,  bgr, 32
 yuv2rgb_fn yuva, rgb, 32
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 39/41] swscale/x86/swscale: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the MMX implementation (which is overridden by MMXEXT)
at compile-time for x64.

Notice that yuv2yuvX_mmx is not removed, because it is used
by SSE3 and AVX2 as fallback in case of unaligned data and
also for tail processing. I don't know why yuv2yuvX_mmxext
isn't being used for this; an earlier version [1] of
554c2bc7086f49ef5a6a989ad6bc4bc11807eb6f used it, but
the version that was eventually applied does not.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/272124.html

Signed-off-by: Andreas Rheinhardt 
---
There is some issue with 32bit versions of some of the MMX functions
here, leading to failures with the f32le and f32be versions of
gray, gbrp and gbrap. See
https://fate.ffmpeg.org/report.cgi?time=20220609221253&slot=x86_32-debian-kfreebsd-gcc-4.4-cpuflags-mmx
It does not affect x64 and if SSE2 is available, the MMX functions
are overridden by SSE2 functions that don't suffer from this defect.
This is a good reason to remove these overridden functions for x86, too.

 libswscale/x86/swscale.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 73869355b8..5cc174694c 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -55,7 +55,7 @@ DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w)= 
0x0001000100010001ULL;
 
 
 //MMX versions
-#if HAVE_MMX_INLINE
+#if ARCH_X86_32 && HAVE_MMX_INLINE
 #undef RENAME
 #define COMPILE_TEMPLATE_MMXEXT 0
 #define RENAME(a) a ## _mmx
@@ -470,7 +470,7 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c)
 {
 int cpu_flags = av_get_cpu_flags();
 
-#if HAVE_MMX_INLINE
+#if ARCH_X86_32 && HAVE_MMX_INLINE
 if (INLINE_MMX(cpu_flags))
 sws_init_swscale_mmx(c);
 #endif
@@ -479,7 +479,7 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c)
 sws_init_swscale_mmxext(c);
 #endif
 if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)) {
-#if HAVE_MMX_EXTERNAL
+#if ARCH_X86_32 && HAVE_MMX_EXTERNAL
 if (EXTERNAL_MMX(cpu_flags))
 c->yuv2planeX = yuv2yuvX_mmx;
 #endif
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 40/41] avfilter/x86/vf_eq_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
process_mmxext (overridden by process_sse2) at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/x86/vf_eq.asm| 2 ++
 libavfilter/x86/vf_eq_init.c | 4 
 2 files changed, 6 insertions(+)

diff --git a/libavfilter/x86/vf_eq.asm b/libavfilter/x86/vf_eq.asm
index a30a287029..0b55d28c6b 100644
--- a/libavfilter/x86/vf_eq.asm
+++ b/libavfilter/x86/vf_eq.asm
@@ -83,8 +83,10 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, 
brightness, w
 
 %endmacro
 
+%if ARCH_X86_32
 INIT_MMX mmxext
 PROCESS_ONE_LINE 3
+%endif
 
 INIT_XMM sse2
 PROCESS_ONE_LINE 4
diff --git a/libavfilter/x86/vf_eq_init.c b/libavfilter/x86/vf_eq_init.c
index 113056e76b..0ca341e07d 100644
--- a/libavfilter/x86/vf_eq_init.c
+++ b/libavfilter/x86/vf_eq_init.c
@@ -31,6 +31,7 @@ extern void ff_process_one_line_sse2(const uint8_t *src, 
uint8_t *dst, short con
  short brightness, int w);
 
 #if HAVE_X86ASM
+#if ARCH_X86_32
 static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride,
const uint8_t *src, int src_stride, int w, int h)
 {
@@ -45,6 +46,7 @@ static void process_mmxext(EQParameters *param, uint8_t *dst, 
int dst_stride,
 }
 emms_c();
 }
+#endif
 
 static void process_sse2(EQParameters *param, uint8_t *dst, int dst_stride,
  const uint8_t *src, int src_stride, int w, int h)
@@ -65,9 +67,11 @@ av_cold void ff_eq_init_x86(EQContext *eq)
 {
 #if HAVE_X86ASM
 int cpu_flags = av_get_cpu_flags();
+#if ARCH_X86_32
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 eq->process = process_mmxext;
 }
+#endif
 if (EXTERNAL_SSE2(cpu_flags)) {
 eq->process = process_sse2;
 }
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 41/41] avutil/x86/pixelutils_init: Disable overridden functions on x64

2022-06-09 Thread Andreas Rheinhardt
x64 always has MMX, MMXEXT, SSE and SSE2 and this means
that some functions for MMX, MMXEXT, SSE and 3dnow are always
overridden by other functions (unless one e.g. explicitly
disables SSE2). This commit therefore disables
the 8x8 MMX (overridden by MMXEXT) as well as the 16x16 MMXEXT
(overridden by SSE2) sad functions at compile-time for x64.

Signed-off-by: Andreas Rheinhardt 
---
 libavutil/x86/pixelutils.asm| 4 
 libavutil/x86/pixelutils_init.c | 4 
 2 files changed, 8 insertions(+)

diff --git a/libavutil/x86/pixelutils.asm b/libavutil/x86/pixelutils.asm
index 8b45ead78b..ea79186e19 100644
--- a/libavutil/x86/pixelutils.asm
+++ b/libavutil/x86/pixelutils.asm
@@ -25,6 +25,7 @@
 
 SECTION .text
 
+%if ARCH_X86_32
 
;---
 ; int ff_pixelutils_sad_8x8_mmx(const uint8_t *src1, ptrdiff_t stride1,
 ;   const uint8_t *src2, ptrdiff_t stride2);
@@ -62,6 +63,7 @@ cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, 
stride2
 movdeax, m6
 movzx   eax, ax
 RET
+%endif
 
 
;---
 ; int ff_pixelutils_sad_8x8_mmxext(const uint8_t *src1, ptrdiff_t stride1,
@@ -83,6 +85,7 @@ cglobal pixelutils_sad_8x8, 4,4,0, src1, stride1, src2, 
stride2
 movdeax, m2
 RET
 
+%if ARCH_X86_32
 
;---
 ; int ff_pixelutils_sad_16x16_mmxext(const uint8_t *src1, ptrdiff_t stride1,
 ;const uint8_t *src2, ptrdiff_t stride2);
@@ -102,6 +105,7 @@ cglobal pixelutils_sad_16x16, 4,4,0, src1, stride1, src2, 
stride2
 %endrep
 movdeax, m2
 RET
+%endif
 
 
;---
 ; int ff_pixelutils_sad_16x16_sse2(const uint8_t *src1, ptrdiff_t stride1,
diff --git a/libavutil/x86/pixelutils_init.c b/libavutil/x86/pixelutils_init.c
index 184a3a4a9f..e74d5634d7 100644
--- a/libavutil/x86/pixelutils_init.c
+++ b/libavutil/x86/pixelutils_init.c
@@ -53,9 +53,11 @@ void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, 
int aligned)
 {
 int cpu_flags = av_get_cpu_flags();
 
+#if ARCH_X86_32
 if (EXTERNAL_MMX(cpu_flags)) {
 sad[2] = ff_pixelutils_sad_8x8_mmx;
 }
+#endif
 
 // The best way to use SSE2 would be to do 2 SADs in parallel,
 // but we'd have to modify the pixelutils API to return SIMD functions.
@@ -65,7 +67,9 @@ void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, 
int aligned)
 // so just use the MMX 8x8 version even when SSE2 is available.
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 sad[2] = ff_pixelutils_sad_8x8_mmxext;
+#if ARCH_X86_32
 sad[3] = ff_pixelutils_sad_16x16_mmxext;
+#endif
 }
 
 if (EXTERNAL_SSE2(cpu_flags)) {
-- 
2.34.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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4] libavcodec/qsvenc: add ROI support to qsv encoder

2022-06-09 Thread Xiang, Haihao
On Wed, 2022-06-08 at 13:02 +0800, Wenbin Chen wrote:
> Use The mfxEncoderCtrl parameter to enable ROI. Get side data
> "AVRegionOfInterest" and use it to configure "mfxExtEncoderROI" which is
> the MediaSDK's ROI configuration.
> 
> Signed-off-by: Wenbin Chen 
> ---
>  libavcodec/qsv_internal.h |  4 ++
>  libavcodec/qsvenc.c   | 85 +++
>  2 files changed, 89 insertions(+)
> 
> diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
> index e2aecdcbd6..8131acdae9 100644
> --- a/libavcodec/qsv_internal.h
> +++ b/libavcodec/qsv_internal.h
> @@ -51,6 +51,9 @@
>  #define ASYNC_DEPTH_DEFAULT 4   // internal parallelism
>  
>  #define QSV_MAX_ENC_PAYLOAD 2   // # of mfxEncodeCtrl payloads supported
> +#define QSV_MAX_ENC_EXTPARAM 2
> +
> +#define QSV_MAX_ROI_NUM 256
>  
>  #define QSV_MAX_FRAME_EXT_PARAMS 4
>  
> @@ -83,6 +86,7 @@ typedef struct QSVFrame {
>  int num_ext_params;
>  
>  mfxPayload *payloads[QSV_MAX_ENC_PAYLOAD]; ///< used for enc_ctrl.Payload
> +mfxExtBuffer *extparam[QSV_MAX_ENC_EXTPARAM]; ///< used for
> enc_ctrl.ExtParam
>  
>  int queued;
>  int used;
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 03e9e5523d..902bada55b 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1390,15 +1390,29 @@ static void free_encoder_ctrl_payloads(mfxEncodeCtrl*
> enc_ctrl)
>  }
>  }
>  
> +static void free_encoder_ctrl_extparam(mfxEncodeCtrl* enc_ctrl)
> +{
> +if (enc_ctrl) {
> +int i;
> +for (i = 0; i < enc_ctrl->NumExtParam && i < QSV_MAX_ENC_EXTPARAM;
> i++) {
> +if (enc_ctrl->ExtParam[i])
> +av_freep(&(enc_ctrl->ExtParam[i]));
> +}
> +enc_ctrl->NumExtParam = 0;
> +}
> +}
> +
>  static void clear_unused_frames(QSVEncContext *q)
>  {
>  QSVFrame *cur = q->work_frames;
>  while (cur) {
>  if (cur->used && !cur->surface.Data.Locked) {
>  free_encoder_ctrl_payloads(&cur->enc_ctrl);
> +free_encoder_ctrl_extparam(&cur->enc_ctrl);
>  //do not reuse enc_ctrl from previous frame
>  memset(&cur->enc_ctrl, 0, sizeof(cur->enc_ctrl));
>  cur->enc_ctrl.Payload = cur->payloads;
> +cur->enc_ctrl.ExtParam = cur->extparam;
>  if (cur->frame->format == AV_PIX_FMT_QSV) {
>  av_frame_unref(cur->frame);
>  }
> @@ -1436,6 +1450,7 @@ static int get_free_frame(QSVEncContext *q, QSVFrame
> **f)
>  return AVERROR(ENOMEM);
>  }
>  frame->enc_ctrl.Payload = frame->payloads;
> +frame->enc_ctrl.ExtParam = frame->extparam;
>  *last = frame;
>  
>  *f = frame;
> @@ -1537,6 +1552,67 @@ static void print_interlace_msg(AVCodecContext *avctx,
> QSVEncContext *q)
>  }
>  }
>  
> +static int set_roi_encode_ctrl(AVCodecContext *avctx, const AVFrame *frame,
> +   mfxEncodeCtrl *enc_ctrl)
> +{
> +AVFrameSideData *sd = NULL;
> +int mb_size;
> +
> +if (avctx->codec_id == AV_CODEC_ID_H264)
> +mb_size = 16;
> +else if (avctx->codec_id == AV_CODEC_ID_H265)
> +mb_size = 32;
> +else
> +return 0;
> +
> +if (frame)
> +sd = av_frame_get_side_data(frame,
> AV_FRAME_DATA_REGIONS_OF_INTEREST);
> +
> +if (sd) {
> +mfxExtEncoderROI *enc_roi = NULL;
> +AVRegionOfInterest *roi;
> +uint32_t roi_size;
> +int nb_roi, i;
> +
> +roi = (AVRegionOfInterest *)sd->data;
> +roi_size = roi->self_size;
> +if (!roi_size || sd->size % roi_size) {
> +av_log(avctx, AV_LOG_ERROR, "Invalid ROI Data.\n");
> +return AVERROR(EINVAL);
> +}
> +nb_roi = sd->size / roi_size;
> +if (nb_roi > QSV_MAX_ROI_NUM) {
> +av_log(avctx, AV_LOG_WARNING, "More ROIs set than "
> +"supported by driver (%d > %d).\n",
> +nb_roi, QSV_MAX_ROI_NUM);
> +nb_roi = QSV_MAX_ROI_NUM;
> +}
> +
> +enc_roi = av_mallocz(sizeof(*enc_roi));
> +if (!enc_roi)
> +return AVERROR(ENOMEM);
> +enc_roi->Header.BufferId = MFX_EXTBUFF_ENCODER_ROI;
> +enc_roi->Header.BufferSz = sizeof(*enc_roi);
> +enc_roi->NumROI  = nb_roi;
> +enc_roi->ROIMode = MFX_ROI_MODE_QP_DELTA;
> +for (i = 0; i < nb_roi; i++) {
> +roi = (AVRegionOfInterest *)(sd->data + roi_size * i);
> +enc_roi->ROI[i].Top= FFALIGN(roi->top, mb_size);
> +enc_roi->ROI[i].Bottom = FFALIGN(roi->bottom, mb_size);
> +enc_roi->ROI[i].Left   = FFALIGN(roi->left, mb_size);
> +enc_roi->ROI[i].Right  = FFALIGN(roi->right, mb_size);
> +enc_roi->ROI[i].DeltaQP =
> +roi->qoffset.num * 51 / roi->qoffset.den;
> +av_log(avctx, AV_LOG_DEBUG, "ROI: (%d,%d)-(%d,%d) -> %+d.\n",
> +   roi->top, roi->left, roi->

Re: [FFmpeg-devel] [PATCH v1] lavc/vaapi_hevc: fill rext luma/chroma offset in the right way

2022-06-09 Thread Xiang, Haihao
On Wed, 2022-06-01 at 22:58 +0800, Fei Wang wrote:
> From: Xu Guangxin 
> 
> For range extension, the luma/chroma offset is larger than 8 bits, we
> need fill the 16 bits version.
> 
> Signed-off-by: Xu Guangxin 
> Signed-off-by: Linjie Fu 
> Signed-off-by: Fei Wang 
> ---
>  libavcodec/vaapi_hevc.c | 53 -
>  1 file changed, 37 insertions(+), 16 deletions(-)
> 
> diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
> index 9083331c45..59beb86650 100644
> --- a/libavcodec/vaapi_hevc.c
> +++ b/libavcodec/vaapi_hevc.c
> @@ -322,10 +322,17 @@ fail:
>  return ret;
>  }
>  
> -static void fill_pred_weight_table(const HEVCContext *h,
> +static void fill_pred_weight_table(const AVCodecContext *avctx,
> +   const HEVCContext *h,
> const SliceHeader *sh,
> VASliceParameterBufferHEVC *slice_param)
>  {
> +#if VA_CHECK_VERSION(1, 2, 0)
> +int is_rext = avctx->profile >= FF_PROFILE_HEVC_REXT;
> +#else
> +int is_rext = 0;

It will uses the wrong luma/offset for REXT stream when vaapi < 1.2 , right ? I
think it would be better to add some warning text to remind user. 

Thanks
Haihao


> +#endif
> +
>  int i;
>  
>  memset(slice_param->delta_luma_weight_l0,   0, sizeof(slice_param-
> >delta_luma_weight_l0));
> @@ -353,21 +360,25 @@ static void fill_pred_weight_table(const HEVCContext *h,
>  
>  for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
>  slice_param->delta_luma_weight_l0[i] = sh->luma_weight_l0[i] - (1 <<
> sh->luma_log2_weight_denom);
> -slice_param->luma_offset_l0[i] = sh->luma_offset_l0[i];
>  slice_param->delta_chroma_weight_l0[i][0] = sh-
> >chroma_weight_l0[i][0] - (1 << sh->chroma_log2_weight_denom);
>  slice_param->delta_chroma_weight_l0[i][1] = sh-
> >chroma_weight_l0[i][1] - (1 << sh->chroma_log2_weight_denom);
> -slice_param->ChromaOffsetL0[i][0] = sh->chroma_offset_l0[i][0];
> -slice_param->ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1];
> +if (!is_rext) {
> +slice_param->luma_offset_l0[i] = sh->luma_offset_l0[i];
> +slice_param->ChromaOffsetL0[i][0] = sh->chroma_offset_l0[i][0];
> +slice_param->ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1];
> +}
>  }
>  
>  if (sh->slice_type == HEVC_SLICE_B) {
>  for (i = 0; i < 15 && i < sh->nb_refs[L1]; i++) {
>  slice_param->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - (1
> << sh->luma_log2_weight_denom);
> -slice_param->luma_offset_l1[i] = sh->luma_offset_l1[i];
>  slice_param->delta_chroma_weight_l1[i][0] = sh-
> >chroma_weight_l1[i][0] - (1 << sh->chroma_log2_weight_denom);
>  slice_param->delta_chroma_weight_l1[i][1] = sh-
> >chroma_weight_l1[i][1] - (1 << sh->chroma_log2_weight_denom);
> -slice_param->ChromaOffsetL1[i][0] = sh->chroma_offset_l1[i][0];
> -slice_param->ChromaOffsetL1[i][1] = sh->chroma_offset_l1[i][1];
> +if (!is_rext) {
> +slice_param->luma_offset_l1[i] = sh->luma_offset_l1[i];
> +slice_param->ChromaOffsetL1[i][0] = sh-
> >chroma_offset_l1[i][0];
> +slice_param->ChromaOffsetL1[i][1] = sh-
> >chroma_offset_l1[i][1];
> +}
>  }
>  }
>  }
> @@ -462,7 +473,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
>  last_slice_param->RefPicList[list_idx][i] = get_ref_pic_index(h,
> rpl->ref[i]);
>  }
>  
> -fill_pred_weight_table(h, sh, last_slice_param);
> +fill_pred_weight_table(avctx, h, sh, last_slice_param);
>  
>  #if VA_CHECK_VERSION(1, 2, 0)
>  if (avctx->profile == FF_PROFILE_HEVC_REXT) {
> @@ -471,15 +482,25 @@ static int vaapi_hevc_decode_slice(AVCodecContext
> *avctx,
>  .cu_chroma_qp_offset_enabled_flag = sh-
> >cu_chroma_qp_offset_enabled_flag,
>  },
>  };
> +for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
> +pic->last_slice_param.rext.luma_offset_l0[i] = sh-
> >luma_offset_l0[i];
> +pic->last_slice_param.rext.ChromaOffsetL0[i][0] = sh-
> >chroma_offset_l0[i][0];
> +pic->last_slice_param.rext.ChromaOffsetL0[i][1] = sh-
> >chroma_offset_l0[i][1];
> +}
> +
> +for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) {
> +pic->last_slice_param.rext.luma_offset_l0[i] = sh-
> >luma_offset_l0[i];
> +pic->last_slice_param.rext.ChromaOffsetL0[i][0] = sh-
> >chroma_offset_l0[i][0];
> +pic->last_slice_param.rext.ChromaOffsetL0[i][1] = sh-
> >chroma_offset_l0[i][1];
> +}
>  
> -memcpy(pic->last_slice_param.rext.luma_offset_l0, pic-
> >last_slice_param.base.luma_offset_l0,
> -sizeof(pic-
> >last_slice_param.base.luma_offset_l0));
> -memcpy(pic->last_slice_param.re