Commit 612122b1 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote branch 'qatar/master'

* qatar/master: (32 commits)
  10-bit H.264 x86 chroma v loopfilter asm
  Port SMPTE S302M audio decoder from FFmbc 0.3. [Copyright headers corrected]
  Fix crash of interlaced MPEG2 decoding
  h264pred: fix one more aliasing violation.
  doc/APIchanges: fill in missing hashes and dates.
  flacenc: use proper initializers for AVOption default values.
  lavc: deprecate named constants for deprecated antialias_algo.
  aac: workaround for compilation on cygwin
  swscale: extend YUV422p support to 10bits depth
  tiff: add support for inverted FillOrder for uncompressed data
  Remove unused softfloat implementation.
  h264pred: fix aliasing violations.
  rotozoom: Eliminate French variable name.
  rotozoom: Check return value of fread().
  rotozoom: Return an error value instead of calling exit().
  rotozoom: Make init_demo() return int and check for errors on invocation.
  rotozoom: Drop silly UINT8 typedef.
  rotozoom: Drop some unnecessary parentheses.
  rotozoom: K&R coding style cosmetics
  rtsp: Only do keepalive using GET_PARAMETER if the server supports it
  ...

Conflicts:
	Changelog
	cmdutils.c
	doc/APIchanges
	doc/general.texi
	ffmpeg.c
	ffplay.c
	libavcodec/h264pred_template.c
	libavcodec/resample.c
	libavutil/pixfmt.h
	libavutil/softfloat.c
	libavutil/softfloat.h
	tests/rotozoom.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 4ea216e7 5705b020
......@@ -12,6 +12,8 @@ version <next>:
- Lots of deprecated API cruft removed
- fft and imdct optimizations for AVX (Sandy Bridge) processors
- showinfo filter added
- DPX image encoder
- SMPTE 302M AES3 audio decoder
version 0.7_beta1:
......
......@@ -13,7 +13,7 @@ libavutil: 2011-04-18
API changes, most recent first:
2011-05-10 - xxxxxxx - lavc 53.3.0 - avcodec.h
2011-05-10 - 188dea1 - lavc 53.3.0 - avcodec.h
Deprecate AVLPCType and the following fields in
AVCodecContext: lpc_coeff_precision, prediction_order_method,
min_partition_order, max_partition_order, lpc_type, lpc_passes.
......@@ -43,15 +43,15 @@ API changes, most recent first:
Add av_dynarray_add function for adding
an element to a dynamic array.
2011-04-XX - bebe72f - lavu 51.1.0 - avutil.h
2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h
Add AVPictureType enum and av_get_picture_type_char(), deprecate
FF_*_TYPE defines and av_get_pict_type_char() defined in
libavcodec/avcodec.h.
2011-04-xx - 10d3940 - lavfi 2.3.0 - avfilter.h
2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h
Add pict_type and key_frame fields to AVFilterBufferRefVideo.
2011-04-xx - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
Add sample_aspect_ratio fields to vsrc_buffer arguments
2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
......
......@@ -19,7 +19,6 @@ integer.c 128bit integer math
lls.c
mathematics.c greatest common divisor, integer sqrt, integer log2, ...
mem.c memory allocation routines with guaranteed alignment
softfloat.c
Headers:
bswap.h big/little/native-endian conversion code
......
......@@ -677,6 +677,7 @@ following image formats are supported:
@item Sierra VMD audio @tab @tab X
@tab Used in Sierra VMD files.
@item Smacker audio @tab @tab X
@item SMPTE 302M AES3 audio @tab @tab X
@item Sonic @tab X @tab X
@tab experimental codec
@item Sonic lossless @tab X @tab X
......
......@@ -329,6 +329,7 @@ OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o \
mpegvideo.o error_resilience.o
OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv40dsp.o \
mpegvideo.o error_resilience.o
OBJS-$(CONFIG_S302M_DECODER) += s302m.o
OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
......
......@@ -30,6 +30,8 @@
* add sane pulse detection
***********************************/
#include "libavutil/libm.h" // brought forward to work around cygwin header breakage
#include <float.h>
#include <math.h>
#include "avcodec.h"
......@@ -37,7 +39,6 @@
#include "aac.h"
#include "aacenc.h"
#include "aactab.h"
#include "libavutil/libm.h"
/** bits needed to code codebook run value for long windows */
static const uint8_t run_value_bits_long[64] = {
......
......@@ -184,6 +184,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (RV20, rv20);
REGISTER_DECODER (RV30, rv30);
REGISTER_DECODER (RV40, rv40);
REGISTER_DECODER (S302M, s302m);
REGISTER_ENCDEC (SGI, sgi);
REGISTER_DECODER (SMACKER, smacker);
REGISTER_DECODER (SMC, smc);
......
......@@ -232,6 +232,7 @@ enum CodecID {
CODEC_ID_PCM_F64LE,
CODEC_ID_PCM_BLURAY,
CODEC_ID_PCM_LXF,
CODEC_ID_S302M,
/* various ADPCM codecs */
CODEC_ID_ADPCM_IMA_QT= 0x11000,
......
......@@ -1352,22 +1352,22 @@ static av_cold int flac_encode_close(AVCodecContext *avctx)
#define FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
static const AVOption options[] = {
{ "lpc_coeff_precision", "LPC coefficient precision", offsetof(FlacEncodeContext, options.lpc_coeff_precision), FF_OPT_TYPE_INT, 15, 0, MAX_LPC_PRECISION, FLAGS },
{ "lpc_type", "LPC algorithm", offsetof(FlacEncodeContext, options.lpc_type), FF_OPT_TYPE_INT, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_NB-1, FLAGS, "lpc_type" },
{ "none", NULL, 0, FF_OPT_TYPE_CONST, FF_LPC_TYPE_NONE, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "fixed", NULL, 0, FF_OPT_TYPE_CONST, FF_LPC_TYPE_FIXED, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "levinson", NULL, 0, FF_OPT_TYPE_CONST, FF_LPC_TYPE_LEVINSON, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "cholesky", NULL, 0, FF_OPT_TYPE_CONST, FF_LPC_TYPE_CHOLESKY, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "lpc_passes", "Number of passes to use for Cholesky factorization during LPC analysis", offsetof(FlacEncodeContext, options.lpc_passes), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, FLAGS },
{ "min_partition_order", NULL, offsetof(FlacEncodeContext, options.min_partition_order), FF_OPT_TYPE_INT, -1, -1, MAX_PARTITION_ORDER, FLAGS },
{ "max_partition_order", NULL, offsetof(FlacEncodeContext, options.max_partition_order), FF_OPT_TYPE_INT, -1, -1, MAX_PARTITION_ORDER, FLAGS },
{ "prediction_order_method", "Search method for selecting prediction order", offsetof(FlacEncodeContext, options.prediction_order_method), FF_OPT_TYPE_INT, -1, -1, ORDER_METHOD_LOG, FLAGS, "predm" },
{ "estimation", NULL, 0, FF_OPT_TYPE_CONST, ORDER_METHOD_EST, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "2level", NULL, 0, FF_OPT_TYPE_CONST, ORDER_METHOD_2LEVEL, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "4level", NULL, 0, FF_OPT_TYPE_CONST, ORDER_METHOD_4LEVEL, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "8level", NULL, 0, FF_OPT_TYPE_CONST, ORDER_METHOD_8LEVEL, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "search", NULL, 0, FF_OPT_TYPE_CONST, ORDER_METHOD_SEARCH, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "log", NULL, 0, FF_OPT_TYPE_CONST, ORDER_METHOD_LOG, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "lpc_coeff_precision", "LPC coefficient precision", offsetof(FlacEncodeContext, options.lpc_coeff_precision), FF_OPT_TYPE_INT, {.dbl = 15 }, 0, MAX_LPC_PRECISION, FLAGS },
{ "lpc_type", "LPC algorithm", offsetof(FlacEncodeContext, options.lpc_type), FF_OPT_TYPE_INT, {.dbl = FF_LPC_TYPE_DEFAULT }, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_NB-1, FLAGS, "lpc_type" },
{ "none", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_NONE }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "fixed", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "levinson", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "cholesky", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_CHOLESKY }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
{ "lpc_passes", "Number of passes to use for Cholesky factorization during LPC analysis", offsetof(FlacEncodeContext, options.lpc_passes), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, FLAGS },
{ "min_partition_order", NULL, offsetof(FlacEncodeContext, options.min_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
{ "max_partition_order", NULL, offsetof(FlacEncodeContext, options.max_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
{ "prediction_order_method", "Search method for selecting prediction order", offsetof(FlacEncodeContext, options.prediction_order_method), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, ORDER_METHOD_LOG, FLAGS, "predm" },
{ "estimation", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_EST }, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "2level", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_2LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "4level", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_4LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "8level", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_8LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "search", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_SEARCH }, INT_MIN, INT_MAX, FLAGS, "predm" },
{ "log", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_LOG }, INT_MIN, INT_MAX, FLAGS, "predm" },
{ NULL },
};
......
......@@ -305,11 +305,11 @@ static const AVOption options[]={
{"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
#if FF_API_ANTIALIAS_ALGO
{"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D, "aa"},
#endif
{"auto", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_AA_AUTO }, INT_MIN, INT_MAX, V|D, "aa"},
{"fastint", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_AA_FASTINT }, INT_MIN, INT_MAX, V|D, "aa"},
{"int", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_AA_INT }, INT_MIN, INT_MAX, V|D, "aa"},
{"float", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_AA_FLOAT }, INT_MIN, INT_MAX, V|D, "aa"},
#endif
{"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"threads", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E|D},
{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
......
This diff is collapsed.
/*
* SMPTE 302M decoder
* Copyright (c) 2008 Laurent Aimar <fenrir@videolan.org>
* Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#define AES3_HEADER_LEN 4
static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
int buf_size)
{
uint32_t h;
int frame_size, channels, id, bits;
if (buf_size <= AES3_HEADER_LEN) {
av_log(avctx, AV_LOG_ERROR, "frame is too short\n");
return AVERROR_INVALIDDATA;
}
/*
* AES3 header :
* size: 16
* number channels 2
* channel_id 8
* bits per samples 2
* alignments 4
*/
h = AV_RB32(buf);
frame_size = (h >> 16) & 0xffff;
channels = ((h >> 14) & 0x0003) * 2 + 2;
id = (h >> 6) & 0x00ff;
bits = ((h >> 4) & 0x0003) * 4 + 16;
if (AES3_HEADER_LEN + frame_size != buf_size || bits > 24) {
av_log(avctx, AV_LOG_ERROR, "frame has invalid header\n");
return AVERROR_INVALIDDATA;
}
/* Set output properties */
avctx->bits_per_coded_sample = bits;
if (bits > 16)
avctx->sample_fmt = SAMPLE_FMT_S32;
else
avctx->sample_fmt = SAMPLE_FMT_S16;
avctx->channels = channels;
avctx->sample_rate = 48000;
avctx->bit_rate = 48000 * avctx->channels * (avctx->bits_per_coded_sample + 4) +
32 * (48000 / (buf_size * 8 /
(avctx->channels *
(avctx->bits_per_coded_sample + 4))));
return frame_size;
}
static int s302m_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int frame_size = s302m_parse_frame_header(avctx, buf, buf_size);
if (frame_size < 0)
return frame_size;
buf_size -= AES3_HEADER_LEN;
buf += AES3_HEADER_LEN;
if (*data_size < 4 * buf_size * 8 / (avctx->bits_per_coded_sample + 4))
return -1;
if (avctx->bits_per_coded_sample == 24) {
uint32_t *o = data;
for (; buf_size > 6; buf_size -= 7) {
*o++ = (av_reverse[buf[2]] << 24) |
(av_reverse[buf[1]] << 16) |
(av_reverse[buf[0]] << 8);
*o++ = (av_reverse[buf[6] & 0xf0] << 28) |
(av_reverse[buf[5]] << 20) |
(av_reverse[buf[4]] << 12) |
(av_reverse[buf[3] & 0x0f] << 8);
buf += 7;
}
*data_size = (uint8_t*) o - (uint8_t*) data;
} else if (avctx->bits_per_coded_sample == 20) {
uint32_t *o = data;
for (; buf_size > 5; buf_size -= 6) {
*o++ = (av_reverse[buf[2] & 0xf0] << 28) |
(av_reverse[buf[1]] << 20) |
(av_reverse[buf[0]] << 12);
*o++ = (av_reverse[buf[5] & 0xf0] << 28) |
(av_reverse[buf[4]] << 20) |
(av_reverse[buf[3]] << 12);
buf += 6;
}
*data_size = (uint8_t*) o - (uint8_t*) data;
} else {
uint16_t *o = data;
for (; buf_size > 4; buf_size -= 5) {
*o++ = (av_reverse[buf[1]] << 8) |
av_reverse[buf[0]];
*o++ = (av_reverse[buf[4] & 0xf0] << 12) |
(av_reverse[buf[3]] << 4) |
av_reverse[buf[2] & 0x0f];
buf += 5;
}
*data_size = (uint8_t*) o - (uint8_t*) data;
}
return buf - avpkt->data;
}
AVCodec ff_s302m_decoder = {
.name = "s302m",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_S302M,
.priv_data_size = 0,
.decode = s302m_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("SMPTE 302M"),
};
......@@ -168,7 +168,13 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
}
switch(s->compr){
case TIFF_RAW:
if (!s->fill_order) {
memcpy(dst, src, width);
} else {
int i;
for (i = 0; i < width; i++)
dst[i] = av_reverse[src[i]];
}
src += width;
break;
case TIFF_PACKBITS:
......
......@@ -9,6 +9,7 @@ YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o \
MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_mmx.o
YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
x86/h264_deblock_10bit.o \
x86/h264_weight.o \
x86/h264_idct.o \
......
......@@ -43,6 +43,7 @@ DECLARE_ALIGNED(16, const uint64_t, ff_pdw_80000000)[2] =
{0x8000000080000000ULL, 0x8000000080000000ULL};
DECLARE_ALIGNED(8, const uint64_t, ff_pw_1 ) = 0x0001000100010001ULL;
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_2 ) = {0x0002000200020002ULL, 0x0002000200020002ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3 ) = {0x0003000300030003ULL, 0x0003000300030003ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_4 ) = {0x0004000400040004ULL, 0x0004000400040004ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5 ) = {0x0005000500050005ULL, 0x0005000500050005ULL};
......
This diff is collapsed.
This diff is collapsed.
......@@ -218,41 +218,57 @@ static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40]
);
}
#define LF_FUNC(DIR, TYPE, OPT) \
void ff_x264_deblock_ ## DIR ## _ ## TYPE ## _ ## OPT (uint8_t *pix, int stride, \
#define LF_FUNC(DIR, TYPE, DEPTH, OPT) \
void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *pix, int stride, \
int alpha, int beta, int8_t *tc0);
#define LF_IFUNC(DIR, TYPE, OPT) \
void ff_x264_deblock_ ## DIR ## _ ## TYPE ## _ ## OPT (uint8_t *pix, int stride, \
#define LF_IFUNC(DIR, TYPE, DEPTH, OPT) \
void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *pix, int stride, \
int alpha, int beta);
LF_FUNC (h, chroma, mmxext)
LF_IFUNC(h, chroma_intra, mmxext)
LF_FUNC (v, chroma, mmxext)
LF_IFUNC(v, chroma_intra, mmxext)
LF_FUNC (h, luma, mmxext)
LF_IFUNC(h, luma_intra, mmxext)
#if HAVE_YASM && ARCH_X86_32
LF_FUNC (v8, luma, mmxext)
static void ff_x264_deblock_v_luma_mmxext(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
#define LF_FUNCS(type, depth)\
LF_FUNC (h, chroma, depth, mmxext)\
LF_IFUNC(h, chroma_intra, depth, mmxext)\
LF_FUNC (v, chroma, depth, mmxext)\
LF_IFUNC(v, chroma_intra, depth, mmxext)\
LF_FUNC (h, luma, depth, mmxext)\
LF_IFUNC(h, luma_intra, depth, mmxext)\
LF_FUNC (h, luma, depth, sse2)\
LF_IFUNC(h, luma_intra, depth, sse2)\
LF_FUNC (v, luma, depth, sse2)\
LF_IFUNC(v, luma_intra, depth, sse2)\
LF_FUNC (h, chroma, depth, sse2)\
LF_IFUNC(h, chroma_intra, depth, sse2)\
LF_FUNC (v, chroma, depth, sse2)\
LF_IFUNC(v, chroma_intra, depth, sse2)\
LF_FUNC (h, luma, depth, avx)\
LF_IFUNC(h, luma_intra, depth, avx)\
LF_FUNC (v, luma, depth, avx)\
LF_IFUNC(v, luma_intra, depth, avx)\
LF_FUNC (h, chroma, depth, avx)\
LF_IFUNC(h, chroma_intra, depth, avx)\
LF_FUNC (v, chroma, depth, avx)\
LF_IFUNC(v, chroma_intra, depth, avx)
LF_FUNCS( uint8_t, 8)
LF_FUNCS(uint16_t, 10)
LF_FUNC (v8, luma, 8, mmxext)
static void ff_deblock_v_luma_8_mmxext(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
if((tc0[0] & tc0[1]) >= 0)
ff_x264_deblock_v8_luma_mmxext(pix+0, stride, alpha, beta, tc0);
ff_deblock_v8_luma_8_mmxext(pix+0, stride, alpha, beta, tc0);
if((tc0[2] & tc0[3]) >= 0)
ff_x264_deblock_v8_luma_mmxext(pix+8, stride, alpha, beta, tc0+2);
ff_deblock_v8_luma_8_mmxext(pix+8, stride, alpha, beta, tc0+2);
}
LF_IFUNC(v8, luma_intra, mmxext)
static void ff_x264_deblock_v_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta)
LF_IFUNC(v8, luma_intra, 8, mmxext)
static void ff_deblock_v_luma_intra_8_mmxext(uint8_t *pix, int stride, int alpha, int beta)
{
ff_x264_deblock_v8_luma_intra_mmxext(pix+0, stride, alpha, beta);
ff_x264_deblock_v8_luma_intra_mmxext(pix+8, stride, alpha, beta);
ff_deblock_v8_luma_intra_8_mmxext(pix+0, stride, alpha, beta);
ff_deblock_v8_luma_intra_8_mmxext(pix+8, stride, alpha, beta);
}
#endif
LF_FUNC (h, luma, sse2)
LF_IFUNC(h, luma_intra, sse2)
LF_FUNC (v, luma, sse2)
LF_IFUNC(v, luma_intra, sse2)
LF_FUNC (v, luma, 10, mmxext)
LF_IFUNC(v, luma_intra, 10, mmxext)
/***********************************/
/* weighted prediction */
......@@ -314,15 +330,15 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
c->h264_idct_add8 = ff_h264_idct_add8_mmx2;
c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2;
c->h264_v_loop_filter_chroma= ff_x264_deblock_v_chroma_mmxext;
c->h264_h_loop_filter_chroma= ff_x264_deblock_h_chroma_mmxext;
c->h264_v_loop_filter_chroma_intra= ff_x264_deblock_v_chroma_intra_mmxext;
c->h264_h_loop_filter_chroma_intra= ff_x264_deblock_h_chroma_intra_mmxext;
c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_8_mmxext;
c->h264_h_loop_filter_chroma= ff_deblock_h_chroma_8_mmxext;
c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_8_mmxext;
c->h264_h_loop_filter_chroma_intra= ff_deblock_h_chroma_intra_8_mmxext;
#if ARCH_X86_32
c->h264_v_loop_filter_luma= ff_x264_deblock_v_luma_mmxext;
c->h264_h_loop_filter_luma= ff_x264_deblock_h_luma_mmxext;
c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_mmxext;
c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_mmxext;
c->h264_v_loop_filter_luma= ff_deblock_v_luma_8_mmxext;
c->h264_h_loop_filter_luma= ff_deblock_h_luma_8_mmxext;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_mmxext;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_mmxext;
#endif
c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2;
c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2;
......@@ -360,10 +376,10 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_sse2;
#if HAVE_ALIGNED_STACK
c->h264_v_loop_filter_luma = ff_x264_deblock_v_luma_sse2;
c->h264_h_loop_filter_luma = ff_x264_deblock_h_luma_sse2;
c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_sse2;
c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_sse2;
c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_sse2;
c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_sse2;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_sse2;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_sse2;
#endif
c->h264_idct_add16 = ff_h264_idct_add16_sse2;
......@@ -377,6 +393,49 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth)
c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_ssse3;
c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_ssse3;
}
if (mm_flags&AV_CPU_FLAG_AVX) {
#if HAVE_ALIGNED_STACK
c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx;
c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_avx;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_avx;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx;
#endif
}
}
}
#endif
} else if (bit_depth == 10) {
#if HAVE_YASM
if (mm_flags & AV_CPU_FLAG_MMX) {
if (mm_flags & AV_CPU_FLAG_MMX2) {
#if ARCH_X86_32
c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_mmxext;
c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_mmxext;
c->h264_v_loop_filter_luma= ff_deblock_v_luma_10_mmxext;
c->h264_h_loop_filter_luma= ff_deblock_h_luma_10_mmxext;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_mmxext;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_mmxext;
#endif
if (mm_flags&AV_CPU_FLAG_SSE2) {
c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_sse2;
c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_sse2;
#if HAVE_ALIGNED_STACK
c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_sse2;
c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_sse2;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_sse2;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
#endif
}
if (mm_flags&AV_CPU_FLAG_AVX) {
c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_avx;
c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_avx;
#if HAVE_ALIGNED_STACK
c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_avx;
c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_avx;
c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_avx;
c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
#endif
}
}
}
#endif
......
......@@ -24,16 +24,20 @@
;******************************************************************************
%macro SBUTTERFLY 4
%if avx_enabled == 0
mova m%4, m%2
punpckl%1 m%2, m%3
punpckh%1 m%4, m%3
%else
punpckh%1 m%4, m%2, m%3
punpckl%1 m%2, m%3
%endif
SWAP %3, %4
%endmacro
%macro SBUTTERFLY2 4
mova m%4, m%2
punpckh%1 m%2, m%3
punpckl%1 m%4, m%3
punpckl%1 m%4, m%2, m%3
punpckh%1 m%2, m%2, m%3
SWAP %2, %4, %3
%endmacro
......@@ -444,3 +448,17 @@
%macro PMINUB_MMXEXT 3 ; dst, src, ignored
pminub %1, %2
%endmacro
%macro SPLATW 2-3 0
%if mmsize == 16
pshuflw %1, %2, (%3)*0x55
punpcklqdq %1, %1
%else
pshufw %1, %2, (%3)*0x55
%endif
%endmacro
%macro CLIPW 3 ;(dst, min, max)
pmaxsw %1, %2
pminsw %1, %3
%endmacro
......@@ -524,6 +524,7 @@ static const StreamType MISC_types[] = {
static const StreamType REGD_types[] = {
{ MKTAG('d','r','a','c'), AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC },
{ MKTAG('A','C','-','3'), AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
{ MKTAG('B','S','S','D'), AVMEDIA_TYPE_AUDIO, CODEC_ID_S302M },
{ 0 },
};
......
......@@ -808,6 +808,10 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
p += strspn(p, SPACE_CHARS);
if (method && !strcmp(method, "PLAY"))
rtsp_parse_rtp_info(rt, p);
} else if (av_stristart(p, "Public:", &p) && rt) {
if (strstr(p, "GET_PARAMETER") &&
method && !strcmp(method, "OPTIONS"))
rt->get_parameter_supported = 1;
}
}
......
......@@ -331,6 +331,11 @@ typedef struct RTSPState {
* Polling array for udp
*/
struct pollfd *p;
/**
* Whether the server supports the GET_PARAMETER method.
*/
int get_parameter_supported;
} RTSPState;
/**
......
......@@ -341,7 +341,9 @@ retry:
/* send dummy request to keep TCP connection alive */
if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
if (rt->server_type != RTSP_SERVER_REAL) {
if (rt->server_type == RTSP_SERVER_WMS ||
(rt->server_type != RTSP_SERVER_REAL &&
rt->get_parameter_supported)) {
ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
} else {
ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
......
......@@ -75,7 +75,7 @@ OBJS-$(ARCH_ARM) += arm/cpu.o
OBJS-$(ARCH_PPC) += ppc/cpu.o
OBJS-$(ARCH_X86) += x86/cpu.o
TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha softfloat tree
TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha tree
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
DIRS = arm bfin sh4 x86
......
......@@ -24,47 +24,52 @@
#include <stdio.h>
#include <inttypes.h>
#define FIXP (1<<16)
#define MY_PI 205887 //(M_PI*FIX)
#define FIXP (1 << 16)
#define MY_PI 205887 //(M_PI * FIX)
static int64_t int_pow(int64_t a, int p){
int64_t v= FIXP;
static int64_t int_pow(int64_t a, int p)
{
int64_t v = FIXP;
for(; p; p--){
v*= a;
v/= FIXP;
for (; p; p--) {
v *= a;
v /= FIXP;
}
return v;
}
static int64_t int_sin(int64_t a){
if(a<0) a= MY_PI-a; // 0..inf
a %= 2*MY_PI; // 0..2PI
static int64_t int_sin(int64_t a)
{
if (a < 0)
a = MY_PI - a; // 0..inf
a %= 2 * MY_PI; // 0..2PI
if(a>=MY_PI*3/2) a -= 2*MY_PI; // -PI/2 .. 3PI/2
if(a>=MY_PI/2 ) a = MY_PI - a; // -PI/2 .. PI/2
if (a >= MY_PI * 3 / 2)
a -= 2 * MY_PI; // -PI / 2 .. 3PI / 2
if (a >= MY_PI /2)
a = MY_PI - a; // -PI / 2 .. PI / 2
return a - int_pow(a, 3)/6 + int_pow(a, 5)/120 - int_pow(a, 7)/5040;
return a - int_pow(a, 3) / 6 + int_pow(a, 5) / 120 - int_pow(a, 7) / 5040;
}
#define SCALEBITS 8
#define ONE_HALF (1 << (SCALEBITS - 1))
#define FIX(x) ((int) ((x) * (1L<<SCALEBITS) + 0.5))
typedef unsigned char UINT8;
#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5))
static void rgb24_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr,
UINT8 *src, int width, int height)
static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb,
unsigned char *cr, unsigned char *src,
int width, int height)
{
int wrap, wrap3, x, y;
int r, g, b, r1, g1, b1;
UINT8 *p;
unsigned char *p;
wrap = width;
wrap3 = width * 3;
p = src;
for(y=0;y<height;y+=2) {
for(x=0;x<width;x+=2) {
for (y = 0; y < height; y += 2) {
for (x = 0; x < width; x += 2) {
r = p[0];
g = p[1];
b = p[2];
......@@ -130,19 +135,19 @@ static void pgmyuv_save(const char *filename, int w, int h,
unsigned char *lum_tab, *cb_tab, *cr_tab;
lum_tab = malloc(w * h);
cb_tab = malloc((w * h) / 4);
cr_tab = malloc((w * h) / 4);
cb_tab = malloc(w * h / 4);
cr_tab = malloc(w * h / 4);
rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
f = fopen(filename,"wb");
fprintf(f, "P5\n%d %d\n%d\n", w, (h * 3) / 2, 255);
f = fopen(filename, "wb");
fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
fwrite(lum_tab, 1, w * h, f);
h2 = h / 2;
w2 = w / 2;
cb = cb_tab;
cr = cr_tab;
for(i=0;i<h2;i++) {
for (i = 0; i < h2; i++) {
fwrite(cb, 1, w2, f);
fwrite(cr, 1, w2, f);
cb += w2;
......@@ -172,26 +177,27 @@ static void put_pixel(int x, int y, int r, int g, int b)
p[2] = b;
}
unsigned char tab_r[256*256];
unsigned char tab_g[256*256];
unsigned char tab_b[256*256];
unsigned char tab_r[256 * 256];
unsigned char tab_g[256 * 256];
unsigned char tab_b[256 * 256];
int h_cos [360];
int h_sin [360];
static int ipol(uint8_t *src, int x, int y){
int int_x= x>>16;
int int_y= y>>16;
int frac_x= x&0xFFFF;
int frac_y= y&0xFFFF;
int s00= src[ ( int_x &255) + 256*( int_y &255) ];
int s01= src[ ((int_x+1)&255) + 256*( int_y &255) ];
int s10= src[ ( int_x &255) + 256*((int_y+1)&255) ];
int s11= src[ ((int_x+1)&255) + 256*((int_y+1)&255) ];
int s0= (((1<<16) - frac_x)*s00 + frac_x*s01)>>8;
int s1= (((1<<16) - frac_x)*s10 + frac_x*s11)>>8;
return (((1<<16) - frac_y)*s0 + frac_y*s1)>>24;
static int ipol(uint8_t *src, int x, int y)
{
int int_x = x >> 16;
int int_y = y >> 16;
int frac_x = x & 0xFFFF;
int frac_y = y & 0xFFFF;
int s00 = src[( int_x & 255) + 256 * ( int_y & 255)];
int s01 = src[((int_x + 1) & 255) + 256 * ( int_y & 255)];
int s10 = src[( int_x & 255) + 256 * ((int_y + 1) & 255)];
int s11 = src[((int_x + 1) & 255) + 256 * ((int_y + 1) & 255)];
int s0 = (((1 << 16) - frac_x) * s00 + frac_x * s01) >> 8;
int s1 = (((1 << 16) - frac_x) * s10 + frac_x * s11) >> 8;
return (((1 << 16) - frac_y) * s0 + frac_y * s1) >> 24;
}
static void gen_image(int num, int w, int h)
......@@ -199,38 +205,28 @@ static void gen_image(int num, int w, int h)
const int c = h_cos [num % 360];
const int s = h_sin [num % 360];
const int xi = -(w/2) * c;
const int yi = (w/2) * s;
const int xi = -(w / 2) * c;
const int yi = (w / 2) * s;
const int xj = -(h/2) * s;
const int yj = -(h/2) * c;
int i,j;
const int xj = -(h / 2) * s;
const int yj = -(h / 2) * c;
int i, j;
int x,y;
int x, y;
int xprime = xj;
int yprime = yj;
for (j=0;j<h;j++) {
x = xprime + xi + FIXP*w/2;
for (j = 0; j < h; j++) {
x = xprime + xi + FIXP * w / 2;
xprime += s;
y = yprime + yi + FIXP*h/2;
y = yprime + yi + FIXP * h / 2;
yprime += c;
for ( i=0 ; i<w ; i++ ) {
for (i = 0; i < w; i++ ) {
x += c;
y -= s;
#if 1
put_pixel(i, j, ipol(tab_r, x, y), ipol(tab_g, x, y), ipol(tab_b, x, y));
#else
{
unsigned dep;
dep = ((x>>16)&255) + (((y>>16)&255)<<8);
put_pixel(i, j, tab_r[dep], tab_g[dep], tab_b[dep]);
}
#endif
}
}
}
......@@ -238,38 +234,43 @@ static void gen_image(int num, int w, int h)
#define W 256
#define H 256
static void init_demo(const char *filename) {
int i,j;
static int init_demo(const char *filename)
{
int i, j;
int h;
int radian;
char line[3 * W];
FILE *fichier;
FILE *input_file;
fichier = fopen(filename,"rb");
if (!fichier) {
input_file = fopen(filename, "rb");
if (!input_file) {
perror(filename);
exit(1);
return 1;
}
fread(line, 1, 15, fichier);
for (i=0;i<H;i++) {
fread(line,1,3*W,fichier);
for (j=0;j<W;j++) {
tab_r[W*i+j] = line[3*j ];
tab_g[W*i+j] = line[3*j + 1];
tab_b[W*i+j] = line[3*j + 2];
if (fread(line, 1, 15, input_file) != 15)
return 1;
for (i = 0; i < H; i++) {
if (fread(line, 1, 3 * W, input_file) != 3 * W)
return 1;
for (j = 0; j < W; j++) {
tab_r[W * i + j] = line[3 * j ];
tab_g[W * i + j] = line[3 * j + 1];
tab_b[W * i + j] = line[3 * j + 2];
}
}
fclose(fichier);
fclose(input_file);
/* tables sin/cos */
for (i=0;i<360;i++) {
radian = 2*i*MY_PI/360;
h = 2*FIXP + int_sin (radian);
h_cos[i] = ( h * int_sin (radian + MY_PI/2) )/2/FIXP;
h_sin[i] = ( h * int_sin (radian ) )/2/FIXP;
for (i = 0; i < 360; i++) {
radian = 2 * i * MY_PI / 360;
h = 2 * FIXP + int_sin (radian);
h_cos[i] = h * int_sin(radian + MY_PI / 2) / 2 / FIXP;
h_sin[i] = h * int_sin(radian) / 2 / FIXP;
}
return 0;
}
int main(int argc, char **argv)
......@@ -280,7 +281,7 @@ int main(int argc, char **argv)
if (argc != 3) {
printf("usage: %s directory/ image.pnm\n"
"generate a test video stream\n", argv[0]);
exit(1);
return 1;
}
w = DEFAULT_WIDTH;
......@@ -291,9 +292,10 @@ int main(int argc, char **argv)
width = w;
height = h;
init_demo(argv[2]);
if (init_demo(argv[2]))
return 1;
for(i=0;i<DEFAULT_NB_PICT;i++) {
for (i = 0; i < DEFAULT_NB_PICT; i++) {
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
gen_image(i, w, h);
pgmyuv_save(buf, w, h, rgb_tab);
......
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