Commit e387c9d5 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (22 commits)
  rv40dsp x86: use only one register, for both increment and loop counter
  rv40dsp: implement prescaled versions for biweight.
  avconv: use default channel layouts when they are unknown
  avconv: parse channel layout string
  nutdec: K&R formatting cosmetics
  vda: Signal 4 byte NAL headers to the decoder regardless of what's in the extradata
  mem: Consistently return NULL for av_malloc(0)
  vf_overlay: implement poll_frame()
  vf_scale: support named constants for sws flags.
  lavc doxy: add all installed headers to doxy groups.
  lavc doxy: add avfft to the main lavc group.
  lavc doxy: add remaining avcodec.h functions to a misc doxygen group.
  lavc doxy: add AVPicture functions to a doxy group.
  lavc doxy: add resampling functions to a doxy group.
  lavc doxy: replace \ with /
  lavc doxy: add encoding functions to a doxy group.
  lavc doxy: add decoding functions to a doxy group.
  lavc doxy: fix formatting of AV_PKT_DATA_{PARAM_CHANGE,H263_MB_INFO}
  lavc doxy: add AVPacket-related stuff to a separate doxy group.
  lavc doxy: add core functions/definitions to a doxy group.
  ...

Conflicts:
	ffmpeg.c
	libavcodec/avcodec.h
	libavcodec/vda.c
	libavcodec/x86/rv40dsp.asm
	libavfilter/vf_scale.c
	libavformat/nutdec.c
	libavutil/mem.c
	tests/ref/acodec/pcm_s24daud
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents b1ef4dc4 2130bd8f
......@@ -1282,7 +1282,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
swr_set_compensation(ost->swr, comp, enc->sample_rate);
}
}
} else
} else if (audio_sync_method == 0)
ost->sync_opts = lrintf(get_sync_ipts(ost, ist->pts) * enc->sample_rate) -
av_fifo_size(ost->fifo) / (enc->channels * osize); // FIXME wrong
......@@ -2328,10 +2328,57 @@ static void print_sdp(OutputFile *output_files, int n)
av_freep(&avc);
}
static void get_default_channel_layouts(OutputStream *ost, InputStream *ist)
{
char layout_name[256];
AVCodecContext *enc = ost->st->codec;
AVCodecContext *dec = ist->st->codec;
if (!dec->channel_layout) {
if (enc->channel_layout && dec->channels == enc->channels) {
dec->channel_layout = enc->channel_layout;
} else {
dec->channel_layout = av_get_default_channel_layout(dec->channels);
if (!dec->channel_layout) {
av_log(NULL, AV_LOG_FATAL, "Unable to find default channel "
"layout for Input Stream #%d.%d\n", ist->file_index,
ist->st->index);
exit_program(1);
}
}
av_get_channel_layout_string(layout_name, sizeof(layout_name),
dec->channels, dec->channel_layout);
av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream "
"#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name);
}
if (!enc->channel_layout) {
if (dec->channels == enc->channels) {
enc->channel_layout = dec->channel_layout;
return;
} else {
enc->channel_layout = av_get_default_channel_layout(enc->channels);
}
if (!enc->channel_layout) {
av_log(NULL, AV_LOG_FATAL, "Unable to find default channel layout "
"for Output Stream #%d.%d\n", ost->file_index,
ost->st->index);
exit_program(1);
}
av_get_channel_layout_string(layout_name, sizeof(layout_name),
enc->channels, enc->channel_layout);
av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Output Stream "
"#%d.%d : %s\n", ost->file_index, ost->st->index, layout_name);
}
}
static int init_input_stream(int ist_index, OutputStream *output_streams, int nb_output_streams,
char *error, int error_len)
{
InputStream *ist = &input_streams[ist_index];
int i;
if (ist->decoding_needed) {
AVCodec *codec = ist->dec;
if (!codec) {
......@@ -2356,6 +2403,17 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
}
assert_codec_experimental(ist->st->codec, 0);
assert_avoptions(ist->opts);
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = &output_streams[i];
if (ost->source_index == ist_index) {
if (!ist->st->codec->channel_layout || !ost->st->codec->channel_layout)
get_default_channel_layouts(ost, ist);
break;
}
}
}
}
ist->dts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
......@@ -4943,6 +5001,41 @@ static void parse_cpuflags(int argc, char **argv, const OptionDef *options)
opt_cpuflags("cpuflags", argv[idx + 1]);
}
static int opt_channel_layout(OptionsContext *o, const char *opt, const char *arg)
{
char layout_str[32];
char *stream_str;
char *ac_str;
int ret, channels, ac_str_size;
uint64_t layout;
layout = av_get_channel_layout(arg);
if (!layout) {
av_log(NULL, AV_LOG_ERROR, "Unknown channel layout: %s\n", arg);
return AVERROR(EINVAL);
}
snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
ret = opt_default(opt, layout_str);
if (ret < 0)
return ret;
/* set 'ac' option based on channel layout */
channels = av_get_channel_layout_nb_channels(layout);
snprintf(layout_str, sizeof(layout_str), "%d", channels);
stream_str = strchr(opt, ':');
ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
ac_str = av_mallocz(ac_str_size);
if (!ac_str)
return AVERROR(ENOMEM);
av_strlcpy(ac_str, "ac", 3);
if (stream_str)
av_strlcat(ac_str, stream_str, ac_str_size);
ret = parse_option(o, ac_str, layout_str, options);
av_free(ac_str);
return ret;
}
#define OFFSET(x) offsetof(OptionsContext, x)
static const OptionDef options[] = {
/* main options */
......@@ -5051,6 +5144,7 @@ static const OptionDef options[] = {
{ "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, //
{ "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO | OPT_SPEC | OPT_STRING, {.off = OFFSET(sample_fmts)}, "set sample format", "format" },
{ "rmvol", HAS_ARG | OPT_AUDIO | OPT_FLOAT | OPT_SPEC, {.off = OFFSET(rematrix_volume)}, "rematrix volume (as factor)", "volume" },
{ "channel_layout", HAS_ARG | OPT_EXPERT | OPT_AUDIO | OPT_FUNC2, {(void*)opt_channel_layout}, "set channel layout", "layout" },
/* subtitle options */
{ "sn", OPT_BOOL | OPT_SUBTITLE | OPT_OFFSET, {.off = OFFSET(subtitle_disable)}, "disable subtitle" },
......
......@@ -128,8 +128,8 @@ void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon;
c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_neon;
c->rv40_weight_pixels_tab[0] = ff_rv40_weight_func_16_neon;
c->rv40_weight_pixels_tab[1] = ff_rv40_weight_func_8_neon;
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_16_neon;
c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_8_neon;
c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon;
c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon;
......
This diff is collapsed.
......@@ -19,6 +19,19 @@
#ifndef AVCODEC_AVFFT_H
#define AVCODEC_AVFFT_H
/**
* @file
* @ingroup lavc_fft
* FFT functions
*/
/**
* @defgroup lavc_fft FFT functions
* @ingroup lavc_misc
*
* @{
*/
typedef float FFTSample;
typedef struct FFTComplex {
......@@ -96,4 +109,8 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
void av_dct_calc(DCTContext *s, FFTSample *data);
void av_dct_end (DCTContext *s);
/**
* @}
*/
#endif /* AVCODEC_AVFFT_H */
......@@ -23,11 +23,24 @@
#ifndef AVCODEC_DXVA_H
#define AVCODEC_DXVA_H
/**
* @file
* @ingroup lavc_codec_hwaccel_dxva2
* Public libavcodec DXVA2 header.
*/
#include <stdint.h>
#include <d3d9.h>
#include <dxva2api.h>
/**
* @defgroup lavc_codec_hwaccel_dxva2 DXVA2
* @ingroup lavc_codec_hwaccel
*
* @{
*/
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
/**
......@@ -68,4 +81,8 @@ struct dxva_context {
unsigned report_id;
};
/**
* @}
*/
#endif /* AVCODEC_DXVA_H */
......@@ -48,7 +48,7 @@ void ff_gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int
unsigned long dst_odd = (unsigned long)dst & 0x0000000F;
unsigned long src_really_odd = (unsigned long)src & 0x0000000F;
tempA = vec_ld(0, (unsigned short*)ABCD);
tempA = vec_ld(0, (const unsigned short*)ABCD);
Av = vec_splat(tempA, 0);
Bv = vec_splat(tempA, 1);
Cv = vec_splat(tempA, 2);
......
......@@ -79,7 +79,8 @@ static int ssd_int8_vs_int16_altivec(const int8_t *pix1, const int16_t *pix2,
return u.score[3];
}
static int32_t scalarproduct_int16_altivec(const int16_t * v1, const int16_t * v2, int order, const int shift)
static int32_t scalarproduct_int16_altivec(int16_t *v1, const int16_t *v2,
int order, const int shift)
{
int i;
LOAD_ZERO;
......
......@@ -521,7 +521,7 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int
*/
static int calc_add_mv(RV34DecContext *r, int dir, int val)
{
int mul = dir ? -r->weight2 : r->weight1;
int mul = dir ? -r->mv_weight2 : r->mv_weight1;
return (val * mul + 0x2000) >> 14;
}
......@@ -776,24 +776,24 @@ static void rv34_mc_1mv(RV34DecContext *r, const int block_type,
static void rv4_weight(RV34DecContext *r)
{
r->rdsp.rv40_weight_pixels_tab[0](r->s.dest[0],
r->tmp_b_block_y[0],
r->tmp_b_block_y[1],
r->weight1,
r->weight2,
r->s.linesize);
r->rdsp.rv40_weight_pixels_tab[1](r->s.dest[1],
r->tmp_b_block_uv[0],
r->tmp_b_block_uv[2],
r->weight1,
r->weight2,
r->s.uvlinesize);
r->rdsp.rv40_weight_pixels_tab[1](r->s.dest[2],
r->tmp_b_block_uv[1],
r->tmp_b_block_uv[3],
r->weight1,
r->weight2,
r->s.uvlinesize);
r->rdsp.rv40_weight_pixels_tab[r->scaled_weight][0](r->s.dest[0],
r->tmp_b_block_y[0],
r->tmp_b_block_y[1],
r->weight1,
r->weight2,
r->s.linesize);
r->rdsp.rv40_weight_pixels_tab[r->scaled_weight][1](r->s.dest[1],
r->tmp_b_block_uv[0],
r->tmp_b_block_uv[2],
r->weight1,
r->weight2,
r->s.uvlinesize);
r->rdsp.rv40_weight_pixels_tab[r->scaled_weight][1](r->s.dest[2],
r->tmp_b_block_uv[1],
r->tmp_b_block_uv[3],
r->weight1,
r->weight2,
r->s.uvlinesize);
}
static void rv34_mc_2mv(RV34DecContext *r, const int block_type)
......@@ -1707,11 +1707,21 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
int dist0 = GET_PTS_DIFF(r->cur_pts, r->last_pts);
int dist1 = GET_PTS_DIFF(r->next_pts, r->cur_pts);
if (!refdist) {
r->weight1 = r->weight2 = 8192;
} else {
r->weight1 = (dist0 << 14) / refdist;
r->weight2 = (dist1 << 14) / refdist;
if(!refdist){
r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192;
r->scaled_weight = 0;
}else{
r->mv_weight1 = (dist0 << 14) / refdist;
r->mv_weight2 = (dist1 << 14) / refdist;
if((r->mv_weight1|r->mv_weight2) & 511){
r->weight1 = r->mv_weight1;
r->weight2 = r->mv_weight2;
r->scaled_weight = 0;
}else{
r->weight1 = r->mv_weight1 >> 9;
r->weight2 = r->mv_weight2 >> 9;
r->scaled_weight = 1;
}
}
}
s->mb_x = s->mb_y = 0;
......
......@@ -106,7 +106,9 @@ typedef struct RV34DecContext{
int rpr; ///< one field size in RV30 slice header
int cur_pts, last_pts, next_pts;
int scaled_weight;
int weight1, weight2; ///< B frame distance fractions (0.14) used in motion compensation
int mv_weight1, mv_weight2;
uint16_t *cbp_luma; ///< CBP values for luma subblocks
uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
......
......@@ -58,7 +58,12 @@ typedef struct RV34DSPContext {
qpel_mc_func avg_pixels_tab[4][16];
h264_chroma_mc_func put_chroma_pixels_tab[3];
h264_chroma_mc_func avg_chroma_pixels_tab[3];
rv40_weight_func rv40_weight_pixels_tab[2];
/**
* Biweight functions, first dimension is transform size (16/8),
* second is whether the weight is prescaled by 1/512 to skip
* the intermediate shifting.
*/
rv40_weight_func rv40_weight_pixels_tab[2][2];
rv34_inv_transform_func rv34_inv_transform;
rv34_inv_transform_func rv34_inv_transform_dc;
rv34_idct_add_func rv34_idct_add;
......
......@@ -278,7 +278,7 @@ RV40_CHROMA_MC(put_, op_put)
RV40_CHROMA_MC(avg_, op_avg)
#define RV40_WEIGHT_FUNC(size) \
static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, ptrdiff_t stride)\
static void rv40_weight_func_rnd_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, ptrdiff_t stride)\
{\
int i, j;\
\
......@@ -289,6 +289,18 @@ static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src
src2 += stride;\
dst += stride;\
}\
}\
static void rv40_weight_func_nornd_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, ptrdiff_t stride)\
{\
int i, j;\
\
for (j = 0; j < size; j++) {\
for (i = 0; i < size; i++)\
dst[i] = (w2 * src1[i] + w1 * src2[i] + 0x10) >> 5;\
src1 += stride;\
src2 += stride;\
dst += stride;\
}\
}
RV40_WEIGHT_FUNC(16)
......@@ -578,8 +590,10 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->avg_chroma_pixels_tab[0] = avg_rv40_chroma_mc8_c;
c->avg_chroma_pixels_tab[1] = avg_rv40_chroma_mc4_c;
c->rv40_weight_pixels_tab[0] = rv40_weight_func_16;
c->rv40_weight_pixels_tab[1] = rv40_weight_func_8;
c->rv40_weight_pixels_tab[0][0] = rv40_weight_func_rnd_16;
c->rv40_weight_pixels_tab[0][1] = rv40_weight_func_rnd_8;
c->rv40_weight_pixels_tab[1][0] = rv40_weight_func_nornd_16;
c->rv40_weight_pixels_tab[1][1] = rv40_weight_func_nornd_8;
c->rv40_weak_loop_filter[0] = rv40_h_weak_loop_filter;
c->rv40_weak_loop_filter[1] = rv40_v_weak_loop_filter;
......
......@@ -24,11 +24,17 @@
#ifndef AVCODEC_VAAPI_H
#define AVCODEC_VAAPI_H
/**
* @file
* @ingroup lavc_codec_hwaccel_vaapi
* Public libavcodec VA API header.
*/
#include <stdint.h>
/**
* @defgroup VAAPI_Decoding VA API Decoding
* @ingroup Decoder
* @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
* @ingroup lavc_codec_hwaccel
* @{
*/
......
......@@ -149,20 +149,55 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
pthread_mutex_init(&vda_ctx->queue_mutex, NULL);
<<<<<<< HEAD
if (extradata[4]==0xFE) {
// convert 3 byte NAL sizes to 4 byte
extradata[4] = 0xFF;
}
||||||| merged common ancestors
=======
/* Each VCL NAL in the bistream sent to the decoder
* is preceeded by a 4 bytes length header.
* Change the avcC atom header if needed, to signal headers of 4 bytes. */
if (extradata_size >= 4 && (extradata[4] & 0x03) != 0x03) {
uint8_t *rw_extradata;
if (!(rw_extradata = av_malloc(extradata_size)))
return AVERROR(ENOMEM);
memcpy(rw_extradata, extradata, extradata_size);
rw_extradata[4] |= 0x03;
avc_data = CFDataCreate(kCFAllocatorDefault, rw_extradata, extradata_size);
av_freep(&rw_extradata);
} else {
avc_data = CFDataCreate(kCFAllocatorDefault, extradata, extradata_size);
}
>>>>>>> qatar/master
config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
4,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
<<<<<<< HEAD
height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->height);
width = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->width);
format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->format);
avc_data = CFDataCreate(kCFAllocatorDefault, extradata, extradata_size);
||||||| merged common ancestors
height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->height);
width = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->width);
format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->format);
avc_data = CFDataCreate(kCFAllocatorDefault, extradata, extradata_size);
=======
height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->height);
width = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->width);
format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->format);
>>>>>>> qatar/master
CFDictionarySetValue(config_info, kVDADecoderConfiguration_Height, height);
CFDictionarySetValue(config_info, kVDADecoderConfiguration_Width, width);
......
......@@ -23,6 +23,12 @@
#ifndef AVCODEC_VDA_H
#define AVCODEC_VDA_H
/**
* @file
* @ingroup lavc_codec_hwaccel_vda
* Public libavcodec VDA header.
*/
#include <pthread.h>
#include <stdint.h>
......@@ -34,6 +40,13 @@
#include <VideoDecodeAcceleration/VDADecoder.h>
#undef Picture
/**
* @defgroup lavc_codec_hwaccel_vda VDA
* @ingroup lavc_codec_hwaccel
*
* @{
*/
/**
* This structure is used to store a decoded frame information and data.
*/
......@@ -165,4 +178,8 @@ vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx);
/** Release the given frame. */
void ff_vda_release_vda_frame(vda_frame *frame);
/**
* @}
*/
#endif /* AVCODEC_VDA_H */
......@@ -25,7 +25,15 @@
#define AVCODEC_VDPAU_H
/**
* @defgroup Decoder VDPAU Decoder and Renderer
* @file
* @ingroup lavc_codec_hwaccel_vdpau
* Public libavcodec VDPAU header.
*/
/**
* @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
* @ingroup lavc_codec_hwaccel
*
* VDPAU hardware acceleration has two modules
* - VDPAU decoding
......@@ -38,8 +46,6 @@
* and rendering (API calls) are done as part of the VDPAU
* presentation (vo_vdpau.c) module.
*
* @defgroup VDPAU_Decoding VDPAU Decoding
* @ingroup Decoder
* @{
*/
......
......@@ -20,6 +20,12 @@
#ifndef AVCODEC_VERSION_H
#define AVCODEC_VERSION_H
/**
* @file
* @ingroup libavc
* Libavcodec version macros.
*/
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 14
#define LIBAVCODEC_VERSION_MICRO 101
......
......@@ -32,13 +32,14 @@ SECTION .text
; %1=5bits weights?, %2=dst %3=src1 %4=src3 %5=stride if sse2
%macro RV40_WCORE 4-5
movh m4, [%3 + 0]
movh m5, [%4 + 0]
movh m4, [%3 + r6 + 0]
movh m5, [%4 + r6 + 0]
%if %0 == 4
%define OFFSET mmsize / 2
%define OFFSET r6 + mmsize / 2
%else
; 8x8 block and sse2, stride was provided
%define OFFSET %5
%define OFFSET r6
add r6, r5
%endif
movh m6, [%3 + OFFSET]
movh m7, [%4 + OFFSET]
......@@ -99,10 +100,12 @@ SECTION .text
packuswb m4, m6
%if %0 == 5
; Only called for 8x8 blocks and sse2
movh [%2 + 0], m4
movhps [%2 + %5], m4
sub r6, r5
movh [%2 + r6], m4
add r6, r5
movhps [%2 + r6], m4
%else
mova [%2], m4
mova [%2 + r6], m4
%endif
%endmacro
......@@ -115,93 +118,79 @@ SECTION .text
%endif
; Prepare for next loop
add r0, r5
add r1, r5
add r2, r5
add r6, r5
%else
%ifidn %1, 8
RV40_WCORE %2, r0, r1, r2, r5
; Prepare 2 next lines
lea r0, [r0 + 2 * r5]
lea r1, [r1 + 2 * r5]
lea r2, [r2 + 2 * r5]
add r6, r5
%else
RV40_WCORE %2, r0, r1, r2
; Prepare single next line
add r0, r5
add r1, r5
add r2, r5
add r6, r5
%endif
%endif
dec r6
%endmacro
; rv40_weight_func_%1(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, int stride)
; %1=size %2=num of xmm regs
%macro RV40_WEIGHT 2
cglobal rv40_weight_func_%1, 6, 7, %2
; The weights are FP0.14 notation of fractions depending on pts.
; For timebases without rounding error (i.e. PAL), the fractions
; can be simplified, and several operations can be avoided.
; Therefore, we check here whether they are multiples of 2^9 for
; those simplifications to occur.
%macro RV40_WEIGHT 3
cglobal rv40_weight_func_%1_%2, 6, 7, 8
%if cpuflag(ssse3)
mova m1, [shift_round]
%else
mova m1, [pw_16]
%endif
pxor m0, m0
mov r6, r3
or r6, r4
; The weights are FP0.14 notation of fractions depending on pts.
; For timebases without rounding error (i.e. PAL), the fractions
; can be simplified, and several operations can be avoided.
; Therefore, we check here whether they are multiples of 2^9 for
; those simplifications to occur.
and r6, 0x1FF
; Set loop counter and increments
%if mmsize == 8
mov r6, %1
%else
mov r6, (%1 * %1) / mmsize
%endif
mov r6, r5
shl r6, %3
add r0, r6
add r1, r6
add r2, r6
neg r6
; Use result of test now
jz .loop_512
movd m2, r3d
movd m3, r4d
%ifidn %1,rnd
%define RND 0
SPLATW m2, m2
SPLATW m3, m3
.loop:
MAIN_LOOP %1, 0
jnz .loop
REP_RET
; Weights are multiple of 512, which allows some shortcuts
.loop_512:
sar r3, 9
sar r4, 9
movd m2, r3d
movd m3, r4d
%else
%define RND 1
%if cpuflag(ssse3)
punpcklbw m3, m2
SPLATW m3, m3
%else
SPLATW m2, m2
SPLATW m3, m3
%endif
.loop2:
MAIN_LOOP %1, 1
jnz .loop2
REP_RET
%endif
SPLATW m3, m3
.loop:
MAIN_LOOP %2, RND
jnz .loop
REP_RET
%endmacro
INIT_MMX mmx
RV40_WEIGHT 8, 0
RV40_WEIGHT 16, 0
RV40_WEIGHT rnd, 8, 3
RV40_WEIGHT rnd, 16, 4
RV40_WEIGHT nornd, 8, 3
RV40_WEIGHT nornd, 16, 4
INIT_XMM sse2
RV40_WEIGHT 8, 8
RV40_WEIGHT 16, 8
RV40_WEIGHT rnd, 8, 3
RV40_WEIGHT rnd, 16, 4
RV40_WEIGHT nornd, 8, 3
RV40_WEIGHT nornd, 16, 4
INIT_XMM ssse3
RV40_WEIGHT 8, 8
RV40_WEIGHT 16, 8
RV40_WEIGHT rnd, 8, 3
RV40_WEIGHT rnd, 16, 4
RV40_WEIGHT nornd, 8, 3
RV40_WEIGHT nornd, 16, 4
......@@ -41,10 +41,14 @@ void ff_avg_rv40_chroma_mc4_3dnow(uint8_t *dst, uint8_t *src,
int stride, int h, int x, int y);
#define DECLARE_WEIGHT(opt) \
void ff_rv40_weight_func_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride); \
void ff_rv40_weight_func_8_##opt (uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride);
void ff_rv40_weight_func_rnd_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride); \
void ff_rv40_weight_func_rnd_8_##opt (uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride); \
void ff_rv40_weight_func_nornd_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride); \
void ff_rv40_weight_func_nornd_8_##opt (uint8_t *dst, uint8_t *src1, uint8_t *src2, \
int w1, int w2, ptrdiff_t stride);
DECLARE_WEIGHT(mmx)
DECLARE_WEIGHT(sse2)
DECLARE_WEIGHT(ssse3)
......@@ -57,8 +61,10 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
if (mm_flags & AV_CPU_FLAG_MMX) {
c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
c->rv40_weight_pixels_tab[0] = ff_rv40_weight_func_16_mmx;
c->rv40_weight_pixels_tab[1] = ff_rv40_weight_func_8_mmx;
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_mmx;
c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_mmx;
c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_mmx;
c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_mmx;
}
if (mm_flags & AV_CPU_FLAG_MMX2) {
c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmx2;
......@@ -68,12 +74,16 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
}
if (mm_flags & AV_CPU_FLAG_SSE2) {
c->rv40_weight_pixels_tab[0] = ff_rv40_weight_func_16_sse2;
c->rv40_weight_pixels_tab[1] = ff_rv40_weight_func_8_sse2;
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_sse2;
c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_sse2;
c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_sse2;
c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_sse2;
}
if (mm_flags & AV_CPU_FLAG_SSSE3) {
c->rv40_weight_pixels_tab[0] = ff_rv40_weight_func_16_ssse3;
c->rv40_weight_pixels_tab[1] = ff_rv40_weight_func_8_ssse3;
c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_ssse3;
c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_ssse3;
c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_ssse3;
c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_ssse3;
}
#endif
}
......@@ -21,10 +21,23 @@
#ifndef AVCODEC_XVMC_H
#define AVCODEC_XVMC_H
/**
* @file
* @ingroup lavc_codec_hwaccel_xvmc
* Public libavcodec XvMC header.
*/
#include <X11/extensions/XvMC.h>
#include "avcodec.h"
/**
* @defgroup lavc_codec_hwaccel_xvmc XvMC
* @ingroup lavc_codec_hwaccel
*
* @{
*/
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
......@@ -148,4 +161,8 @@ struct xvmc_pix_fmt {
int next_free_data_block_num;
};
/**
* @}
*/
#endif /* AVCODEC_XVMC_H */
......@@ -510,6 +510,18 @@ static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) {
static void null_end_frame(AVFilterLink *inlink) { }
static int poll_frame(AVFilterLink *link)
{
AVFilterContext *s = link->src;
OverlayContext *over = s->priv;
int ret = avfilter_poll_frame(s->inputs[OVERLAY]);
if (ret == AVERROR_EOF)
ret = !!over->overpicref;
return ret && avfilter_poll_frame(s->inputs[MAIN]);
}
AVFilter avfilter_vf_overlay = {
.name = "overlay",
.description = NULL_IF_CONFIG_SMALL("Overlay a video source on top of the input."),
......@@ -541,6 +553,7 @@ AVFilter avfilter_vf_overlay = {
{ .name = NULL}},
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_output, },
.config_props = config_output,
.poll_frame = poll_frame },
{ .name = NULL}},
};
......@@ -27,6 +27,7 @@
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
......@@ -92,7 +93,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (args) {
sscanf(args, "%255[^:]:%255[^:]", scale->w_expr, scale->h_expr);
p = strstr(args,"flags=");
if (p) scale->flags = strtoul(p+6, NULL, 0);
if (p) {
const AVClass *class = sws_get_class();
const AVOption *o = av_opt_find(&class, "sws_flags", NULL, 0,
AV_OPT_SEARCH_FAKE_OBJ);
int ret = av_opt_eval_flags(&class, o, p + 6, &scale->flags);
if (ret < 0)
return ret;
}
if(strstr(args,"interl=1")){
scale->interlaced=1;
}else if(strstr(args,"interl=-1"))
......
This diff is collapsed.
46f44f86a18984a832206ab9e29a79f2 *./tests/data/acodec/pcm_f32le.wav
653d82a64b7bd96ac193e105e9f92d4c *./tests/data/acodec/pcm_f32le.wav
2116880 ./tests/data/acodec/pcm_f32le.wav
64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f32le.acodec.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
ba17c6d1a270e1333e981f239bf7eb45 *./tests/data/acodec/pcm_f64le.wav
48b4cd378f47a50dc902aa03cc8280ed *./tests/data/acodec/pcm_f64le.wav
4233680 ./tests/data/acodec/pcm_f64le.wav
64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f64le.acodec.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
1b75d5198ae789ab3c48f7024e08f4a9 *./tests/data/acodec/pcm_s24daud.302
10368730 ./tests/data/acodec/pcm_s24daud.302
4708f86529c594e29404603c64bb208c *./tests/data/pcm_s24daud.acodec.out.wav
70ec0ba6bc151ddc7509c09804d95d3b *./tests/data/pcm_s24daud.acodec.out.wav
stddev: 8967.92 PSNR: 17.28 MAXDIFF:42548 bytes: 6911796/ 1058400
a85380fb79b0d4fff38e24ac1e34bb94 *./tests/data/acodec/pcm_s24le.wav
18ea73985dbdf59e23f5aba66145e6fe *./tests/data/acodec/pcm_s24le.wav
1587668 ./tests/data/acodec/pcm_s24le.wav
64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s24le.acodec.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
da6ed80f4f40f0082577dea80827e014 *./tests/data/acodec/pcm_s32le.wav
8d8849fa5c5d91b9cb74f5c74e937faf *./tests/data/acodec/pcm_s32le.wav
2116868 ./tests/data/acodec/pcm_s32le.wav
64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s32le.acodec.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
df9ebf2812784a653d3337cf12c0c687 *./tests/data/lavf/lavf.caf
90180 ./tests/data/lavf/lavf.caf
71e1abdfc59613fe05fca2939f02e02d *./tests/data/lavf/lavf.caf
90204 ./tests/data/lavf/lavf.caf
./tests/data/lavf/lavf.caf CRC=0xf1ae5536
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