Commit 13b7781e authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (23 commits)
  x86inc: use sse versions of common macros instead of sse2 when applicable
  doc/APIchanges: add missing dates and hashes
  lavf: don't return from void av_update_cur_dts()
  Changelog: add more entries.
  Changelog: update ffmpeg/avconv incompatibility list.
  avconv: remove some redundant temporary variables.
  avconv: fix broken indentation
  avconv: move copy_initial_nonkeyframes to the options context.
  avconv: use file:stream instead of file.stream in log messages.
  doc/avconv: elaborate on basic functionality.
  doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
  openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
  Call avformat_network_init/deinit in the programs
  Remove leftover includes of strings.h
  avutil: Don't allow using strcasecmp/strncasecmp
  Replace all usage of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of toupper/tolower
  cosmetics: insert some spaces in explicit enum value assignments
  move 8SVX audio codecs to the audio codec list part on the next bump
  ...

Conflicts:
	avprobe.c
	doc/APIchanges
	ffplay.c
	ffserver.c
	libavcodec/avcodec.h
	libavdevice/bktr.c
	libavdevice/v4l.c
	libavdevice/v4l2.c
	libavformat/matroskaenc.c
	libavformat/wtv.c
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/avutil.h
	libswscale/x86/swscale_template.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ada8d485 f2bd8a07
......@@ -11,37 +11,72 @@ version next:
- added avconv, which is almost the same for now, except
for a few incompatible changes in the options, which will hopefully make them
easier to use. The changes are:
* -newvideo/-newaudio/-newsubtitle are gone, because they were redundant and
worked in a nonstandard way. -map is sufficient to add streams to output
files.
* -map now has slightly different and more powerful syntax.
+ it's possible to specify stream type. E.g. -map 0:a:2 means 'third
audio stream'.
+ omitting the stream index now maps all the streams of the given
type, not just the first. E.g. -map 0:s maps all the subtitle streams.
+ colons (':') are used to separate file index/stream type/stream
index. Comma (',') is used to separate the sync stream. This is done
for consistency with other options.
+ since -map can now match multiple streams, negative mappings were
* The options placement is now strictly enforced! While in theory the
options for ffmpeg should be given in [input options] -i INPUT [output
options] OUTPUT order, in practice it was possible to give output options
before the -i and it mostly worked. Except when it didn't - the behavior was
a bit inconsistent. In avconv, it is not possible to mix input and output
options. All non-global options are reset after an input or output filename.
* All per-file options are now truly per-file - they apply only to the next
input or output file and specifying different values for different files
will now work properly (notably -ss and -t options).
* All per-stream options are now truly per-stream - it is possible to
specify which stream(s) should a given option apply to. See the Stream
specifiers section in the avconv manual for details.
* In ffmpeg some options (like -newvideo/-newaudio/...) are irregular in the
sense that they're specified after the output filename instead of before,
like all other options. In avconv this irregularity is removed, all options
apply to the next input or output file.
* -newvideo/-newaudio/-newsubtitle options were removed. Not only were they
irregular and highly confusing, they were also redundant. In avconv the -map
option will create new streams in the output file and map input streams to
them. E.g. avconv -i INPUT -map 0 OUTPUT will create an output stream for
each stream in the first input file.
* The -map option now has slightly different and more powerful syntax:
+ Colons (':') are used to separate file index/stream type/stream index
instead of dots. Comma (',') is used to separate the sync stream instead
of colon.. This is done for consistency with other options.
+ It's possible to specify stream type. E.g. -map 0:a:2 creates an
output stream from the third input audio stream.
+ Omitting the stream index now maps all the streams of the given type,
not just the first. E.g. -map 0:s creates output streams for all the
subtitle streams in the first input file.
+ Since -map can now match multiple streams, negative mappings were
introduced. Negative mappings disable some streams from an already
defined map. E.g. '-map 0 -map -0:a:1' means 'map everything except
for the second audio stream'.
* -vcodec/-acodec/-scodec are replaced by -c (or -codec), which
allows to precisely specify target stream(s) consistently with other
options. E.g. '-c:v libx264' sets the codec for all video streams,
'-c:a:0 libvorbis' sets the codec for the first audio stream and '-c
copy' copies all the streams.
defined map. E.g. '-map 0 -map -0:a:1' means 'create output streams for
all the stream in the first input file, except for the second audio
stream'.
* There is a new option -c (or -codec) for choosing the decoder/encoder to
use, which allows to precisely specify target stream(s) consistently with
other options. E.g. -c:v lib264 sets the codec for all video streams, -c:a:0
libvorbis sets the codec for the first audio stream and -c copy copies all
the streams without reencoding. Old -vcodec/-acodec/-scodec options are now
aliases to -c:v/a/s
* It is now possible to precisely specify which stream should an AVOption
apply to. See the manual for detailed explanation.
apply to. E.g. -b:v:0 2M sets the bitrate for the first video stream, while
-b:a 128k sets the bitrate for all audio streams. Note that the old -ab 128k
syntax is deprecated and will stop working soon.
* -map_chapters now takes only an input file index and applies to the next
output file. This is consistent with how all the other options work.
* -map_metadata now takes only an input metadata specifier and applies to
the next output file. Output metadata specifier is now part of the option
name, similarly to the AVOptions/map/codec feature above.
* Presets in avconv are disabled, because only libx264 used them and
presets for libx264 can now be specified using a private option
'-preset <presetname>'.
* -intra option was removed, it's equivalent to -g 0.
* -metadata can now be used to set metadata on streams and chapters, e.g.
-metadata:s:1 language=eng sets the language of the first stream to 'eng'.
This made -vlang/-alang/-slang options redundant, so they were removed.
* -qscale option now uses stream specifiers and applies to all streams, not
just video. I.e. plain -qscale number would now apply to all streams. To get
the old behavior, use -qscale:v. Also there is now a shortcut -q for -qscale
and -aq is now an alias for -q:a.
* -vbsf/-absf/-sbsf options were removed and replaced by a -bsf option which
uses stream specifiers. Use -bsf:v/a/s instead of the old options.
* -itsscale option now uses stream specifiers, so its argument is only the
scale parameter.
* -intra option was removed, use -g 0 for the same effect.
* -psnr option was removed, use -flags +psnr for the same effect.
* -vf option is now an alias to the new -filter option, which uses stream specifiers.
* -vframes/-aframes/-dframes options are now aliases to the new -frames option.
* -vtag/-atag/-stag options are now aliases to the new -tag option.
- XMV demuxer
- LOAS demuxer
- ashowinfo filter added
......@@ -68,6 +103,7 @@ easier to use. The changes are:
- Ut Video decoder
- Speex encoding via libspeex
- 4:2:2 H.264 decoding support
- 4:2:2 and 4:4:4 H.264 encoding with libx264
- Pulseaudio input device
- Prores encoder
- Video Decoder Acceleration (VDA) HWAccel module.
......@@ -77,6 +113,11 @@ easier to use. The changes are:
- earwax audio filter added
- libv4l2 support (--enable-libv4l2)
- TLS/SSL and HTTPS protocol support
- AVOptions API rewritten and documented
- most of CODEC_FLAG2_*, some CODEC_FLAG_* and many codec-specific fields in
AVCodecContext deprecated. Codec private options should be used instead.
- Properly working defaults in libx264 wrapper, support for native presets.
- Encrypted OMA files support
version 0.8:
......
This diff is collapsed.
......@@ -19,7 +19,13 @@ API changes, most recent first:
2011-10-20 - b35e9e1 - lavu 51.22.0
Add av_strtok() to avstring.h.
2011-11-xx - xxxxxxx - lavf 53.13.0
2011-11-06 - ba04ecf - lavu 51.14.0
Add av_strcasecmp() and av_strncasecmp() to avstring.h.
2011-11-06 - 07b172f - lavu 51.13.0
Add av_toupper()/av_tolower()
2011-11-05 - b6d08f4 - lavf 53.13.0
Add avformat_network_init()/avformat_network_uninit()
2011-10-27 - 512557b - lavc 53.15.0
......
......@@ -26,6 +26,23 @@ avconv is a very fast video and audio converter that can also grab from
a live audio/video source. It can also convert between arbitrary sample
rates and resize video on the fly with a high quality polyphase filter.
avconv reads from an arbitrary number of input "files" (which can be regular
files, pipes, network streams, grabbing devices, etc.), specified by the
@code{-i} option, and writes to an arbitrary number of output "files", which are
specified by a plain output filename. Anything found on the commandline which
cannot be interpreted as an option is considered to be an output filename.
Each input or output file can in principle contain any number of streams of
different types (video/audio/subtitle/attachment/data). Allowed number and/or
types of streams can be limited by the container format. Selecting, which
streams from which inputs go into output, is done either automatically or with
the @code{-map} option (see the Stream selection chapter).
To refer to input files in options, you must use their indices (0-based). E.g.
the first input file is @code{0}, the second is @code{1} etc. Similarly, streams
within a file are referred to by their indices. E.g. @code{2:3} refers to the
fourth stream in the third input file. See also the Stream specifiers chapter.
As a general rule, options are applied to the next specified
file. Therefore, order is important, and you can have the same
option on the command line multiple times. Each occurrence is
......@@ -33,6 +50,10 @@ then applied to the next input or output file.
Exceptions from this rule are the global options (e.g. verbosity level),
which should be specified first.
Do not mix input and output files -- first specify all input files, then all
output files. Also do not mix options which belong to different files. All
options apply ONLY to the next input or output file and are reset between files.
@itemize
@item
To set the video bitrate of the output file to 64kbit/s:
......@@ -525,6 +546,10 @@ frames after each specified time.
This option can be useful to ensure that a seek point is present at a
chapter mark or any other designated place in the output file.
The timestamps must be specified in ascending order.
@item -copyinkf[:@var{stream_specifier}] (@emph{output,per-stream})
When doing stream copy, copy also non-key frames found at the
beginning.
@end table
@section Audio Options
......@@ -549,7 +574,7 @@ Disable audio recording.
@item -acodec @var{codec} (@emph{input/output})
Set the audio codec. This is an alias for @code{-codec:a}.
@item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream})
Set the audio sample format. Use @code{-help sample_fmts} to get a list
Set the audio sample format. Use @code{-sample_fmts} to get a list
of supported sample formats.
@end table
......
This diff is collapsed.
......@@ -914,6 +914,7 @@ static void do_exit(VideoState *is)
#if CONFIG_AVFILTER
avfilter_uninit();
#endif
avformat_network_deinit();
if (show_status)
printf("\n");
SDL_Quit();
......@@ -3143,6 +3144,7 @@ int main(int argc, char **argv)
avfilter_register_all();
#endif
av_register_all();
avformat_network_init();
init_opts();
......
......@@ -936,6 +936,7 @@ int main(int argc, char **argv)
parse_loglevel(argc, argv, options);
av_register_all();
avformat_network_init();
init_opts();
#if CONFIG_AVDEVICE
avdevice_register_all();
......@@ -953,5 +954,7 @@ int main(int argc, char **argv)
ret = probe_file(input_filename);
avformat_network_deinit();
return ret;
}
This diff is collapsed.
......@@ -153,7 +153,9 @@ enum CodecID {
CODEC_ID_TIERTEXSEQVIDEO,
CODEC_ID_TIFF,
CODEC_ID_GIF,
#if LIBAVCODEC_VERSION_MAJOR == 53
CODEC_ID_FFH264,
#endif
CODEC_ID_DXA,
CODEC_ID_DNXHD,
CODEC_ID_THP,
......@@ -171,8 +173,10 @@ enum CodecID {
CODEC_ID_INDEO5,
CODEC_ID_MIMIC,
CODEC_ID_RL2,
#if LIBAVCODEC_VERSION_MAJOR == 53
CODEC_ID_8SVX_EXP,
CODEC_ID_8SVX_FIB,
#endif
CODEC_ID_ESCAPE124,
CODEC_ID_DIRAC,
CODEC_ID_BFI,
......@@ -222,7 +226,7 @@ enum CodecID {
/* various PCM "codecs" */
CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
CODEC_ID_PCM_S16LE= 0x10000,
CODEC_ID_PCM_S16LE = 0x10000,
CODEC_ID_PCM_S16BE,
CODEC_ID_PCM_U16LE,
CODEC_ID_PCM_U16BE,
......@@ -251,7 +255,7 @@ enum CodecID {
CODEC_ID_S302M,
/* various ADPCM codecs */
CODEC_ID_ADPCM_IMA_QT= 0x11000,
CODEC_ID_ADPCM_IMA_QT = 0x11000,
CODEC_ID_ADPCM_IMA_WAV,
CODEC_ID_ADPCM_IMA_DK3,
CODEC_ID_ADPCM_IMA_DK4,
......@@ -282,21 +286,21 @@ enum CodecID {
CODEC_ID_ADPCM_G722,
/* AMR */
CODEC_ID_AMR_NB= 0x12000,
CODEC_ID_AMR_NB = 0x12000,
CODEC_ID_AMR_WB,
/* RealAudio codecs*/
CODEC_ID_RA_144= 0x13000,
CODEC_ID_RA_144 = 0x13000,
CODEC_ID_RA_288,
/* various DPCM codecs */
CODEC_ID_ROQ_DPCM= 0x14000,
CODEC_ID_ROQ_DPCM = 0x14000,
CODEC_ID_INTERPLAY_DPCM,
CODEC_ID_XAN_DPCM,
CODEC_ID_SOL_DPCM,
/* audio codecs */
CODEC_ID_MP2= 0x15000,
CODEC_ID_MP2 = 0x15000,
CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
CODEC_ID_AAC,
CODEC_ID_AC3,
......@@ -308,8 +312,10 @@ enum CodecID {
CODEC_ID_MACE3,
CODEC_ID_MACE6,
CODEC_ID_VMDAUDIO,
#if LIBAVCODEC_VERSION_MAJOR == 53
CODEC_ID_SONIC,
CODEC_ID_SONIC_LS,
#endif
CODEC_ID_FLAC,
CODEC_ID_MP3ADU,
CODEC_ID_MP3ON4,
......@@ -354,6 +360,8 @@ enum CodecID {
#if LIBAVCODEC_VERSION_MAJOR > 53
CODEC_ID_G723_1_DEPRECATED,
CODEC_ID_G729_DEPRECATED,
CODEC_ID_8SVX_EXP,
CODEC_ID_8SVX_FIB,
#endif
CODEC_ID_G729 = 0x15800,
CODEC_ID_G723_1= 0x15801,
......@@ -361,7 +369,7 @@ enum CodecID {
/* subtitle codecs */
CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
CODEC_ID_DVD_SUBTITLE= 0x17000,
CODEC_ID_DVD_SUBTITLE = 0x17000,
CODEC_ID_DVB_SUBTITLE,
CODEC_ID_TEXT, ///< raw UTF-8 text
CODEC_ID_XSUB,
......@@ -374,18 +382,18 @@ enum CodecID {
/* other specific kind of codecs (generally used for attachments) */
CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
CODEC_ID_TTF= 0x18000,
CODEC_ID_TTF = 0x18000,
CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'),
CODEC_ID_XBIN = MKBETAG('X','B','I','N'),
CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'),
CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
* stream (only used by libavformat) */
CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
* stream (only used by libavformat) */
CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information.
CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
};
#if FF_API_OLD_SAMPLE_FMT
......
......@@ -46,7 +46,6 @@
#include <sys/time.h>
#include <signal.h>
#include <stdint.h>
#include <strings.h>
#include "avdevice.h"
typedef struct {
......
......@@ -28,7 +28,6 @@
#include <sys/mman.h>
#include <sys/time.h>
#include <time.h>
#include <strings.h>
#include "libavutil/log.h"
#include "libavutil/opt.h"
......
......@@ -38,7 +38,6 @@
#define _LINUX_TIME_H 1
#include <linux/videodev.h>
#include <time.h>
#include <strings.h>
#include "avdevice.h"
typedef struct {
......
......@@ -46,7 +46,7 @@ static void openssl_lock(int mode, int type, const char *file, int line)
else
pthread_mutex_unlock(&openssl_mutexes[type]);
}
#ifndef WIN32
#if !defined(WIN32) && OPENSSL_VERSION_NUMBER < 0x10000000
static unsigned long openssl_thread_id(void)
{
return (intptr_t) pthread_self();
......@@ -79,7 +79,7 @@ void ff_tls_init(void)
for (i = 0; i < CRYPTO_num_locks(); i++)
pthread_mutex_init(&openssl_mutexes[i], NULL);
CRYPTO_set_locking_callback(openssl_lock);
#ifndef WIN32
#if !defined(WIN32) && OPENSSL_VERSION_NUMBER < 0x10000000
CRYPTO_set_id_callback(openssl_thread_id);
#endif
}
......
......@@ -71,7 +71,6 @@ int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
#if !HAVE_INET_ATON
#include <stdlib.h>
#include <strings.h>
int ff_inet_aton (const char * str, struct in_addr * add)
{
......
......@@ -23,7 +23,6 @@
#include "internal.h"
#include "libavutil/avstring.h"
#include "libavcodec/get_bits.h"
#include <strings.h>
struct PayloadContext {
AVIOContext *dyn_buf;
......
......@@ -1434,7 +1434,7 @@ void ff_read_frame_flush(AVFormatContext *s)
#if FF_API_SEEK_PUBLIC
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
{
return ff_update_cur_dts(s, ref_st, timestamp);
ff_update_cur_dts(s, ref_st, timestamp);
}
#endif
......
......@@ -189,16 +189,12 @@ char *av_strtok(char *s, const char *delim, char **saveptr)
return tok;
}
#define TOUPPER(c) do { if (c >= 'a' && c <= 'z') c -= 'a' - 'A'; } while (0)
int av_strcasecmp(const char *a, const char *b)
{
uint8_t c1, c2;
do {
c1 = *a++;
c2 = *b++;
TOUPPER(c1);
TOUPPER(c2);
c1 = av_tolower(*a++);
c2 = av_tolower(*b++);
} while (c1 && c1 == c2);
return c1 - c2;
}
......@@ -208,10 +204,8 @@ int av_strncasecmp(const char *a, const char *b, size_t n)
const char *end = a + n;
uint8_t c1, c2;
do {
c1 = *a++;
c2 = *b++;
TOUPPER(c1);
TOUPPER(c2);
c1 = av_tolower(*a++);
c2 = av_tolower(*b++);
} while (a < end && c1 && c1 == c2);
return c1 - c2;
}
......
......@@ -165,6 +165,26 @@ char *av_get_token(const char **buf, const char *term);
*/
char *av_strtok(char *s, const char *delim, char **saveptr);
/**
* Locale independent conversion of ASCII characters to upper case.
*/
static inline int av_toupper(int c)
{
if (c >= 'a' && c <= 'z')
c ^= 0x20;
return c;
}
/**
* Locale independent conversion of ASCII characters to lower case.
*/
static inline int av_tolower(int c)
{
if (c >= 'A' && c <= 'Z')
c ^= 0x20;
return c;
}
/**
* Locale independent case-insensitive compare.
* Note: This means only ASCII-range characters are case-insensitive
......
......@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 23
#define LIBAVUTIL_VERSION_MINOR 24
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
......
......@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <strings.h>
#include "avstring.h"
#include "dict.h"
#include "internal.h"
......
This diff is collapsed.
......@@ -34,6 +34,12 @@ yuv2yuvX_10_start: times 4 dd 0x10000
yuv2yuvX_9_start: times 4 dd 0x20000
yuv2yuvX_10_upper: times 8 dw 0x3ff
yuv2yuvX_9_upper: times 8 dw 0x1ff
pd_4: times 4 dd 4
pd_4min0x40000:times 4 dd 4 - (0x40000)
pw_16: times 8 dw 16
pw_32: times 8 dw 32
pw_512: times 8 dw 512
pw_1024: times 8 dw 1024
SECTION .text
......@@ -665,3 +671,139 @@ INIT_AVX
yuv2planeX_fn avx, 8, 10, 7
yuv2planeX_fn avx, 9, 7, 5
yuv2planeX_fn avx, 10, 7, 5
; %1=outout-bpc, %2=alignment (u/a)
%macro yuv2plane1_mainloop 2
.loop_%2:
%if %1 == 8
paddsw m0, m2, [r0+r2*2+mmsize*0]
paddsw m1, m3, [r0+r2*2+mmsize*1]
psraw m0, 7
psraw m1, 7
packuswb m0, m1
mov%2 [r1+r2], m0
%elif %1 == 16
paddd m0, m4, [r0+r2*4+mmsize*0]
paddd m1, m4, [r0+r2*4+mmsize*1]
paddd m2, m4, [r0+r2*4+mmsize*2]
paddd m3, m4, [r0+r2*4+mmsize*3]
psrad m0, 3
psrad m1, 3
psrad m2, 3
psrad m3, 3
%if cpuflag(sse4) ; avx/sse4
packusdw m0, m1
packusdw m2, m3
%else ; mmx/sse2
packssdw m0, m1
packssdw m2, m3
paddw m0, m5
paddw m2, m5
%endif ; mmx/sse2/sse4/avx
mov%2 [r1+r2*2], m0
mov%2 [r1+r2*2+mmsize], m2
%else
paddsw m0, m2, [r0+r2*2+mmsize*0]
paddsw m1, m2, [r0+r2*2+mmsize*1]
psraw m0, 15 - %1
psraw m1, 15 - %1
pmaxsw m0, m4
pmaxsw m1, m4
pminsw m0, m3
pminsw m1, m3
mov%2 [r1+r2*2], m0
mov%2 [r1+r2*2+mmsize], m1
%endif
add r2, mmsize
jl .loop_%2
%endmacro
%macro yuv2plane1_fn 3
cglobal yuv2plane1_%1, %3, %3, %2
%if %1 == 8
add r1, r2
%else ; %1 != 8
lea r1, [r1+r2*2]
%endif ; %1 == 8
%if %1 == 16
lea r0, [r0+r2*4]
%else ; %1 != 16
lea r0, [r0+r2*2]
%endif ; %1 == 16
neg r2
%if %1 == 8
pxor m4, m4 ; zero
; create registers holding dither
movq m3, [r3] ; dither
test r4d, r4d
jz .no_rot
%if mmsize == 16
punpcklqdq m3, m3
%endif ; mmsize == 16
PALIGNR_MMX m3, m3, 3, m2
.no_rot:
%if mmsize == 8
mova m2, m3
punpckhbw m3, m4 ; byte->word
punpcklbw m2, m4 ; byte->word
%else
punpcklbw m3, m4
mova m2, m3
%endif
%elif %1 == 9
pxor m4, m4
mova m3, [pw_512]
mova m2, [pw_32]
%elif %1 == 10
pxor m4, m4
mova m3, [pw_1024]
mova m2, [pw_16]
%else ; %1 == 16
%if cpuflag(sse4) ; sse4/avx
mova m4, [pd_4]
%else ; mmx/sse2
mova m4, [pd_4min0x40000]
mova m5, [minshort]
%endif ; mmx/sse2/sse4/avx
%endif ; %1 == ..
; actual pixel scaling
%if mmsize == 8
yuv2plane1_mainloop %1, a
%else ; mmsize == 16
test r1, 15
jnz .unaligned
yuv2plane1_mainloop %1, a
REP_RET
.unaligned:
yuv2plane1_mainloop %1, u
%endif ; mmsize == 8/16
REP_RET
%endmacro
%ifdef ARCH_X86_32
INIT_MMX mmx
yuv2plane1_fn 8, 0, 5
yuv2plane1_fn 16, 0, 3
INIT_MMX mmx2
yuv2plane1_fn 9, 0, 3
yuv2plane1_fn 10, 0, 3
%endif
INIT_XMM sse2
yuv2plane1_fn 8, 5, 5
yuv2plane1_fn 9, 5, 3
yuv2plane1_fn 10, 5, 3
yuv2plane1_fn 16, 6, 3
INIT_XMM sse4
yuv2plane1_fn 16, 5, 3
INIT_XMM avx
yuv2plane1_fn 8, 5, 5
yuv2plane1_fn 9, 5, 3
yuv2plane1_fn 10, 5, 3
yuv2plane1_fn 16, 5, 3
......@@ -289,6 +289,22 @@ VSCALEX_FUNCS(sse4, sse4);
VSCALEX_FUNC(16, sse4);
VSCALEX_FUNCS(avx, avx);
#define VSCALE_FUNC(size, opt) \
extern void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
const uint8_t *dither, int offset)
#define VSCALE_FUNCS(opt1, opt2) \
VSCALE_FUNC(8, opt1); \
VSCALE_FUNC(9, opt2); \
VSCALE_FUNC(10, opt2); \
VSCALE_FUNC(16, opt1)
#if ARCH_X86_32
VSCALE_FUNCS(mmx, mmx2);
#endif
VSCALE_FUNCS(sse2, sse2);
VSCALE_FUNC(16, sse4);
VSCALE_FUNCS(avx, avx);
void ff_sws_init_swScale_mmx(SwsContext *c)
{
int cpu_flags = av_get_cpu_flags();
......@@ -336,11 +352,19 @@ switch(c->dstBpc){ \
case 9: if (!isBE(c->dstFormat) && opt2chk) /*vscalefn = ff_yuv2planeX_9_ ## opt2;*/ break; \
default: /*vscalefn = ff_yuv2planeX_8_ ## opt1;*/ break; \
}
#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
switch(c->dstBpc){ \
case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
}
#if ARCH_X86_32
if (cpu_flags & AV_CPU_FLAG_MMX) {
ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx, mmx2, cpu_flags & AV_CPU_FLAG_MMX2,);
ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmx2, cpu_flags & AV_CPU_FLAG_MMX2);
}
#endif
#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
......@@ -355,6 +379,7 @@ switch(c->dstBpc){ \
ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, sse2, 1,);
ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
}
if (cpu_flags & AV_CPU_FLAG_SSSE3) {
ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
......@@ -366,10 +391,13 @@ switch(c->dstBpc){ \
ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4, sse4, 1,
if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4);
if (c->dstBpc == 16 && !isBE(c->dstFormat))
c->yuv2plane1 = ff_yuv2plane1_16_sse4;
}
if (cpu_flags & AV_CPU_FLAG_AVX) {
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, avx, 1,);
ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
}
#endif
}
......@@ -109,29 +109,6 @@ static void RENAME(yuv2yuvX)(const int16_t *filter, int filterSize,
);
}
static void RENAME(yuv2yuv1_ar)(const int16_t *src, uint8_t *dst, int dstW, const uint8_t *dither, int offset)
{
dither_8to16(dither, offset);
__asm__ volatile(
"mov %2, %%"REG_a" \n\t"
".p2align 4 \n\t" /* FIXME Unroll? */
"1: \n\t"
"movq (%0, %%"REG_a", 2), %%mm0 \n\t"
"movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"
"paddsw %%mm3, %%mm0 \n\t"
"paddsw %%mm4, %%mm1 \n\t"
"psraw $7, %%mm0 \n\t"
"psraw $7, %%mm1 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
MOVNTQ(%%mm0, (%1, %%REGa))
"add $8, %%"REG_a" \n\t"
"jnc 1b \n\t"
:: "r" (src + dstW), "r" (dst + dstW),
"g" ((x86_reg)-dstW)
: "%"REG_a
);
}
#define YSCALEYUV2PACKEDX_UV \
__asm__ volatile(\
"xor %%"REG_a", %%"REG_a" \n\t"\
......@@ -1881,9 +1858,7 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c)
c->use_mmx_vfilter= 0;
if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) && dstFormat != PIX_FMT_NV12
&& dstFormat != PIX_FMT_NV21 && !(c->flags & SWS_BITEXACT)) {
c->yuv2plane1 = RENAME(yuv2yuv1_ar );
if (c->flags & SWS_ACCURATE_RND) {
//c->yuv2yuv1 = RENAME(yuv2yuv1_ar );
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
switch (c->dstFormat) {
case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;
......@@ -1896,7 +1871,6 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c)
}
} else {
int should_dither= isNBPS(c->srcFormat) || is16BPS(c->srcFormat);
//c->yuv2plane1 = should_dither ? RENAME(yuv2yuv1_ar ) : RENAME(yuv2yuv1 );
c->use_mmx_vfilter= 1;
c->yuv2planeX = RENAME(yuv2yuvX );
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment