Commit c617bed3 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  MSS1 and MSS2: set final pixel format after common stuff has been initialised
  MSS2 decoder
  configure: handle --disable-asm before check_deps
  x86: Split inline and external assembly #ifdefs
  configure: x86: Separate inline from standalone assembler capabilities
  pktdumper: Use a custom define instead of PATH_MAX for buffers
  pktdumper: Use av_strlcpy instead of strncpy
  pktdumper: Use sizeof(variable) instead of the direct buffer length

Conflicts:
	Changelog
	configure
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/codec_desc.c
	libavcodec/dct-test.c
	libavcodec/imgconvert.c
	libavcodec/mss12.c
	libavcodec/version.h
	libavfilter/x86/gradfun.c
	libswscale/x86/yuv2rgb.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 98298eb1 ede3d640
......@@ -53,6 +53,7 @@ version next:
-pass and -passlogfile are now per-output stream
- volume measurement filter
- Ut Video encoder
- Microsoft Screen 2 decoder
- Matroska demuxer now identifies SRT subtitles as AV_CODEC_ID_SUBRIP
instead of AV_CODEC_ID_TEXT
- smartblur filter ported from MPlayer
......
......@@ -419,6 +419,12 @@ map(){
for v; do eval $m; done
}
add_suffix(){
suffix=$1
shift
for v; do echo ${v}${suffix}; done
}
set_all(){
value=$1
shift
......@@ -1246,6 +1252,8 @@ HAVE_LIST_PUB='
HAVE_LIST="
$ARCH_EXT_LIST
$(add_suffix _external $ARCH_EXT_LIST)
$(add_suffix _inline $ARCH_EXT_LIST)
$HAVE_LIST_PUB
$THREADS_LIST
aligned_malloc
......@@ -1524,6 +1532,17 @@ sse42_deps="sse4"
avx_deps="sse42"
fma4_deps="avx"
mmx_external_deps="yasm"
mmx_inline_deps="inline_asm"
mmx_suggest="mmx_external mmx_inline"
for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
eval dep=\$${ext}_deps
eval ${ext}_external_deps='"${dep}_external"'
eval ${ext}_inline_deps='"${dep}_inline"'
eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
done
aligned_stack_if_any="ppc x86"
fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
......@@ -1645,6 +1664,7 @@ msmpeg4v2_decoder_select="h263_decoder"
msmpeg4v2_encoder_select="h263_encoder"
msmpeg4v3_decoder_select="h263_decoder"
msmpeg4v3_encoder_select="h263_encoder"
mss2_decoder_select="vc1_decoder"
nellymoser_decoder_select="mdct sinewin"
nellymoser_encoder_select="mdct sinewin"
png_decoder_select="zlib"
......@@ -3293,8 +3313,8 @@ EOF
check_inline_asm xmm_clobbers '"":::"%xmm0"'
# check whether binutils is new enough to compile SSSE3/MMXEXT
enabled ssse3 && check_inline_asm ssse3 '"pabsw %xmm0, %xmm0"'
enabled mmxext && check_inline_asm mmxext '"pmaxub %mm0, %mm1"'
enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
if ! disabled_any asm mmx yasm; then
if check_cmd $yasmexe --version; then
......@@ -3315,8 +3335,8 @@ EOF
check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
die "yasm not found, use --disable-yasm for a crippled build"
check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4
check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external
check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
check_yasm "CPU amdnop" && enable cpunop
fi
......@@ -3808,13 +3828,14 @@ enabled broken_strtod && force_include compat/strtod.h
enabled_any $THREADS_LIST && enable threads
enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
check_deps $CONFIG_LIST \
$CONFIG_EXTRA \
$HAVE_LIST \
$ALL_COMPONENTS \
$ALL_TESTS \
enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
if test $target_os = "haiku"; then
disable memalign
......
......@@ -592,6 +592,8 @@ following image formats are supported:
@item Microsoft RLE @tab @tab X
@item Microsoft Screen 1 @tab @tab X
@tab Also known as Windows Media Video V7 Screen.
@item Microsoft Screen 2 @tab @tab X
@tab Also known as Windows Media Video V9 Screen.
@item Microsoft Video 1 @tab @tab X
@item Mimic @tab @tab X
@tab Used in MSN Messenger Webcam streams.
......
......@@ -309,6 +309,7 @@ OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
OBJS-$(CONFIG_MSA1_DECODER) += mss3.o mss34dsp.o
OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o
OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
......
......@@ -177,6 +177,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
REGISTER_DECODER (MSRLE, msrle);
REGISTER_DECODER (MSS1, mss1);
REGISTER_DECODER (MSS2, mss2);
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
REGISTER_DECODER (MSZH, mszh);
REGISTER_DECODER (MTS2, mts2);
......
......@@ -266,6 +266,7 @@ enum AVCodecID {
AV_CODEC_ID_TSCC2,
AV_CODEC_ID_MTS2,
AV_CODEC_ID_CLLC,
AV_CODEC_ID_MSS2,
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
AV_CODEC_ID_EXR = MKBETAG('0','E','X','R'),
......
......@@ -1205,6 +1205,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Canopus Lossless Codec"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_MSS2,
.type = AVMEDIA_TYPE_VIDEO,
.name = "mss2",
.long_name = NULL_IF_CONFIG_SMALL("MS Windows Media Video V9 Screen"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_Y41P,
.type = AVMEDIA_TYPE_VIDEO,
......
......@@ -85,7 +85,7 @@ static const struct algo fdct_tab[] = {
{ "IJG-AAN-INT", ff_fdct_ifast, SCALE_PERM },
{ "IJG-LLM-INT", ff_jpeg_fdct_islow_8, NO_PERM },
#if HAVE_MMX && HAVE_INLINE_ASM
#if HAVE_MMX_INLINE
{ "MMX", ff_fdct_mmx, NO_PERM, AV_CPU_FLAG_MMX },
{ "MMXEXT", ff_fdct_mmx2, NO_PERM, AV_CPU_FLAG_MMXEXT },
{ "SSE2", ff_fdct_sse2, NO_PERM, AV_CPU_FLAG_SSE2 },
......@@ -125,7 +125,7 @@ static const struct algo idct_tab[] = {
{ "INT", ff_j_rev_dct, MMX_PERM },
{ "SIMPLE-C", ff_simple_idct_8, NO_PERM },
#if HAVE_MMX && HAVE_INLINE_ASM
#if HAVE_MMX_INLINE
#if CONFIG_GPL
{ "LIBMPEG2-MMX", ff_mmx_idct, MMX_PERM, AV_CPU_FLAG_MMX, 1 },
{ "LIBMPEG2-MMX2", ff_mmxext_idct, MMX_PERM, AV_CPU_FLAG_MMX2, 1 },
......
......@@ -60,7 +60,10 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->quant_precision=5;
s->decode_mb= ff_h263_decode_mb;
s->low_delay= 1;
avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
if (avctx->codec->id == AV_CODEC_ID_MSS2)
avctx->pix_fmt = PIX_FMT_YUV420P;
else
avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
s->unrestricted_mv= 1;
/* select sub codec */
......@@ -96,6 +99,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
case AV_CODEC_ID_WMV3:
case AV_CODEC_ID_VC1IMAGE:
case AV_CODEC_ID_WMV3IMAGE:
case AV_CODEC_ID_MSS2:
s->h263_pred = 1;
s->msmpeg4_version=6;
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
......
......@@ -39,7 +39,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#if HAVE_MMX && HAVE_YASM
#if HAVE_MMX_EXTERNAL
#include "x86/dsputil_mmx.h"
#endif
......@@ -48,7 +48,7 @@
#define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
#define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
#if HAVE_MMX && HAVE_YASM
#if HAVE_MMX_EXTERNAL
#define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
#define deinterlace_line ff_deinterlace_line_mmx
#else
......@@ -815,7 +815,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
return 0;
}
#if !(HAVE_MMX && HAVE_YASM)
#if !HAVE_MMX_EXTERNAL
/* filter parameters: [-1 4 2 4 -1] // 8 */
static void deinterlace_line_c(uint8_t *dst,
const uint8_t *lum_m4, const uint8_t *lum_m3,
......@@ -864,7 +864,7 @@ static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3,
lum++;
}
}
#endif
#endif /* !HAVE_MMX_EXTERNAL */
/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
top field is copied as is, but the bottom field is deinterlaced
......
......@@ -226,10 +226,11 @@ void ff_copy_picture(Picture *dst, Picture *src)
*/
static void free_frame_buffer(MpegEncContext *s, Picture *pic)
{
/* Windows Media Image codecs allocate internal buffers with different
* dimensions; ignore user defined callbacks for these
*/
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE && s->codec_id != AV_CODEC_ID_VC1IMAGE)
/* WM Image / Screen codecs allocate internal buffers with different
* dimensions / colorspaces; ignore user-defined callbacks for these. */
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
s->codec_id != AV_CODEC_ID_VC1IMAGE &&
s->codec_id != AV_CODEC_ID_MSS2)
ff_thread_release_buffer(s->avctx, &pic->f);
else
avcodec_default_release_buffer(s->avctx, &pic->f);
......@@ -254,7 +255,9 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
}
}
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE && s->codec_id != AV_CODEC_ID_VC1IMAGE)
if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
s->codec_id != AV_CODEC_ID_VC1IMAGE &&
s->codec_id != AV_CODEC_ID_MSS2)
r = ff_thread_get_buffer(s->avctx, &pic->f);
else
r = avcodec_default_get_buffer(s->avctx, &pic->f);
......
......@@ -24,14 +24,13 @@
* Microsoft Screen 1 (aka Windows Media Video V7 Screen) decoder
*/
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "mss12.h"
typedef struct MSS1Context {
MSS12Context ctx;
AVFrame pic;
SliceContext sc[2];
} MSS1Context;
static void arith_normalise(ArithCoder *c)
......@@ -56,24 +55,11 @@ static void arith_normalise(ArithCoder *c)
c->low <<= 1;
c->high <<= 1;
c->high |= 1;
c->value |= get_bits1(c->gb);
c->value |= get_bits1(c->gbc.gb);
}
}
static int arith_get_bit(ArithCoder *c)
{
int range = c->high - c->low + 1;
int bit = (((c->value - c->low) << 1) + 1) / range;
if (bit)
c->low += range >> 1;
else
c->high = c->low + (range >> 1) - 1;
arith_normalise(c);
return bit;
}
ARITH_GET_BIT()
static int arith_get_bits(ArithCoder *c, int bits)
{
......@@ -118,40 +104,27 @@ static int arith_get_prob(ArithCoder *c, int *probs)
return sym;
}
static int arith_get_model_sym(ArithCoder *c, Model *m)
{
int idx, val;
idx = arith_get_prob(c, m->cum_prob);
val = m->idx2sym[idx];
ff_mss12_model_update(m, idx);
arith_normalise(c);
return val;
}
ARITH_GET_MODEL_SYM()
static void arith_init(ArithCoder *c, GetBitContext *gb)
{
c->low = 0;
c->high = 0xFFFF;
c->value = get_bits(gb, 16);
c->gb = gb;
c->low = 0;
c->high = 0xFFFF;
c->value = get_bits(gb, 16);
c->gbc.gb = gb;
c->get_model_sym = arith_get_model_sym;
c->get_number = arith_get_number;
}
static int decode_pal(MSS1Context *ctx, ArithCoder *acoder)
static int decode_pal(MSS12Context *ctx, ArithCoder *acoder)
{
int i, ncol, r, g, b;
uint32_t *pal = ctx->ctx.pal + 256 - ctx->ctx.free_colours;
uint32_t *pal = ctx->pal + 256 - ctx->free_colours;
if (!ctx->ctx.free_colours)
if (!ctx->free_colours)
return 0;
ncol = arith_get_number(acoder, ctx->ctx.free_colours + 1);
ncol = arith_get_number(acoder, ctx->free_colours + 1);
for (i = 0; i < ncol; i++) {
r = arith_get_bits(acoder, 8);
g = arith_get_bits(acoder, 8);
......@@ -167,7 +140,8 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MSS1Context *c = avctx->priv_data;
MSS1Context *ctx = avctx->priv_data;
MSS12Context *c = &ctx->ctx;
GetBitContext gb;
ArithCoder acoder;
int pal_changed = 0;
......@@ -176,37 +150,37 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
init_get_bits(&gb, buf, buf_size * 8);
arith_init(&acoder, &gb);
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
if ((ret = avctx->reget_buffer(avctx, &c->pic)) < 0) {
ctx->pic.reference = 3;
ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if ((ret = avctx->reget_buffer(avctx, &ctx->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return ret;
}
c->ctx.pic_start = c->pic.data[0] + c->pic.linesize[0] * (avctx->height - 1);
c->ctx.pic_stride = -c->pic.linesize[0];
c->ctx.keyframe = !arith_get_bit(&acoder);
if (c->ctx.keyframe) {
ff_mss12_codec_reset(&c->ctx);
pal_changed = decode_pal(c, &acoder);
c->pic.key_frame = 1;
c->pic.pict_type = AV_PICTURE_TYPE_I;
c->pal_pic = ctx->pic.data[0] + ctx->pic.linesize[0] * (avctx->height - 1);
c->pal_stride = -ctx->pic.linesize[0];
c->keyframe = !arith_get_bit(&acoder);
if (c->keyframe) {
ff_mss12_codec_reset(c);
pal_changed = decode_pal(c, &acoder);
ctx->pic.key_frame = 1;
ctx->pic.pict_type = AV_PICTURE_TYPE_I;
} else {
if (c->ctx.corrupted)
if (c->corrupted)
return AVERROR_INVALIDDATA;
c->pic.key_frame = 0;
c->pic.pict_type = AV_PICTURE_TYPE_P;
ctx->pic.key_frame = 0;
ctx->pic.pict_type = AV_PICTURE_TYPE_P;
}
c->ctx.corrupted = ff_mss12_decode_rect(&c->ctx, &acoder, 0, 0,
avctx->width, avctx->height);
if (c->ctx.corrupted)
c->corrupted = ff_mss12_decode_rect(&c->sc[0], &acoder, 0, 0,
avctx->width, avctx->height);
if (c->corrupted)
return AVERROR_INVALIDDATA;
memcpy(c->pic.data[1], c->ctx.pal, AVPALETTE_SIZE);
c->pic.palette_has_changed = pal_changed;
memcpy(ctx->pic.data[1], c->pal, AVPALETTE_SIZE);
ctx->pic.palette_has_changed = pal_changed;
*data_size = sizeof(AVFrame);
*(AVFrame*)data = c->pic;
*(AVFrame*)data = ctx->pic;
/* always report that the buffer was completely consumed */
return buf_size;
......@@ -215,20 +189,25 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
static av_cold int mss1_decode_init(AVCodecContext *avctx)
{
MSS1Context * const c = avctx->priv_data;
int ret;
c->ctx.avctx = avctx;
avctx->coded_frame = &c->pic;
return ff_mss12_decode_init(avctx, 0);
ret = ff_mss12_decode_init(&c->ctx, 0);
avctx->pix_fmt = PIX_FMT_PAL8;
return ret;
}
static av_cold int mss1_decode_end(AVCodecContext *avctx)
{
MSS1Context * const c = avctx->priv_data;
MSS1Context * const ctx = avctx->priv_data;
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
ff_mss12_decode_end(avctx);
if (ctx->pic.data[0])
avctx->release_buffer(avctx, &ctx->pic);
ff_mss12_decode_end(&ctx->ctx);
return 0;
}
......
This diff is collapsed.
......@@ -26,8 +26,10 @@
#ifndef AVCODEC_MSS12_H
#define AVCODEC_MSS12_H
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
#define MODEL_MIN_SYMS 2
#define MODEL_MAX_SYMS 256
......@@ -46,7 +48,10 @@ typedef struct Model {
typedef struct ArithCoder {
int low, high, value;
GetBitContext *gb;
union {
GetBitContext *gb;
GetByteContext *gB;
} gbc;
int (*get_model_sym)(struct ArithCoder *c, Model *m);
int (*get_number) (struct ArithCoder *c, int n);
} ArithCoder;
......@@ -56,28 +61,77 @@ typedef struct PixContext {
uint8_t cache[12];
Model cache_model, full_model;
Model sec_models[4][8][4];
int special_initial_cache;
} PixContext;
struct MSS12Context;
typedef struct SliceContext {
struct MSS12Context *c;
Model intra_region, inter_region;
Model pivot, edge_mode, split_mode;
PixContext intra_pix_ctx, inter_pix_ctx;
} SliceContext;
typedef struct MSS12Context {
AVCodecContext *avctx;
uint8_t *pic_start;
int pic_stride;
uint8_t *mask;
int mask_linesize;
uint32_t pal[256];
uint8_t *pal_pic;
uint8_t *last_pal_pic;
int pal_stride;
uint8_t *mask;
int mask_stride;
uint8_t *rgb_pic;
uint8_t *last_rgb_pic;
int rgb_stride;
int free_colours;
int keyframe;
Model intra_region, inter_region;
Model pivot, edge_mode, split_mode;
PixContext intra_pix_ctx, inter_pix_ctx;
int mvX, mvY;
int corrupted;
int slice_split;
int full_model_syms;
SliceContext sc[2];
} MSS12Context;
int ff_mss12_decode_rect(MSS12Context *ctx, ArithCoder *acoder,
int ff_mss12_decode_rect(SliceContext *ctx, ArithCoder *acoder,
int x, int y, int width, int height);
void ff_mss12_model_update(Model *m, int val);
void ff_mss12_codec_reset(MSS12Context *ctx);
av_cold int ff_mss12_decode_init(AVCodecContext *avctx, int version);
av_cold int ff_mss12_decode_end(AVCodecContext *avctx);
av_cold int ff_mss12_decode_init(MSS12Context *ctx, int version);
av_cold int ff_mss12_decode_end(MSS12Context *ctx);
#define ARITH_GET_BIT(VERSION) \
static int arith ## VERSION ## _get_bit(ArithCoder *c) \
{ \
int range = c->high - c->low + 1; \
int bit = (((c->value - c->low) << 1) + 1) / range; \
\
if (bit) \
c->low += range >> 1; \
else \
c->high = c->low + (range >> 1) - 1; \
\
arith ## VERSION ## _normalise(c); \
\
return bit; \
}
#define ARITH_GET_MODEL_SYM(VERSION) \
static int arith ## VERSION ## _get_model_sym(ArithCoder *c, Model *m) \
{ \
int idx, val; \
\
idx = arith ## VERSION ## _get_prob(c, m->cum_prob); \
\
val = m->idx2sym[idx]; \
ff_mss12_model_update(m, idx); \
\
arith ## VERSION ## _normalise(c); \
\
return val; \
}
#endif /* AVCODEC_MSS12_H */
This diff is collapsed.
/*
* Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder DSP routines
*/
#include "mss2dsp.h"
#include "libavutil/common.h"
static av_always_inline void mss2_blit_wmv9_template(uint8_t *dst,
int dst_stride,
int gray,
int use_mask,
int maskcolor,
const uint8_t *mask,
int mask_stride,
const uint8_t *srcy,
int srcy_stride,
const uint8_t *srcu,
const uint8_t *srcv,
int srcuv_stride,
int w, int h)
{
int i, j, k, r = -1;
while (++r < h) {
for (i = 0, j = 0, k = 0; i < w; j += (i & 1), i++, k += 3) {
if (!use_mask || mask[i] == maskcolor) {
if (gray) {
dst[k] = dst[k + 1] = dst[k + 2] = 0x80;
} else {
int y = srcy[i];
int u = srcu[j] - 128;
int v = srcv[j] - 128;
dst[k] = av_clip_uint8(y + ( 91881 * v + 32768 >> 16));
dst[k + 1] = av_clip_uint8(y + (-22554 * u - 46802 * v + 32768 >> 16));
dst[k + 2] = av_clip_uint8(y + (116130 * u + 32768 >> 16));
}
}
}
mask += mask_stride;
dst += dst_stride;
srcy += srcy_stride;
srcu += srcuv_stride * (r & 1);
srcv += srcuv_stride * (r & 1);
}
}
static void mss2_blit_wmv9_c(uint8_t *dst, int dst_stride,
const uint8_t *srcy, int srcy_stride,
const uint8_t *srcu, const uint8_t *srcv,
int srcuv_stride, int w, int h)
{
mss2_blit_wmv9_template(dst, dst_stride, 0, 0,
0, NULL, 0,
srcy, srcy_stride,
srcu, srcv, srcuv_stride,
w, h);
}
static void mss2_blit_wmv9_masked_c(uint8_t *dst, int dst_stride,
int maskcolor, const uint8_t *mask,
int mask_stride,
const uint8_t *srcy, int srcy_stride,
const uint8_t *srcu, const uint8_t *srcv,
int srcuv_stride, int w, int h)
{
mss2_blit_wmv9_template(dst, dst_stride, 0, 1,
maskcolor, mask, mask_stride,
srcy, srcy_stride,
srcu, srcv, srcuv_stride,
w, h);
}
static void mss2_gray_fill_masked_c(uint8_t *dst, int dst_stride,
int maskcolor, const uint8_t *mask,
int mask_stride, int w, int h)
{
mss2_blit_wmv9_template(dst, dst_stride, 1, 1,
maskcolor, mask, mask_stride,
NULL, 0,
NULL, NULL, 0,
w, h);
}
static void upsample_plane_c(uint8_t *plane, int plane_stride, int w, int h)
{
uint8_t *src1, *src2, *dst1, *dst2, *p, a, b;
int i, j;
w += (w & 1);
h += (h & 1);
j = h - 1;
memcpy(plane + plane_stride * j,
plane + plane_stride * (j >> 1),
w);
while ((j -= 2) > 0) {
dst1 = plane + plane_stride * (j + 1);
dst2 = plane + plane_stride * j;
src1 = plane + plane_stride * ((j + 1) >> 1);
src2 = plane + plane_stride * ( j >> 1);
for (i = (w - 1) >> 1; i >= 0; i--) {
a = src1[i];
b = src2[i];
dst1[i] = (3 * a + b + 2) >> 2;
dst2[i] = (a + 3 * b + 2) >> 2;
}
}
for (j = h - 1; j >= 0; j--) {
p = plane + plane_stride * j;
i = w - 1;
p[i] = p[i >> 1];
while ((i -= 2) > 0) {
a = p[ i >> 1];
b = p[(i + 1) >> 1];
p[i] = (3 * a + b + 1) >> 2;
p[i + 1] = (a + 3 * b + 1) >> 2;
}
}
}
av_cold void ff_mss2dsp_init(MSS2DSPContext* dsp)
{
dsp->mss2_blit_wmv9 = mss2_blit_wmv9_c;
dsp->mss2_blit_wmv9_masked = mss2_blit_wmv9_masked_c;
dsp->mss2_gray_fill_masked = mss2_gray_fill_masked_c;
dsp->upsample_plane = upsample_plane_c;
}
/*
* Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder DSP routines
*/
#ifndef AVCODEC_MSS2DSP_H
#define AVCODEC_MSS2DSP_H
#include "dsputil.h"
typedef struct MSS2DSPContext {
void (*mss2_blit_wmv9)(uint8_t *dst, int dst_stride,
const uint8_t *srcy, int srcy_stride,
const uint8_t *srcu, const uint8_t *srcv,
int srcuv_stride, int w, int h);
void (*mss2_blit_wmv9_masked)(uint8_t *dst, int dst_stride,
int maskcolor, const uint8_t *mask,
int mask_stride,
const uint8_t *srcy, int srcy_stride,
const uint8_t *srcu, const uint8_t *srcv,
int srcuv_stride, int w, int h);
void (*mss2_gray_fill_masked)(uint8_t *dst, int dst_stride,
int maskcolor, const uint8_t *mask,
int mask_stride, int w, int h);
void (*upsample_plane)(uint8_t *plane, int plane_stride, int w, int h);
} MSS2DSPContext;
av_cold void ff_mss2dsp_init(MSS2DSPContext* dsp);
#endif /* AVCODEC_MSS2DSP_H */
......@@ -584,7 +584,14 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
if (v->finterpflag)
v->interpfrm = get_bits1(gb);
skip_bits(gb, 2); //framecnt unused
if (!v->s.avctx->codec)
return -1;
if (v->s.avctx->codec->id == AV_CODEC_ID_MSS2)
v->respic =
v->rangered =
v->multires = get_bits(gb, 2) == 1;
else
skip_bits(gb, 2); //framecnt unused
v->rangeredfrm = 0;
if (v->rangered)
v->rangeredfrm = get_bits1(gb);
......
......@@ -395,6 +395,8 @@ typedef struct VC1Context{
uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element)
uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element)
int end_mb_x; ///< Horizontal macroblock limit (used only by mss2)
int parse_only; ///< Context is used within parser
int warn_interlaced;
......
......@@ -4350,10 +4350,10 @@ static void vc1_decode_i_blocks(VC1Context *v)
s->mb_x = s->mb_y = 0;
s->mb_intra = 1;
s->first_slice_line = 1;
for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_y = 0; s->mb_y < s->end_mb_y; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
for (; s->mb_x < s->mb_width; s->mb_x++) {
for (; s->mb_x < v->end_mb_x; s->mb_x++) {
uint8_t *dst[6];
ff_update_block_index(s);
dst[0] = s->dest[0];
......@@ -4440,7 +4440,10 @@ static void vc1_decode_i_blocks(VC1Context *v)
s->first_slice_line = 0;
}
if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->mb_height - 1) * 16, 16);
ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
/* This is intentionally mb_height and not end_mb_y - unlike in advanced
* profile, these only differ are when decoding MSS2 rectangles. */
ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, ER_MB_END);
}
......@@ -5560,6 +5563,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
ff_er_frame_start(s);
v->bits = buf_size * 8;
v->end_mb_x = s->mb_width;
if (v->field_mode) {
uint8_t *tmp[2];
s->current_picture.f.linesize[0] <<= 1;
......
......@@ -27,8 +27,8 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 54
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MINOR 55
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
......
......@@ -73,7 +73,7 @@ AC3_EXPONENT_MIN mmx
%define LOOP_ALIGN ALIGN 16
AC3_EXPONENT_MIN mmxext
%endif
%if HAVE_SSE
%if HAVE_SSE2_EXTERNAL
INIT_XMM
AC3_EXPONENT_MIN sse2
%endif
......@@ -385,7 +385,7 @@ cglobal ac3_compute_mantissa_size_sse2, 1,2,4, mant_cnt, sum
pabsd %1, %1
%endmacro
%if HAVE_AMD3DNOW
%if HAVE_AMD3DNOW_EXTERNAL
INIT_MMX
cglobal ac3_extract_exponents_3dnow, 3,3,0, exp, coef, len
add expq, lenq
......@@ -453,11 +453,11 @@ cglobal ac3_extract_exponents_%1, 3,3,4, exp, coef, len
REP_RET
%endmacro
%if HAVE_SSE
%if HAVE_SSE2_EXTERNAL
INIT_XMM
%define PABSD PABSD_MMX
AC3_EXTRACT_EXPONENTS sse2
%if HAVE_SSSE3
%if HAVE_SSSE3_EXTERNAL
%define PABSD PABSD_SSSE3
AC3_EXTRACT_EXPONENTS ssse3
%endif
......
......@@ -193,7 +193,7 @@ ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000, 0, 0, 0x80000000, 0x80000000
INIT_YMM avx
SECTION_TEXT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
; void ff_dct32_float_avx(FFTSample *out, const FFTSample *in)
cglobal dct32_float, 2,3,8, out, in, tmp
; pass 1
......
......@@ -1169,7 +1169,7 @@ ALIGN 16
INIT_XMM sse
VECTOR_FMUL_REVERSE
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
VECTOR_FMUL_REVERSE
%endif
......@@ -1199,7 +1199,7 @@ ALIGN 16
INIT_XMM sse
VECTOR_FMUL_ADD
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
VECTOR_FMUL_ADD
%endif
......@@ -1245,7 +1245,7 @@ cglobal butterflies_float_interleave, 4,4,3, dst, src0, src1, len
INIT_XMM sse
BUTTERFLIES_FLOAT_INTERLEAVE
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
BUTTERFLIES_FLOAT_INTERLEAVE
%endif
......
......@@ -2942,7 +2942,7 @@ static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx,
static void dsputil_init_3dnowext(DSPContext *c, AVCodecContext *avctx,
int mm_flags)
{
#if HAVE_6REGS && HAVE_INLINE_ASM
#if HAVE_AMD3DNOWEXT_INLINE && HAVE_6REGS
c->vector_fmul_window = vector_fmul_window_3dnowext;
#endif
}
......@@ -3056,11 +3056,10 @@ static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
int mm_flags)
{
#if HAVE_SSSE3
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
const int bit_depth = avctx->bits_per_raw_sample;
#if HAVE_INLINE_ASM
#if HAVE_SSSE3_INLINE
if (!high_bit_depth && CONFIG_H264QPEL) {
H264_QPEL_FUNCS(1, 0, ssse3);
H264_QPEL_FUNCS(1, 1, ssse3);
......@@ -3075,8 +3074,9 @@ static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
H264_QPEL_FUNCS(3, 2, ssse3);
H264_QPEL_FUNCS(3, 3, ssse3);
}
#endif /* HAVE_INLINE_ASM */
#if HAVE_YASM
#endif /* HAVE_SSSE3_INLINE */
#if HAVE_SSSE3_EXTERNAL
if (bit_depth == 10 && CONFIG_H264QPEL) {
H264_QPEL_FUNCS_10(1, 0, ssse3_cache64);
H264_QPEL_FUNCS_10(2, 0, ssse3_cache64);
......@@ -3099,21 +3099,20 @@ static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
if (!(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW))) // cachesplit
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
c->bswap_buf = ff_bswap32_buf_ssse3;
#endif
#endif
#endif /* HAVE_SSSE3_EXTERNAL */
}
static void dsputil_init_sse4(DSPContext *c, AVCodecContext *avctx,
int mm_flags)
{
#if HAVE_YASM
#if HAVE_SSE4_EXTERNAL
c->vector_clip_int32 = ff_vector_clip_int32_sse4;
#endif
#endif /* HAVE_SSE4_EXTERNAL */
}
static void dsputil_init_avx(DSPContext *c, AVCodecContext *avctx, int mm_flags)
{
#if HAVE_AVX && HAVE_YASM
#if HAVE_AVX_EXTERNAL
const int bit_depth = avctx->bits_per_raw_sample;
if (bit_depth == 10) {
......@@ -3133,7 +3132,7 @@ static void dsputil_init_avx(DSPContext *c, AVCodecContext *avctx, int mm_flags)
c->butterflies_float_interleave = ff_butterflies_float_interleave_avx;
c->vector_fmul_reverse = ff_vector_fmul_reverse_avx;
c->vector_fmul_add = ff_vector_fmul_add_avx;
#endif
#endif /* HAVE_AVX_EXTERNAL */
}
void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
......
......@@ -983,7 +983,7 @@ DCT_SAD_FUNC(mmx2)
DCT_SAD_FUNC(sse2)
#undef MMABS
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#define MMABS(a,z) MMABS_SSSE3(a,z)
DCT_SAD_FUNC(ssse3)
#undef MMABS
......@@ -1063,7 +1063,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
#undef SCALE_OFFSET
#undef PMULHRW
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#undef PHADDD
#define DEF(x) x ## _ssse3
#define SET_RND(x)
......@@ -1082,7 +1082,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
#undef SCALE_OFFSET
#undef PMULHRW
#undef PHADDD
#endif //HAVE_SSSE3
#endif /* HAVE_SSSE3_INLINE */
#endif /* HAVE_INLINE_ASM */
......@@ -1162,7 +1162,7 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->sum_abs_dctelem= sum_abs_dctelem_sse2;
}
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if(mm_flags & AV_CPU_FLAG_SSSE3){
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->try_8x8basis= try_8x8basis_ssse3;
......
......@@ -305,7 +305,7 @@ IF%1 mova Z(1), m5
INIT_YMM avx
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
align 16
fft8_avx:
mova m0, Z(0)
......@@ -553,7 +553,7 @@ DEFINE_ARGS zc, w, n, o1, o3
INIT_YMM avx
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
%macro INTERL_AVX 5
vunpckhps %3, %2, %1
vunpcklps %2, %2, %1
......@@ -794,7 +794,7 @@ align 8
dispatch_tab %+ fullsuffix: pointer list_of_fft
%endmacro ; DECL_FFT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
DECL_FFT 6
DECL_FFT 6, _interleave
......@@ -1101,6 +1101,6 @@ DECL_IMDCT POSROTATESHUF_3DNOW
INIT_YMM avx
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
DECL_IMDCT POSROTATESHUF_AVX
%endif
......@@ -252,7 +252,7 @@ cglobal %1_h264_chroma_mc2_10, 6,7
%define CHROMAMC_AVG NOTHING
INIT_XMM sse2
CHROMA_MC8 put
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CHROMA_MC8 put
%endif
......@@ -264,7 +264,7 @@ CHROMA_MC2 put
%define PAVG pavgw
INIT_XMM sse2
CHROMA_MC8 avg
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CHROMA_MC8 avg
%endif
......
......@@ -80,7 +80,7 @@ cglobal h264_idct_add_10, 3,3
INIT_XMM sse2
IDCT_ADD_10
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD_10
%endif
......@@ -110,7 +110,7 @@ add4x4_idct %+ SUFFIX:
INIT_XMM sse2
ALIGN 16
ADD4x4IDCT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
ALIGN 16
ADD4x4IDCT
......@@ -150,7 +150,7 @@ cglobal h264_idct_add16_10, 5,6
INIT_XMM sse2
IDCT_ADD16_10
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD16_10
%endif
......@@ -216,7 +216,7 @@ cglobal h264_idct8_dc_add_10,3,3,7
INIT_XMM sse2
IDCT8_DC_ADD
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT8_DC_ADD
%endif
......@@ -287,7 +287,7 @@ cglobal h264_idct_add16intra_10,5,7,8
INIT_XMM sse2
IDCT_ADD16INTRA_10
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD16INTRA_10
%endif
......@@ -324,7 +324,7 @@ cglobal h264_idct_add8_10,5,8,7
INIT_XMM sse2
IDCT_ADD8
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT_ADD8
%endif
......@@ -501,7 +501,7 @@ h264_idct8_add1_10 %+ SUFFIX:
INIT_XMM sse2
IDCT8_ADD
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT8_ADD
%endif
......@@ -541,7 +541,7 @@ cglobal h264_idct8_add4_10, 0,7,16
INIT_XMM sse2
IDCT8_ADD4
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
IDCT8_ADD4
%endif
......@@ -84,7 +84,7 @@ INIT_XMM
PRED4x4_DR sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_DR ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_DR avx
%endif
......@@ -124,7 +124,7 @@ INIT_XMM
PRED4x4_VR sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_VR ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_VR avx
%endif
......@@ -167,7 +167,7 @@ INIT_XMM
PRED4x4_HD sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_HD ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_HD avx
%endif
......@@ -238,7 +238,7 @@ cglobal pred4x4_down_left_10_%1, 3,3
INIT_XMM
PRED4x4_DL sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_DL avx
%endif
......@@ -267,7 +267,7 @@ cglobal pred4x4_vertical_left_10_%1, 3,3
INIT_XMM
PRED4x4_VL sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED4x4_VL avx
%endif
......@@ -577,7 +577,7 @@ cglobal pred8x8l_top_dc_10_%1, 4,4,6
INIT_XMM
PRED8x8L_TOP_DC sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_TOP_DC avx
%endif
......@@ -636,7 +636,7 @@ cglobal pred8x8l_dc_10_%1, 4,6,6
INIT_XMM
PRED8x8L_DC sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_DC avx
%endif
......@@ -671,7 +671,7 @@ cglobal pred8x8l_vertical_10_%1, 4,4,6
INIT_XMM
PRED8x8L_VERTICAL sse2
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_VERTICAL avx
%endif
......@@ -728,7 +728,7 @@ INIT_XMM
PRED8x8L_HORIZONTAL sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_HORIZONTAL ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_HORIZONTAL avx
%endif
......@@ -797,7 +797,7 @@ INIT_XMM
PRED8x8L_DOWN_LEFT sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_DOWN_LEFT ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_DOWN_LEFT avx
%endif
......@@ -872,7 +872,7 @@ INIT_XMM
PRED8x8L_DOWN_RIGHT sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_DOWN_RIGHT ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_DOWN_RIGHT avx
%endif
......@@ -943,7 +943,7 @@ INIT_XMM
PRED8x8L_VERTICAL_RIGHT sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_VERTICAL_RIGHT ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_VERTICAL_RIGHT avx
%endif
......@@ -1005,7 +1005,7 @@ INIT_XMM
PRED8x8L_HORIZONTAL_UP sse2
%define PALIGNR PALIGNR_SSSE3
PRED8x8L_HORIZONTAL_UP ssse3
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_AVX
PRED8x8L_HORIZONTAL_UP avx
%endif
......
......@@ -1174,7 +1174,7 @@ QPEL_H264_V_XMM(put_, PUT_OP, sse2)
QPEL_H264_V_XMM(avg_, AVG_MMX2_OP, sse2)
QPEL_H264_HV_XMM(put_, PUT_OP, sse2)
QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, sse2)
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
QPEL_H264_H_XMM(put_, PUT_OP, ssse3)
QPEL_H264_H_XMM(avg_, AVG_MMX2_OP, ssse3)
QPEL_H264_HV2_XMM(put_, PUT_OP, ssse3)
......@@ -1188,7 +1188,7 @@ H264_MC_4816(3dnow)
H264_MC_4816(mmx2)
H264_MC_816(H264_MC_V, sse2)
H264_MC_816(H264_MC_HV, sse2)
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
H264_MC_816(H264_MC_H, ssse3)
H264_MC_816(H264_MC_HV, ssse3)
#endif
......
......@@ -39,7 +39,7 @@ IDCT_ADD_FUNC(8_dc, 10, sse2)
IDCT_ADD_FUNC(8, 8, mmx)
IDCT_ADD_FUNC(8, 8, sse2)
IDCT_ADD_FUNC(8, 10, sse2)
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
IDCT_ADD_FUNC(, 10, avx)
IDCT_ADD_FUNC(8_dc, 10, avx)
IDCT_ADD_FUNC(8, 10, avx)
......@@ -64,7 +64,7 @@ IDCT_ADD_REP_FUNC(, 16intra, 8, mmx)
IDCT_ADD_REP_FUNC(, 16intra, 8, mmx2)
IDCT_ADD_REP_FUNC(, 16intra, 8, sse2)
IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
IDCT_ADD_REP_FUNC(, 16, 10, avx)
IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
#endif
......@@ -79,7 +79,7 @@ IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
IDCT_ADD_REP_FUNC2(, 8, 8, mmx2)
IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
IDCT_ADD_REP_FUNC2(, 8, 10, avx)
#endif
......@@ -353,7 +353,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse4;
c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse4;
}
#if HAVE_AVX
#if HAVE_AVX_EXTERNAL
if (mm_flags & AV_CPU_FLAG_AVX) {
c->h264_idct_dc_add =
c->h264_idct_add = ff_h264_idct_add_10_avx;
......@@ -377,7 +377,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
#endif /* HAVE_ALIGNED_STACK */
}
#endif /* HAVE_AVX */
#endif /* HAVE_AVX_EXTERNAL */
}
}
}
......
......@@ -26,20 +26,18 @@
#include "libavcodec/mpegvideo.h"
#include "dsputil_mmx.h"
#if HAVE_INLINE_ASM
extern uint16_t ff_inv_zigzag_direct16[64];
#if HAVE_MMX
#if HAVE_MMX_INLINE
#define COMPILE_TEMPLATE_MMXEXT 0
#define COMPILE_TEMPLATE_SSE2 0
#define COMPILE_TEMPLATE_SSSE3 0
#define RENAME(a) a ## _MMX
#define RENAMEl(a) a ## _mmx
#include "mpegvideoenc_template.c"
#endif /* HAVE_MMX */
#endif /* HAVE_MMX_INLINE */
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
#undef COMPILE_TEMPLATE_SSSE3
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_MMXEXT
......@@ -51,9 +49,9 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2
#include "mpegvideoenc_template.c"
#endif /* HAVE_MMXEXT */
#endif /* HAVE_MMXEXT_INLINE */
#if HAVE_SSE2
#if HAVE_SSE2_INLINE
#undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_SSSE3
......@@ -65,9 +63,9 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSE2
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif /* HAVE_SSE2 */
#endif /* HAVE_SSE2_INLINE */
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_SSSE3
......@@ -79,33 +77,29 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSSE3
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif /* HAVE_SSSE3 */
#endif /* HAVE_INLINE_ASM */
#endif /* HAVE_SSSE3_INLINE */
void ff_MPV_encode_init_x86(MpegEncContext *s)
{
#if HAVE_INLINE_ASM
int mm_flags = av_get_cpu_flags();
const int dct_algo = s->avctx->dct_algo;
if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
#if HAVE_MMX
#if HAVE_MMX_INLINE
if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX)
s->dct_quantize = dct_quantize_MMX;
#endif
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
s->dct_quantize = dct_quantize_MMX2;
#endif
#if HAVE_SSE2
#if HAVE_SSE2_INLINE
if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2)
s->dct_quantize = dct_quantize_SSE2;
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if (mm_flags & AV_CPU_FLAG_SSSE3)
s->dct_quantize = dct_quantize_SSSE3;
#endif
}
#endif /* HAVE_INLINE_ASM */
}
......@@ -29,7 +29,7 @@
DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
{
intptr_t x;
......@@ -77,7 +77,7 @@ static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uin
}
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
{
intptr_t x;
......@@ -122,9 +122,9 @@ static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const ui
:"memory"
);
}
#endif // HAVE_SSSE3
#endif /* HAVE_SSSE3_INLINE */
#if HAVE_SSE
#if HAVE_SSE2_INLINE
static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width)
{
#define BLURV(load)\
......@@ -165,7 +165,7 @@ static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *
BLURV("movdqa");
}
}
#endif // HAVE_SSE
#endif /* HAVE_SSE2_INLINE */
#endif /* HAVE_INLINE_ASM */
......@@ -173,18 +173,16 @@ av_cold void ff_gradfun_init_x86(GradFunContext *gf)
{
int cpu_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT)
gf->filter_line = gradfun_filter_line_mmx2;
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if (cpu_flags & AV_CPU_FLAG_SSSE3)
gf->filter_line = gradfun_filter_line_ssse3;
#endif
#if HAVE_SSE
#if HAVE_SSE2_INLINE
if (cpu_flags & AV_CPU_FLAG_SSE2)
gf->blur_line = gradfun_blur_line_sse2;
#endif
#endif /* HAVE_INLINE_ASM */
}
......@@ -30,7 +30,7 @@
DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL};
DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL};
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
#define COMPILE_TEMPLATE_SSE2 1
#define COMPILE_TEMPLATE_SSSE3 1
#undef RENAME
......@@ -39,14 +39,14 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010
#undef COMPILE_TEMPLATE_SSSE3
#endif
#if HAVE_SSE
#if HAVE_SSE2_INLINE
#undef RENAME
#define RENAME(a) a ## _sse2
#include "yadif_template.c"
#undef COMPILE_TEMPLATE_SSE2
#endif
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
#undef RENAME
#define RENAME(a) a ## _mmx2
#include "yadif_template.c"
......@@ -58,18 +58,16 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif)
{
int cpu_flags = av_get_cpu_flags();
#if HAVE_INLINE_ASM
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT)
yadif->filter_line = yadif_filter_line_mmx2;
#endif
#if HAVE_SSE
#if HAVE_SSE2_INLINE
if (cpu_flags & AV_CPU_FLAG_SSE2)
yadif->filter_line = yadif_filter_line_sse2;
#endif
#if HAVE_SSSE3
#if HAVE_SSSE3_INLINE
if (cpu_flags & AV_CPU_FLAG_SSSE3)
yadif->filter_line = yadif_filter_line_ssse3;
#endif
#endif /* HAVE_INLINE_ASM */
}
......@@ -316,6 +316,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_TSCC2, MKTAG('T', 'S', 'C', '2') },
{ AV_CODEC_ID_MTS2, MKTAG('M', 'T', 'S', '2') },
{ AV_CODEC_ID_CLLC, MKTAG('C', 'L', 'L', 'C') },
{ AV_CODEC_ID_MSS2, MKTAG('M', 'S', 'S', '2') },
{ AV_CODEC_ID_NONE, 0 }
};
......
......@@ -155,7 +155,7 @@ cglobal conv_s32_to_flt, 3,3,3, dst, src, len
INIT_XMM sse2
CONV_S32_TO_FLT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
CONV_S32_TO_FLT
%endif
......@@ -223,7 +223,7 @@ cglobal conv_flt_to_s32, 3,3,5, dst, src, len
INIT_XMM sse2
CONV_FLT_TO_S32
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
CONV_FLT_TO_S32
%endif
......@@ -260,7 +260,7 @@ cglobal conv_s16p_to_s16_2ch, 3,4,5, dst, src0, len, src1
INIT_XMM sse2
CONV_S16P_TO_S16_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_S16_2CH
%endif
......@@ -383,7 +383,7 @@ INIT_XMM sse2
CONV_S16P_TO_S16_6CH
INIT_XMM sse2slow
CONV_S16P_TO_S16_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_S16_6CH
%endif
......@@ -432,7 +432,7 @@ cglobal conv_s16p_to_flt_2ch, 3,4,6, dst, src0, len, src1
INIT_XMM sse2
CONV_S16P_TO_FLT_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_FLT_2CH
%endif
......@@ -536,7 +536,7 @@ INIT_XMM sse2
CONV_S16P_TO_FLT_6CH
INIT_XMM ssse3
CONV_S16P_TO_FLT_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16P_TO_FLT_6CH
%endif
......@@ -692,7 +692,7 @@ INIT_MMX sse
CONV_FLTP_TO_S16_6CH
INIT_XMM sse2
CONV_FLTP_TO_S16_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLTP_TO_S16_6CH
%endif
......@@ -729,7 +729,7 @@ cglobal conv_fltp_to_flt_2ch, 3,4,5, dst, src0, len, src1
INIT_XMM sse
CONV_FLTP_TO_FLT_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLTP_TO_FLT_2CH
%endif
......@@ -810,7 +810,7 @@ INIT_MMX mmx
CONV_FLTP_TO_FLT_6CH
INIT_XMM sse4
CONV_FLTP_TO_FLT_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLTP_TO_FLT_6CH
%endif
......@@ -859,7 +859,7 @@ INIT_XMM sse2
CONV_S16_TO_S16P_2CH
INIT_XMM ssse3
CONV_S16_TO_S16P_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16_TO_S16P_2CH
%endif
......@@ -920,7 +920,7 @@ CONV_S16_TO_S16P_6CH
%define PALIGNR PALIGNR_SSSE3
INIT_XMM ssse3
CONV_S16_TO_S16P_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16_TO_S16P_6CH
%endif
......@@ -958,7 +958,7 @@ cglobal conv_s16_to_fltp_2ch, 3,4,5, dst0, src, len, dst1
INIT_XMM sse2
CONV_S16_TO_FLTP_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16_TO_FLTP_2CH
%endif
......@@ -1041,7 +1041,7 @@ INIT_XMM ssse3
CONV_S16_TO_FLTP_6CH
INIT_XMM sse4
CONV_S16_TO_FLTP_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_S16_TO_FLTP_6CH
%endif
......@@ -1087,7 +1087,7 @@ cglobal conv_flt_to_s16p_2ch, 3,4,6, dst0, src, len, dst1
INIT_XMM sse2
CONV_FLT_TO_S16P_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLT_TO_S16P_2CH
%endif
......@@ -1161,7 +1161,7 @@ CONV_FLT_TO_S16P_6CH
%define PALIGNR PALIGNR_SSSE3
INIT_XMM ssse3
CONV_FLT_TO_S16P_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLT_TO_S16P_6CH
%endif
......@@ -1193,7 +1193,7 @@ cglobal conv_flt_to_fltp_2ch, 3,4,3, dst0, src, len, dst1
INIT_XMM sse
CONV_FLT_TO_FLTP_2CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLT_TO_FLTP_2CH
%endif
......@@ -1256,7 +1256,7 @@ cglobal conv_flt_to_fltp_6ch, 2,7,7, dst, src, dst1, dst2, dst3, dst4, dst5
INIT_XMM sse2
CONV_FLT_TO_FLTP_6CH
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
CONV_FLT_TO_FLTP_6CH
%endif
......@@ -56,7 +56,7 @@ cglobal mix_2_to_1_fltp_flt, 3,4,6, src, matrix, len, src1
INIT_XMM sse
MIX_2_TO_1_FLTP_FLT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
MIX_2_TO_1_FLTP_FLT
%endif
......@@ -175,7 +175,7 @@ cglobal mix_1_to_2_fltp_flt, 3,5,4, src0, matrix0, len, src1, matrix1
INIT_XMM sse
MIX_1_TO_2_FLTP_FLT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
MIX_1_TO_2_FLTP_FLT
%endif
......@@ -222,7 +222,7 @@ INIT_XMM sse2
MIX_1_TO_2_S16P_FLT
INIT_XMM sse4
MIX_1_TO_2_S16P_FLT
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_XMM avx
MIX_1_TO_2_S16P_FLT
%endif
......@@ -490,7 +490,7 @@ cglobal mix_%1_to_%2_%3_flt, 3,in_channels+2,needed_mmregs+matrix_elements_mm, s
MIX_3_8_TO_1_2_FLT %%i, 1, s16p
MIX_3_8_TO_1_2_FLT %%i, 2, s16p
; do not use ymm AVX or FMA4 in x86-32 for 6 or more channels due to stack alignment issues
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
%if ARCH_X86_64 || %%i < 6
INIT_YMM avx
%else
......@@ -502,7 +502,7 @@ cglobal mix_%1_to_%2_%3_flt, 3,in_channels+2,needed_mmregs+matrix_elements_mm, s
MIX_3_8_TO_1_2_FLT %%i, 1, s16p
MIX_3_8_TO_1_2_FLT %%i, 2, s16p
%endif
%if HAVE_FMA4
%if HAVE_FMA4_EXTERNAL
%if ARCH_X86_64 || %%i < 6
INIT_YMM fma4
%else
......
......@@ -158,7 +158,7 @@
# define ONLY_IF_THREADS_ENABLED(x) NULL
#endif
#if HAVE_MMX && HAVE_INLINE_ASM
#if HAVE_MMX_INLINE
/**
* Empty mmx state.
* this must be called between any dsp function and float/double code.
......@@ -172,8 +172,8 @@ static av_always_inline void emms_c(void)
#elif HAVE_MMX && HAVE_MM_EMPTY
# include <mmintrin.h>
# define emms_c _mm_empty
#else /* HAVE_MMX */
#else
# define emms_c()
#endif /* HAVE_MMX */
#endif /* HAVE_MMX_INLINE */
#endif /* AVUTIL_INTERNAL_H */
......@@ -47,7 +47,7 @@ ALIGN 16
INIT_XMM sse
VECTOR_FMUL
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
VECTOR_FMUL
%endif
......@@ -88,7 +88,7 @@ cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len
INIT_XMM sse
VECTOR_FMAC_SCALAR
%if HAVE_AVX
%if HAVE_AVX_EXTERNAL
INIT_YMM avx
VECTOR_FMAC_SCALAR
%endif
......@@ -542,7 +542,7 @@ static int swScale(SwsContext *c, const uint8_t *src[],
if (!enough_lines)
break; // we can't output a dstY line so let's try with the next slice
#if HAVE_MMX && HAVE_INLINE_ASM
#if HAVE_MMX_INLINE
updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex,
lastInLumBuf, lastInChrBuf);
#endif
......
......@@ -599,7 +599,7 @@ fail:
return ret;
}
#if HAVE_MMXEXT && HAVE_INLINE_ASM
#if HAVE_MMXEXT_INLINE
static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode,
int16_t *filter, int32_t *filterPos, int numSplits)
{
......@@ -762,7 +762,7 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode,
return fragmentPos + 1;
}
#endif /* HAVE_MMXEXT && HAVE_INLINE_ASM */
#endif /* HAVE_MMXEXT_INLINE */
static void getSubSampleFactors(int *h, int *v, enum PixelFormat format)
{
......@@ -1063,7 +1063,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
/* precalculate horizontal scaler filter coefficients */
{
#if HAVE_MMXEXT && HAVE_INLINE_ASM
#if HAVE_MMXEXT_INLINE
// can't downscale !!!
if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
c->lumMmx2FilterCodeSize = initMMX2HScaler(dstW, c->lumXInc, NULL,
......@@ -1107,7 +1107,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
#endif
} else
#endif /* HAVE_MMXEXT && HAVE_INLINE_ASM */
#endif /* HAVE_MMXEXT_INLINE */
{
const int filterAlign =
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 :
......@@ -1688,7 +1688,7 @@ void sws_freeContext(SwsContext *c)
av_freep(&c->hLumFilterPos);
av_freep(&c->hChrFilterPos);
#if HAVE_MMX
#if HAVE_MMX_INLINE
#ifdef MAP_ANONYMOUS
if (c->lumMmx2FilterCode)
munmap(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize);
......@@ -1705,7 +1705,7 @@ void sws_freeContext(SwsContext *c)
#endif
c->lumMmx2FilterCode = NULL;
c->chrMmx2FilterCode = NULL;
#endif /* HAVE_MMX */
#endif /* HAVE_MMX_INLINE */
av_freep(&c->yuvTable);
av_freep(&c->formatConvBuffer);
......
......@@ -72,7 +72,7 @@ DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
//MMX versions
#if HAVE_MMX
#if HAVE_MMX_INLINE
#undef RENAME
#define COMPILE_TEMPLATE_MMXEXT 0
#define RENAME(a) a ## _MMX
......@@ -80,7 +80,7 @@ DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
#endif
//MMX2 versions
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
#undef RENAME
#undef COMPILE_TEMPLATE_MMXEXT
#define COMPILE_TEMPLATE_MMXEXT 1
......@@ -375,7 +375,7 @@ av_cold void ff_sws_init_swScale_mmx(SwsContext *c)
#if HAVE_INLINE_ASM
if (cpu_flags & AV_CPU_FLAG_MMX)
sws_init_swScale_MMX(c);
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT)
sws_init_swScale_MMX2(c);
if (cpu_flags & AV_CPU_FLAG_SSE3){
......
......@@ -50,22 +50,22 @@ DECLARE_ASM_CONST(8, uint64_t, pb_03) = 0x0303030303030303ULL;
DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
//MMX versions
#if HAVE_MMX
#if HAVE_MMX_INLINE
#undef RENAME
#undef COMPILE_TEMPLATE_MMXEXT
#define COMPILE_TEMPLATE_MMXEXT 0
#define RENAME(a) a ## _MMX
#include "yuv2rgb_template.c"
#endif /* HAVE_MMX */
#endif /* HAVE_MMX_INLINE */
//MMX2 versions
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
#undef RENAME
#undef COMPILE_TEMPLATE_MMXEXT
#define COMPILE_TEMPLATE_MMXEXT 1
#define RENAME(a) a ## _MMX2
#include "yuv2rgb_template.c"
#endif /* HAVE_MMXEXT */
#endif /* HAVE_MMXEXT_INLINE */
#endif /* HAVE_INLINE_ASM */
......@@ -74,7 +74,7 @@ av_cold SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
#if HAVE_INLINE_ASM
int cpu_flags = av_get_cpu_flags();
#if HAVE_MMXEXT
#if HAVE_MMXEXT_INLINE
if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
switch (c->dstFormat) {
case PIX_FMT_RGB24: return yuv420_rgb24_MMX2;
......
......@@ -31,6 +31,9 @@
#include <io.h>
#endif
#define FILENAME_BUF_SIZE 4096
#include "libavutil/avstring.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
......@@ -48,8 +51,8 @@ static int usage(int ret)
int main(int argc, char **argv)
{
char fntemplate[PATH_MAX];
char pktfilename[PATH_MAX];
char fntemplate[FILENAME_BUF_SIZE];
char pktfilename[FILENAME_BUF_SIZE];
AVFormatContext *fctx = NULL;
AVPacket pkt;
int64_t pktnum = 0;
......@@ -70,16 +73,16 @@ int main(int argc, char **argv)
return usage(1);
if (argc > 2)
maxpkts = atoi(argv[2]);
strncpy(fntemplate, argv[1], PATH_MAX - 1);
av_strlcpy(fntemplate, argv[1], sizeof(fntemplate));
if (strrchr(argv[1], '/'))
strncpy(fntemplate, strrchr(argv[1], '/') + 1, PATH_MAX - 1);
av_strlcpy(fntemplate, strrchr(argv[1], '/') + 1, sizeof(fntemplate));
if (strrchr(fntemplate, '.'))
*strrchr(fntemplate, '.') = '\0';
if (strchr(fntemplate, '%')) {
fprintf(stderr, "can't use filenames containing '%%'\n");
return usage(1);
}
if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= PATH_MAX - 1) {
if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= sizeof(fntemplate) - 1) {
fprintf(stderr, "filename too long\n");
return usage(1);
}
......@@ -105,7 +108,7 @@ int main(int argc, char **argv)
while ((err = av_read_frame(fctx, &pkt)) >= 0) {
int fd;
snprintf(pktfilename, PATH_MAX - 1, fntemplate, pktnum,
snprintf(pktfilename, sizeof(pktfilename), fntemplate, pktnum,
pkt.stream_index, pkt.pts, pkt.size,
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size,
......
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