Commit 5dc6bd86 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  APIchanges: fill in missing hashes and dates.
  Add an APIChanges entry and bump minor versions for recent changes.
  ffmpeg: print the low bitrate warning after the codec is openend.
  doxygen: Move function documentation into the macro generating the function.
  doxygen: Make sure parameter names match between .c and .h files.
  h264: move fill_decode_neighbors()/fill_decode_caches() to h264_mvpred.h
  H.264: Add more x86 assembly for 10-bit H.264 predict functions
  lavf: fix invalid reads in avformat_find_stream_info()
  cmdutils: replace opt_default with opt_default2() and remove set_context_opts
  ffmpeg: use new avcodec_open2 and avformat_find_stream_info API.
  ffplay: use new avcodec_open2 and avformat_find_stream_info API.
  cmdutils: store all codec options in one dict instead of video/audio/sub
  ffmpeg: check experimental flag after codec is opened.
  ffmpeg: do not set GLOBAL_HEADER flag in the options context

Conflicts:
	cmdutils.c
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/version.h
	libavformat/version.h
	libswscale/swscale_unscaled.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1885824b 6cb11979
......@@ -1382,7 +1382,8 @@ PREDEFINED = "__attribute__(x)=" \
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
EXPAND_AS_DEFINED = declare_idct
EXPAND_AS_DEFINED = declare_idct \
READ_PAR_DATA \
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
......
......@@ -49,13 +49,10 @@
#include <sys/resource.h>
#endif
const char **opt_names;
const char **opt_values;
static int opt_name_count;
AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
AVFormatContext *avformat_opts;
struct SwsContext *sws_opts;
AVDictionary *format_opts, *video_opts, *audio_opts, *sub_opts;
AVDictionary *format_opts, *codec_opts;
static const int this_year = 2011;
......@@ -81,17 +78,8 @@ void uninit_opts(void)
sws_freeContext(sws_opts);
sws_opts = NULL;
#endif
for (i = 0; i < opt_name_count; i++) {
av_freep(&opt_names[i]);
av_freep(&opt_values[i]);
}
av_freep(&opt_names);
av_freep(&opt_values);
opt_name_count = 0;
av_dict_free(&format_opts);
av_dict_free(&video_opts);
av_dict_free(&audio_opts);
av_dict_free(&sub_opts);
av_dict_free(&codec_opts);
}
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
......@@ -297,20 +285,14 @@ unknown_opt:
}
#define FLAGS (o->type == FF_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
#define SET_PREFIXED_OPTS(ch, flag, output) \
if (opt[0] == ch && avcodec_opts[0] && (o = av_opt_find(avcodec_opts[0], opt+1, NULL, flag, 0)))\
av_dict_set(&output, opt+1, arg, FLAGS);
static int opt_default2(const char *opt, const char *arg)
int opt_default(const char *opt, const char *arg)
{
const AVOption *o;
if ((o = av_opt_find(avcodec_opts[0], opt, NULL, 0, AV_OPT_SEARCH_CHILDREN))) {
if (o->flags & AV_OPT_FLAG_VIDEO_PARAM)
av_dict_set(&video_opts, opt, arg, FLAGS);
if (o->flags & AV_OPT_FLAG_AUDIO_PARAM)
av_dict_set(&audio_opts, opt, arg, FLAGS);
if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM)
av_dict_set(&sub_opts, opt, arg, FLAGS);
} else if ((o = av_opt_find(avformat_opts, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN)))
if ((o = av_opt_find(avcodec_opts[0], opt, NULL, 0, AV_OPT_SEARCH_CHILDREN)) ||
((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
(o = av_opt_find(avcodec_opts[0], opt+1, NULL, 0, 0))))
av_dict_set(&codec_opts, opt, arg, FLAGS);
else if ((o = av_opt_find(avformat_opts, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN)))
av_dict_set(&format_opts, opt, arg, FLAGS);
else if ((o = av_opt_find(sws_opts, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN))) {
// XXX we only support sws_flags, not arbitrary sws options
......@@ -321,18 +303,13 @@ static int opt_default2(const char *opt, const char *arg)
}
}
if (!o) {
SET_PREFIXED_OPTS('v', AV_OPT_FLAG_VIDEO_PARAM, video_opts)
SET_PREFIXED_OPTS('a', AV_OPT_FLAG_AUDIO_PARAM, audio_opts)
SET_PREFIXED_OPTS('s', AV_OPT_FLAG_SUBTITLE_PARAM, sub_opts)
}
if (o)
return 0;
fprintf(stderr, "Unrecognized option '%s'\n", opt);
return AVERROR_OPTION_NOT_FOUND;
}
#if 0
<<<<<<< HEAD
int opt_default(const char *opt, const char *arg){
int type;
int ret= 0;
......@@ -408,6 +385,70 @@ int opt_default(const char *opt, const char *arg){
return 0;
}
||||||| merged common ancestors
int opt_default(const char *opt, const char *arg){
int type;
int ret= 0;
const AVOption *o= NULL;
int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0};
for(type=0; *avcodec_opts && type<AVMEDIA_TYPE_NB && ret>= 0; type++){
const AVOption *o2 = av_opt_find(avcodec_opts[0], opt, NULL, opt_types[type], 0);
if(o2)
ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o);
}
if(!o && avformat_opts)
ret = av_set_string3(avformat_opts, opt, arg, 1, &o);
if(!o && sws_opts)
ret = av_set_string3(sws_opts, opt, arg, 1, &o);
if(!o){
if (opt[0] == 'a' && avcodec_opts[AVMEDIA_TYPE_AUDIO])
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o);
else if(opt[0] == 'v' && avcodec_opts[AVMEDIA_TYPE_VIDEO])
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o);
else if(opt[0] == 's' && avcodec_opts[AVMEDIA_TYPE_SUBTITLE])
ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o);
}
if (o && ret < 0) {
fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt);
exit(1);
}
if (!o) {
AVCodec *p = NULL;
AVOutputFormat *oformat = NULL;
while ((p=av_codec_next(p))){
const AVClass *c = p->priv_class;
if(c && av_opt_find(&c, opt, NULL, 0, 0))
break;
}
if (!p) {
while ((oformat = av_oformat_next(oformat))) {
const AVClass *c = oformat->priv_class;
if (c && av_opt_find(&c, opt, NULL, 0, 0))
break;
}
}
}
if ((ret = opt_default2(opt, arg)) < 0)
return ret;
// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL));
//FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this
opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1));
opt_values[opt_name_count]= o ? NULL : av_strdup(arg);
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
opt_names[opt_name_count++]= o ? o->name : av_strdup(opt);
if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug))
av_log_set_level(AV_LOG_DEBUG);
return 0;
}
=======
>>>>>>> qatar/master
#endif
int opt_loglevel(const char *opt, const char *arg)
{
const struct { const char *name; int level; } log_levels[] = {
......@@ -456,59 +497,6 @@ int opt_timelimit(const char *opt, const char *arg)
return 0;
}
static void *alloc_priv_context(int size, const AVClass *class)
{
void *p = av_mallocz(size);
if (p) {
*(const AVClass **)p = class;
av_opt_set_defaults(p);
}
return p;
}
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
{
int i;
void *priv_ctx=NULL;
if(!strcmp("AVCodecContext", (*(AVClass**)ctx)->class_name)){
AVCodecContext *avctx= ctx;
if(codec && codec->priv_class){
if(!avctx->priv_data && codec->priv_data_size)
avctx->priv_data= alloc_priv_context(codec->priv_data_size, codec->priv_class);
priv_ctx= avctx->priv_data;
}
} else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) {
AVFormatContext *avctx = ctx;
if (avctx->oformat && avctx->oformat->priv_class) {
priv_ctx = avctx->priv_data;
} else if (avctx->iformat && avctx->iformat->priv_class) {
priv_ctx = avctx->priv_data;
}
}
for(i=0; i<opt_name_count; i++){
char buf[256];
const AVOption *opt;
const char *str;
if (priv_ctx) {
if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) {
if (av_set_string3(priv_ctx, opt_names[i], opt_values[i], 1, NULL) < 0) {
fprintf(stderr, "Invalid value '%s' for option '%s'\n",
opt_values[i], opt_names[i]);
exit(1);
}
} else
goto global;
} else {
global:
str = av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf));
/* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */
if (str && ((opt->flags & flags) == flags))
av_set_string3(ctx, opt_names[i], str, 1, NULL);
}
}
}
void print_error(const char *filename, int err)
{
char errbuf[128];
......@@ -934,3 +922,48 @@ FILE *get_preset_file(char *filename, size_t filename_size,
return f;
}
AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, int encoder)
{
AVDictionary *ret = NULL;
AVDictionaryEntry *t = NULL;
AVCodec *codec = encoder ? avcodec_find_encoder(codec_id) : avcodec_find_decoder(codec_id);
int flags = encoder ? AV_OPT_FLAG_ENCODING_PARAM : AV_OPT_FLAG_DECODING_PARAM;
char prefix = 0;
if (!codec)
return NULL;
switch (codec->type) {
case AVMEDIA_TYPE_VIDEO: prefix = 'v'; flags |= AV_OPT_FLAG_VIDEO_PARAM; break;
case AVMEDIA_TYPE_AUDIO: prefix = 'a'; flags |= AV_OPT_FLAG_AUDIO_PARAM; break;
case AVMEDIA_TYPE_SUBTITLE: prefix = 's'; flags |= AV_OPT_FLAG_SUBTITLE_PARAM; break;
}
while (t = av_dict_get(opts, "", t, AV_DICT_IGNORE_SUFFIX)) {
if (av_opt_find(avcodec_opts[0], t->key, NULL, flags, 0) ||
(codec && codec->priv_class && av_opt_find(&codec->priv_class, t->key, NULL, flags, 0)))
av_dict_set(&ret, t->key, t->value, 0);
else if (t->key[0] == prefix && av_opt_find(avcodec_opts[0], t->key+1, NULL, flags, 0))
av_dict_set(&ret, t->key+1, t->value, 0);
}
return ret;
}
AVDictionary **setup_find_stream_info_opts(AVFormatContext *s)
{
int i;
AVDictionary **opts;
if (!s->nb_streams)
return NULL;
opts = av_mallocz(s->nb_streams * sizeof(*opts));
if (!opts) {
av_log(NULL, AV_LOG_ERROR, "Could not alloc memory for stream options.\n");
return NULL;
}
for (i = 0; i < s->nb_streams; i++)
opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id, 0);
return opts;
}
......@@ -43,11 +43,10 @@ extern const char program_name[];
*/
extern const int program_birth_year;
extern const char **opt_names;
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts;
extern struct SwsContext *sws_opts;
extern AVDictionary *format_opts, *video_opts, *audio_opts, *sub_opts;
extern AVDictionary *format_opts, *codec_opts;
/**
* Initialize the cmdutils option system, in particular
......@@ -153,7 +152,15 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
void parse_options(int argc, char **argv, const OptionDef *options,
int (* parse_arg_function)(const char *opt, const char *arg));
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
/**
* Filter out options for given codec.
*/
AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id, int encoder);
/*
* Setup AVCodecContext options for avformat_find_stream_info.
*/
AVDictionary **setup_find_stream_info_opts(AVFormatContext *s);
/**
* Print an error message to stderr, indicating filename and a human
......
......@@ -13,6 +13,12 @@ libavutil: 2011-04-18
API changes, most recent first:
2011-07-10 - a67c061 - lavf 53.3.0
Add avformat_find_stream_info(), deprecate av_find_stream_info().
2011-07-10 - 0b950fe - lavc 53.6.0
Add avcodec_open2(), deprecate avcodec_open().
2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h
Add function av_get_output_timestamp().
......@@ -49,20 +55,20 @@ API changes, most recent first:
2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
Change avfilter_graph_parse() signature.
2011-06-xx - xxxxxxx - lavu 51.8.0 - attributes.h
2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h
Add av_printf_format().
2011-06-xx - xxxxxxx - lavf 53.2.0 - avformat.h
2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h
Add avformat_open_input and avformat_write_header().
Deprecate av_open_input_stream, av_open_input_file,
AVFormatParameters and av_write_header.
2011-06-xx - xxxxxxx - lavu 51.7.0 - opt.h
2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h
Add av_opt_set_dict() and av_opt_find().
Deprecate av_find_opt().
Add AV_DICT_APPEND flag.
2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h
Add av_opt_flag_is_set().
2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
......
......@@ -159,8 +159,6 @@ Set the ISO 639 language code (3 letters) of the current subtitle stream.
@section Video Options
@table @option
@item -b @var{bitrate}
Set the video bitrate in bit/s (default = 200 kb/s).
@item -vframes @var{number}
Set the number of video frames to record.
@item -r @var{fps}
......@@ -560,8 +558,6 @@ Set the audio sampling frequency. For output streams it is set by
default to the frequency of the corresponding input stream. For input
streams this option only makes sense for audio grabbing devices and raw
demuxers and is mapped to the corresponding demuxer options.
@item -ab @var{bitrate}
Set the audio bitrate in bit/s (default = 64k).
@item -aq @var{q}
Set the audio quality (codec-specific, VBR).
@item -ac @var{channels}
......
This diff is collapsed.
......@@ -2111,11 +2111,15 @@ static int stream_component_open(VideoState *is, int stream_index)
AVCodecContext *avctx;
AVCodec *codec;
SDL_AudioSpec wanted_spec, spec;
AVDictionary *opts;
AVDictionaryEntry *t = NULL;
if (stream_index < 0 || stream_index >= ic->nb_streams)
return -1;
avctx = ic->streams[stream_index]->codec;
opts = filter_codec_opts(codec_opts, avctx->codec_id, 0);
/* prepare audio output */
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
if (avctx->channels > 0) {
......@@ -2141,13 +2145,16 @@ static int stream_component_open(VideoState *is, int stream_index)
avctx->error_concealment= error_concealment;
avctx->thread_count= thread_count;
set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec);
if(codec->capabilities & CODEC_CAP_DR1)
avctx->flags |= CODEC_FLAG_EMU_EDGE;
if (avcodec_open(avctx, codec) < 0)
if (!codec ||
avcodec_open2(avctx, codec, &opts) < 0)
return -1;
if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
return AVERROR_OPTION_NOT_FOUND;
}
/* prepare audio output */
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
......@@ -2301,6 +2308,8 @@ static int read_thread(void *arg)
int eof=0;
int pkt_in_play_range = 0;
AVDictionaryEntry *t;
AVDictionary **opts;
int orig_nb_streams;
memset(st_index, -1, sizeof(st_index));
is->video_stream = -1;
......@@ -2326,12 +2335,19 @@ static int read_thread(void *arg)
if(genpts)
ic->flags |= AVFMT_FLAG_GENPTS;
err = av_find_stream_info(ic);
opts = setup_find_stream_info_opts(ic);
orig_nb_streams = ic->nb_streams;
err = avformat_find_stream_info(ic, opts);
if (err < 0) {
fprintf(stderr, "%s: could not find codec parameters\n", is->filename);
ret = -1;
goto fail;
}
for (i = 0; i < orig_nb_streams; i++)
av_dict_free(&opts[i]);
av_freep(&opts);
if(ic->pb)
ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
......
......@@ -69,19 +69,19 @@ static const int huff_iid[] = {
static VLC vlc_ps[10];
/**
* Read Inter-channel Intensity Difference/Inter-Channel Coherence/
* Inter-channel Phase Difference/Overall Phase Difference parameters from the
* bitstream.
*
* @param avctx contains the current codec context
* @param gb pointer to the input bitstream
* @param ps pointer to the Parametric Stereo context
* @param PAR pointer to the parameter to be read
* @param e envelope to decode
* @param dt 1: time delta-coded, 0: frequency delta-coded
*/
#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION) \
/** \
* Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \
* Inter-channel Phase Difference/Overall Phase Difference parameters from the \
* bitstream. \
* \
* @param avctx contains the current codec context \
* @param gb pointer to the input bitstream \
* @param ps pointer to the Parametric Stereo context \
* @param PAR pointer to the parameter to be read \
* @param e envelope to decode \
* @param dt 1: time delta-coded, 0: frequency delta-coded \
*/ \
static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, \
int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
{ \
......
This diff is collapsed.
This diff is collapsed.
......@@ -149,10 +149,8 @@ static int estimate_best_order(double *ref, int min_order, int max_order)
/**
* Calculate LPC coefficients for multiple orders
*
* @param lpc_type LPC method for determining coefficients
* 0 = LPC with fixed pre-defined coeffs
* 1 = LPC with coeffs determined by Levinson-Durbin recursion
* 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes.
* @param lpc_type LPC method for determining coefficients,
* see #FFLPCType for details
*/
int ff_lpc_calc_coefs(LPCContext *s,
const int32_t *samples, int blocksize, int min_order,
......
......@@ -1892,7 +1892,7 @@ AVCodec ff_msmpeg4v1_decoder = {
NULL,
ff_h263_decode_end,
ff_h263_decode_frame,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_EXPERIMENTAL,
CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
.max_lowres= 3,
.long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
.pix_fmts= ff_pixfmt_list_420,
......
......@@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 7
#define LIBAVCODEC_VERSION_MINOR 8
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -29,11 +29,19 @@ SECTION_RODATA
SECTION .text
cextern pw_16
cextern pw_8
cextern pw_4
cextern pw_2
cextern pw_1
pw_m32101234: dw -3, -2, -1, 0, 1, 2, 3, 4
pw_m3: times 8 dw -3
pw_pixel_max: times 8 dw ((1 << 10)-1)
pw_512: times 8 dw 512
pd_17: times 4 dd 17
pd_16: times 4 dd 16
; dest, left, right, src
; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
%macro PRED4x4_LOWPASS 4
......@@ -464,7 +472,92 @@ PRED8x8_TOP_DC mmxext, pshufw
INIT_XMM
PRED8x8_TOP_DC sse2 , pshuflw
;-----------------------------------------------------------------------------
; void pred8x8_plane(pixel *src, int stride)
;-----------------------------------------------------------------------------
INIT_XMM
cglobal pred8x8_plane_10_sse2, 2,7,7
sub r0, r1
lea r2, [r1+r1*2]
lea r3, [r0+r1*4]
mova m2, [r0]
pmaddwd m2, [pw_m32101234]
HADDD m2, m1
movd m0, [r0-4]
psrld m0, 14
psubw m2, m0 ; H
movd m0, [r3+r1*4-4]
movd m1, [r0+12]
paddw m0, m1
psllw m0, 4 ; 16*(src[7*stride-1] + src[-stride+7])
movzx r4d, word [r3+r1*1-2] ; src[4*stride-1]
movzx r5d, word [r0+r2*1-2] ; src[2*stride-1]
sub r4d, r5d
movzx r6d, word [r3+r1*2-2] ; src[5*stride-1]
movzx r5d, word [r0+r1*2-2] ; src[1*stride-1]
sub r6d, r5d
lea r4d, [r4+r6*2]
movzx r5d, word [r3+r2*1-2] ; src[6*stride-1]
movzx r6d, word [r0+r1*1-2] ; src[0*stride-1]
sub r5d, r6d
lea r5d, [r5+r5*2]
add r4d, r5d
movzx r6d, word [r3+r1*4-2] ; src[7*stride-1]
movzx r5d, word [r0+r1*0-2] ; src[ -stride-1]
sub r6d, r5d
lea r4d, [r4+r6*4]
movd m3, r4d ; V
punpckldq m2, m3
pmaddwd m2, [pd_17]
paddd m2, [pd_16]
psrad m2, 5 ; b, c
mova m3, [pw_pixel_max]
pxor m1, m1
SPLATW m0, m0, 1
SPLATW m4, m2, 2
SPLATW m2, m2, 0
pmullw m2, [pw_m32101234] ; b
pmullw m5, m4, [pw_m3] ; c
paddw m5, [pw_16]
mov r2d, 8
add r0, r1
.loop:
paddsw m6, m2, m5
paddsw m6, m0
psraw m6, 5
CLIPW m6, m1, m3
mova [r0], m6
paddw m5, m4
add r0, r1
dec r2d
jg .loop
REP_RET
;-----------------------------------------------------------------------------
; void pred8x8l_128_dc(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_128_DC 1
cglobal pred8x8l_128_dc_10_%1, 4,4
mova m0, [pw_512]
lea r1, [r3+r3*2]
lea r2, [r0+r3*4]
MOV8 r0+r3*0, m0, m0
MOV8 r0+r3*1, m0, m0
MOV8 r0+r3*2, m0, m0
MOV8 r0+r1*1, m0, m0
MOV8 r2+r3*0, m0, m0
MOV8 r2+r3*1, m0, m0
MOV8 r2+r3*2, m0, m0
MOV8 r2+r1*1, m0, m0
RET
%endmacro
INIT_MMX
PRED8x8L_128_DC mmxext
INIT_XMM
PRED8x8L_128_DC sse2
;-----------------------------------------------------------------------------
; void pred8x8l_top_dc(pixel *src, int has_topleft, int has_topright, int stride)
......@@ -1258,7 +1351,7 @@ cglobal pred16x16_horizontal_10_%1, 2,3
MOV16 r0+r1*1, m1, m1, m1, m1
lea r0, [r0+r1*2]
dec r2
jge .vloop
jg .vloop
REP_RET
%endmacro
......@@ -1266,3 +1359,139 @@ INIT_MMX
PRED16x16_HORIZONTAL mmxext
INIT_XMM
PRED16x16_HORIZONTAL sse2
;-----------------------------------------------------------------------------
; void pred16x16_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_DC 1
cglobal pred16x16_dc_10_%1, 2,7
mov r4, r0
sub r0, r1
mova m0, [r0+0]
paddw m0, [r0+mmsize]
%if mmsize==8
paddw m0, [r0+16]
paddw m0, [r0+24]
%endif
HADDW m0, m2
sub r0, 2
movzx r3d, word [r0+r1*1]
movzx r5d, word [r0+r1*2]
%rep 7
lea r0, [r0+r1*2]
movzx r2d, word [r0+r1*1]
add r3d, r2d
movzx r2d, word [r0+r1*2]
add r5d, r2d
%endrep
lea r3d, [r3+r5+16]
movd m1, r3d
paddw m0, m1
psrlw m0, 5
SPLATW m0, m0
mov r3d, 8
.loop:
MOV16 r4+r1*0, m0, m0, m0, m0
MOV16 r4+r1*1, m0, m0, m0, m0
lea r4, [r4+r1*2]
dec r3d
jg .loop
REP_RET
%endmacro
INIT_MMX
PRED16x16_DC mmxext
INIT_XMM
PRED16x16_DC sse2
;-----------------------------------------------------------------------------
; void pred16x16_top_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_TOP_DC 1
cglobal pred16x16_top_dc_10_%1, 2,3
sub r0, r1
mova m0, [r0+0]
paddw m0, [r0+mmsize]
%if mmsize==8
paddw m0, [r0+16]
paddw m0, [r0+24]
%endif
HADDW m0, m2
SPLATW m0, m0
paddw m0, [pw_8]
psrlw m0, 4
mov r2d, 8
.loop:
MOV16 r0+r1*1, m0, m0, m0, m0
MOV16 r0+r1*2, m0, m0, m0, m0
lea r0, [r0+r1*2]
dec r2d
jg .loop
REP_RET
%endmacro
INIT_MMX
PRED16x16_TOP_DC mmxext
INIT_XMM
PRED16x16_TOP_DC sse2
;-----------------------------------------------------------------------------
; void pred16x16_left_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_LEFT_DC 1
cglobal pred16x16_left_dc_10_%1, 2,7
mov r4, r0
sub r0, 2
movzx r5d, word [r0+r1*0]
movzx r6d, word [r0+r1*1]
%rep 7
lea r0, [r0+r1*2]
movzx r2d, word [r0+r1*0]
movzx r3d, word [r0+r1*1]
add r5d, r2d
add r6d, r3d
%endrep
lea r2d, [r5+r6+8]
shr r2d, 4
movd m0, r2d
SPLATW m0, m0
mov r3d, 8
.loop:
MOV16 r4+r1*0, m0, m0, m0, m0
MOV16 r4+r1*1, m0, m0, m0, m0
lea r4, [r4+r1*2]
dec r3d
jg .loop
REP_RET
%endmacro
INIT_MMX
PRED16x16_LEFT_DC mmxext
INIT_XMM
PRED16x16_LEFT_DC sse2
;-----------------------------------------------------------------------------
; void pred16x16_128_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_128_DC 1
cglobal pred16x16_128_dc_10_%1, 2,3
mova m0, [pw_512]
mov r2d, 8
.loop:
MOV16 r0+r1*0, m0, m0, m0, m0
MOV16 r0+r1*1, m0, m0, m0, m0
lea r0, [r0+r1*2]
dec r2d
jg .loop
REP_RET
%endmacro
INIT_MMX
PRED16x16_128_DC mmxext
INIT_XMM
PRED16x16_128_DC sse2
......@@ -47,6 +47,7 @@ PRED8x8(dc, 10, mmxext)
PRED8x8(dc, 10, sse2)
PRED8x8(top_dc, 10, mmxext)
PRED8x8(top_dc, 10, sse2)
PRED8x8(plane, 10, sse2)
PRED8x8(vertical, 10, sse2)
PRED8x8(horizontal, 10, sse2)
......@@ -55,6 +56,8 @@ void ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int has_tople
PRED8x8L(dc, 10, sse2)
PRED8x8L(dc, 10, ssse3)
PRED8x8L(128_dc, 10, mmxext)
PRED8x8L(128_dc, 10, sse2)
PRED8x8L(top_dc, 10, sse2)
PRED8x8L(top_dc, 10, ssse3)
PRED8x8L(vertical, 10, sse2)
......@@ -73,6 +76,14 @@ PRED8x8L(horizontal_up, 10, ssse3)
#define PRED16x16(TYPE, DEPTH, OPT)\
void ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride);
PRED16x16(dc, 10, mmxext)
PRED16x16(dc, 10, sse2)
PRED16x16(top_dc, 10, mmxext)
PRED16x16(top_dc, 10, sse2)
PRED16x16(128_dc, 10, mmxext)
PRED16x16(128_dc, 10, sse2)
PRED16x16(left_dc, 10, mmxext)
PRED16x16(left_dc, 10, sse2)
PRED16x16(vertical, 10, mmxext)
PRED16x16(vertical, 10, sse2)
PRED16x16(horizontal, 10, mmxext)
......@@ -289,6 +300,12 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_mmxext;
h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_mmxext;
h->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_mmxext;
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_mmxext;
h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_mmxext;
h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_mmxext;
h->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_mmxext;
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext;
}
......@@ -301,18 +318,24 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_sse2;
h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_sse2;
h->pred8x8[PLANE_PRED8x8 ] = ff_pred8x8_plane_10_sse2;
h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2;
h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2;
h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_sse2;
h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_sse2;
h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_sse2;
h->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_sse2;
h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_sse2;
h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2;
h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2;
h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_sse2;
h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_sse2;
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_sse2;
h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_sse2;
h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_sse2;
h->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_sse2;
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2;
}
......
......@@ -141,6 +141,8 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind
* corresponding filter instance which is added to graph with
* create_filter().
*
* @param filt_ctx Pointer that is set to the created and configured filter
* context on success, set to NULL on failure.
* @param filt_ctx put here a pointer to the created filter context on
* success, NULL otherwise
* @param buf pointer to the buffer to parse, *buf will be updated to
......
......@@ -80,16 +80,16 @@ void ff_rdt_subscribe_rule(char *cmd, int size,
*
* @param buf input buffer
* @param len length of input buffer
* @param set_id will be set to the set ID this packet belongs to
* @param seq_no will be set to the sequence number of the packet
* @param stream_id will be set to the stream ID this packet belongs to
* @param is_keyframe will be whether this packet belongs to a keyframe
* @param timestamp will be set to the timestamp of the packet
* @param pset_id will be set to the set ID this packet belongs to
* @param pseq_no will be set to the sequence number of the packet
* @param pstream_id will be set to the stream ID this packet belongs to
* @param pis_keyframe will be whether this packet belongs to a keyframe
* @param ptimestamp will be set to the timestamp of the packet
* @return the amount of bytes consumed, or negative on error
*/
int ff_rdt_parse_header(const uint8_t *buf, int len,
int *set_id, int *seq_no, int *stream_id,
int *is_keyframe, uint32_t *timestamp);
int *pset_id, int *pseq_no, int *pstream_id,
int *pis_keyframe, uint32_t *ptimestamp);
/**
* Parse RDT-style packet data (header + media data).
......
......@@ -488,9 +488,9 @@ void ff_rtsp_close_streams(AVFormatContext *s);
/**
* Close all connection handles within the RTSP (de)muxer
*
* @param rt RTSP (de)muxer context
* @param s RTSP (de)muxer context
*/
void ff_rtsp_close_connections(AVFormatContext *rt);
void ff_rtsp_close_connections(AVFormatContext *s);
/**
* Get the description of the stream and set up the RTSPStream child
......
......@@ -74,12 +74,12 @@ typedef struct URLProtocol {
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int ffurl_alloc(URLContext **h, const char *url, int flags);
int ffurl_alloc(URLContext **puc, const char *filename, int flags);
/**
* Connect an URLContext that has been allocated by ffurl_alloc
*/
int ffurl_connect(URLContext *h);
int ffurl_connect(URLContext *uc);
/**
* Create an URLContext for accessing to the resource indicated by
......@@ -92,7 +92,7 @@ int ffurl_connect(URLContext *h);
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int ffurl_open(URLContext **h, const char *url, int flags);
int ffurl_open(URLContext **puc, const char *filename, int flags);
/**
* Read up to size bytes from the resource accessed by h, and store
......
......@@ -2438,7 +2438,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
least one frame of codec data, this makes sure the codec initializes
the channel configuration and does not only trust the values from the container.
*/
try_decode_frame(st, pkt, (options && i <= orig_nb_streams )? &options[i] : NULL);
try_decode_frame(st, pkt, (options && i < orig_nb_streams )? &options[i] : NULL);
st->codec_info_nb_frames++;
count++;
......
......@@ -24,7 +24,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 53
#define LIBAVFORMAT_VERSION_MINOR 5
#define LIBAVFORMAT_VERSION_MINOR 6
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
......
......@@ -484,7 +484,7 @@ static time_t mktimegm(struct tm *tm)
return t;
}
int av_parse_time(int64_t *timeval, const char *datestr, int duration)
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
{
const char *p;
int64_t t;
......@@ -506,19 +506,19 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration)
#undef time
time_t now = time(0);
len = strlen(datestr);
len = strlen(timestr);
if (len > 0)
lastch = datestr[len - 1];
lastch = timestr[len - 1];
else
lastch = '\0';
is_utc = (lastch == 'z' || lastch == 'Z');
memset(&dt, 0, sizeof(dt));
p = datestr;
p = timestr;
q = NULL;
if (!duration) {
if (!strncasecmp(datestr, "now", len)) {
if (!strncasecmp(timestr, "now", len)) {
*timeval = (int64_t) now * 1000000;
return 0;
}
......@@ -555,15 +555,15 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration)
}
}
} else {
/* parse datestr as a duration */
/* parse timestr as a duration */
if (p[0] == '-') {
negative = 1;
++p;
}
/* parse datestr as HH:MM:SS */
/* parse timestr as HH:MM:SS */
q = small_strptime(p, time_fmt[0], &dt);
if (!q) {
/* parse datestr as S+ */
/* parse timestr as S+ */
dt.tm_sec = strtol(p, (char **)&q, 10);
if (q == p) {
/* the parsing didn't succeed */
......
......@@ -83,7 +83,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
* January, 1970 up to the time of the parsed date. If timestr cannot
* be successfully parsed, set *time to INT64_MIN.
* @param datestr a string representing a date or a duration.
* @param timestr a string representing a date or a duration.
* - If a date the syntax is:
* @code
* [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z]
......
......@@ -218,7 +218,7 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat
* top-bottom or bottom-top order. If slices are provided in
* non-sequential order the behavior of the function is undefined.
*
* @param context the scaling context previously created with
* @param c the scaling context previously created with
* sws_getContext()
* @param srcSlice the array containing the pointers to the planes of
* the source slice
......@@ -235,8 +235,9 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat
* the destination image
* @return the height of the output slice
*/
int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], const int srcStride[],
int srcSliceY, int srcSliceH, uint8_t* const dst[], const int dstStride[]);
int sws_scale(struct SwsContext *c, const uint8_t* const srcSlice[],
const int srcStride[], int srcSliceY, int srcSliceH,
uint8_t* const dst[], const int dstStride[]);
#if LIBSWSCALE_VERSION_MAJOR < 1
/**
......
......@@ -686,18 +686,19 @@ static int check_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt,
* swscale wrapper, so we don't need to export the SwsContext.
* Assumes planar YUV to be in YUV order instead of YVU.
*/
int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* const dst[], const int dstStride[])
int sws_scale(struct SwsContext *c, const uint8_t* const srcSlice[],
const int srcStride[], int srcSliceY, int srcSliceH,
uint8_t* const dst[], const int dstStride[])
{
int i;
const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
const uint8_t* src2[4]= {srcSlice[0], srcSlice[1], srcSlice[2], srcSlice[3]};
uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
// do not mess up sliceDir if we have a "trailing" 0-size slice
if (srcSliceH == 0)
return 0;
if (!check_image_pointers(src, c->srcFormat, srcStride)) {
if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
return 0;
}
......@@ -718,7 +719,7 @@ int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[],
for (i=0; i<256; i++) {
int p, r, g, b, y, u, v, a = 0xff;
if(c->srcFormat == PIX_FMT_PAL8) {
p=((const uint32_t*)(src[1]))[i];
p=((const uint32_t*)(srcSlice[1]))[i];
a= (p>>24)&0xFF;
r= (p>>16)&0xFF;
g= (p>> 8)&0xFF;
......
......@@ -717,7 +717,9 @@ static void getSubSampleFactors(int *h, int *v, enum PixelFormat format)
*v = av_pix_fmt_descriptors[format].log2_chroma_h;
}
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation)
{
memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4);
memcpy(c->dstColorspaceTable, table, sizeof(int)*4);
......@@ -740,7 +742,9 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange
return 0;
}
int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
int *srcRange, int **table, int *dstRange,
int *brightness, int *contrast, int *saturation)
{
if (!c || isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
......
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