diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-13 06:55:40 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-13 08:00:03 +0400 |
commit | f884ef00de362a5460a9c58318d009bcae440cc8 (patch) | |
tree | 955b7a1dc3f2bf89fb9332d0e732aac9e52b0e29 | |
parent | c1847c932b1576e8224c38e112a5fd29fa8a6098 (diff) | |
parent | 47a1d794dba02239f9eeb37e9dfd4dfdb634c3b7 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
tiffenc: initialize forgotten avctx.
avplay: free the active audio packet at exit.
avplay: free rdft data used for spectrogram analysis.
log.h: make AVClass a named struct
fix ac3 encoder documentation
vc1: more prettyprinting cosmetics
vc1: prettyprint some tables
vc1: K&R formatting cosmetics
AVOptions: bump minor and add APIchanges entry.
cmdutils/avtools: simplify show_help() by using av_opt_child_class_next()
AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_*
Remove all uses of deprecated AVOptions API.
AVOptions: add av_opt_next, deprecate av_next_option.
AVOptions: add functions for evaluating option strings.
AVOptions: split get_number().
AVOptions: add av_opt_get*, deprecate av_get*.
AVOptions: add av_opt_set*().
AVOptions: add new API for enumerating children.
rv34: move inverse transform functions to DSP context
flvenc: Write the right metadata entry count
...
Conflicts:
avconv.c
cmdutils.c
doc/APIchanges
ffplay.c
ffprobe.c
libavcodec/ac3dec.c
libavcodec/h264.c
libavcodec/libvpxenc.c
libavcodec/libx264.c
libavcodec/mpeg12enc.c
libavcodec/options.c
libavdevice/libdc1394.c
libavdevice/v4l2.c
libavfilter/vf_drawtext.c
libavformat/flvdec.c
libavformat/mpegtsenc.c
libavformat/options.c
libavutil/avutil.h
libavutil/opt.c
libswscale/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
88 files changed, 3709 insertions, 3039 deletions
@@ -240,7 +240,7 @@ typedef struct OutputStream { AVFilterGraph *graph; #endif - int sws_flags; + int64_t sws_flags; AVDictionary *opts; int is_past_recording_time; } OutputStream; @@ -450,7 +450,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost) snprintf(args, 255, "%d:%d:flags=0x%X", codec->width, codec->height, - ost->sws_flags); + (unsigned)ost->sws_flags); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, ost->graph)) < 0) return ret; @@ -459,7 +459,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost) last_filter = filter; } - snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags); + snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags); ost->graph->scale_sws_opts = av_strdup(args); if (ost->avfilter) { @@ -3154,7 +3154,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; - ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL); + av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; } @@ -3781,11 +3781,7 @@ static void show_usage(void) static int opt_help(const char *opt, const char *arg) { - AVCodec *c; - AVOutputFormat *oformat = NULL; - AVInputFormat *iformat = NULL; - const AVClass *class; - + int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM; av_log_set_callback(log_callback_help); show_usage(); show_help_options(options, "Main options:\n", @@ -3812,41 +3808,10 @@ static int opt_help(const char *opt, const char *arg) OPT_GRAB, OPT_GRAB); printf("\n"); - class = avcodec_get_class(); - av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - - /* individual codec options */ - c = NULL; - while ((c = av_codec_next(c))) { - if (c->priv_class) { - av_opt_show2(&c->priv_class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - } - } - - class = avformat_get_class(); - av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - - /* individual muxer options */ - while ((oformat = av_oformat_next(oformat))) { - if (oformat->priv_class) { - av_opt_show2(&oformat->priv_class, NULL, AV_OPT_FLAG_ENCODING_PARAM, 0); - printf("\n"); - } - } - - /* individual demuxer options */ - while ((iformat = av_iformat_next(iformat))) { - if (iformat->priv_class) { - av_opt_show2(&iformat->priv_class, NULL, AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - } - } + show_help_children(avcodec_get_class(), flags); + show_help_children(avformat_get_class(), flags); + show_help_children(sws_get_class(), flags); - class = sws_get_class(); - av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); return 0; } diff --git a/cmdutils.c b/cmdutils.c index c3fd8b87a3..d27759ea93 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -130,6 +130,16 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int } } +void show_help_children(const AVClass *class, int flags) +{ + const AVClass *child = NULL; + av_opt_show2(&class, NULL, flags, 0); + printf("\n"); + + while (child = av_opt_child_class_next(class, child)) + show_help_children(child, flags); +} + static const OptionDef* find_option(const OptionDef *po, const char *name){ const char *p = strchr(name, ':'); int len = p ? p - name : strlen(name); @@ -342,7 +352,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) opt_loglevel("loglevel", argv[idx + 1]); } -#define FLAGS(o) ((o)->type == FF_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 +#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 int opt_default(const char *opt, const char *arg) { const AVOption *oc, *of, *os; @@ -364,7 +374,7 @@ int opt_default(const char *opt, const char *arg) sc = sws_get_class(); if ((os = av_opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { // XXX we only support sws_flags, not arbitrary sws options - int ret = av_set_string3(sws_opts, opt, arg, 1, NULL); + int ret = av_opt_set(sws_opts, opt, arg, 0); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); return ret; diff --git a/cmdutils.h b/cmdutils.h index 85b6c55835..d1e84e0d90 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -159,6 +159,12 @@ typedef struct { void show_help_options(const OptionDef *options, const char *msg, int mask, int value); /** + * Show help for all options with given flags in class and all its + * children. + */ +void show_help_children(const AVClass *class, int flags); + +/** * Parse the command line arguments. * * @param optctx an opaque options context @@ -3044,8 +3044,8 @@ enabled libvpx && { enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || die "ERROR: libvpx encoder version must be >=0.9.6"; } } enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && - { check_cpp_condition x264.h "X264_BUILD >= 115" || - die "ERROR: libx264 version must be >= 0.115."; } + { check_cpp_condition x264.h "X264_BUILD >= 118" || + die "ERROR: libx264 version must be >= 0.118."; } enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do diff --git a/doc/APIchanges b/doc/APIchanges index ea0e7666c0..c8a58428ff 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,25 @@ libavutil: 2011-04-18 API changes, most recent first: +2011-10-12 - lavu 51.12.0 + AVOptions API rewrite. + + - 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* + - new setting/getting functions with slightly different semantics: + dac66da av_set_string3 -> av_opt_set + av_set_double -> av_opt_set_double + av_set_q -> av_opt_set_q + av_set_int -> av_opt_set_int + + 41d9d51 av_get_string -> av_opt_get + av_get_double -> av_opt_get_double + av_get_q -> av_opt_get_q + av_get_int -> av_opt_get_int + + - 8c5dcaa trivial rename av_next_option -> av_opt_next + - 641c7af new functions - av_opt_child_next, av_opt_child_class_next + and av_opt_find2() + 2011-09-22 - xxxxxxx - lavu 51.17.0 Add av_x_if_null(). diff --git a/doc/encoders.texi b/doc/encoders.texi index f50ee10d11..3607bb1d1b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -320,10 +320,10 @@ apply Dolby Surround EX processing. Not Indicated (default) @item 1 @itemx on -Dolby Surround EX On +Dolby Surround EX Off @item 2 @itemx off -Dolby Surround EX Off +Dolby Surround EX On @end table @item -dheadphone_mode @var{mode} @@ -337,10 +337,10 @@ processing. Not Indicated (default) @item 1 @itemx on -Dolby Headphone On +Dolby Headphone Off @item 2 @itemx off -Dolby Headphone Off +Dolby Headphone On @end table @item -ad_conv_type @var{type} @@ -247,7 +247,7 @@ typedef struct OutputStream { AVFilterGraph *graph; #endif - int sws_flags; + int64_t sws_flags; AVDictionary *opts; int is_past_recording_time; } OutputStream; @@ -460,7 +460,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost) snprintf(args, 255, "%d:%d:flags=0x%X", codec->width, codec->height, - ost->sws_flags); + (unsigned)ost->sws_flags); if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), NULL, args, NULL, ost->graph)) < 0) return ret; @@ -469,7 +469,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost) last_filter = filter; } - snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags); + snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags); ost->graph->scale_sws_opts = av_strdup(args); if (ost->avfilter) { @@ -3260,7 +3260,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; - ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL); + av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; } @@ -3907,11 +3907,7 @@ static void show_usage(void) static int opt_help(const char *opt, const char *arg) { - AVCodec *c; - AVOutputFormat *oformat = NULL; - AVInputFormat *iformat = NULL; - const AVClass *class; - + int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM; av_log_set_callback(log_callback_help); show_usage(); show_help_options(options, "Main options:\n", @@ -3938,41 +3934,10 @@ static int opt_help(const char *opt, const char *arg) OPT_GRAB, OPT_GRAB); printf("\n"); - class = avcodec_get_class(); - av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - - /* individual codec options */ - c = NULL; - while ((c = av_codec_next(c))) { - if (c->priv_class) { - av_opt_show2(&c->priv_class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - } - } - - class = avformat_get_class(); - av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - - /* individual muxer options */ - while ((oformat = av_oformat_next(oformat))) { - if (oformat->priv_class) { - av_opt_show2(&oformat->priv_class, NULL, AV_OPT_FLAG_ENCODING_PARAM, 0); - printf("\n"); - } - } - - /* individual demuxer options */ - while ((iformat = av_iformat_next(iformat))) { - if (iformat->priv_class) { - av_opt_show2(&iformat->priv_class, NULL, AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - } - } + show_help_children(avcodec_get_class(), flags); + show_help_children(avformat_get_class(), flags); + show_help_children(sws_get_class(), flags); - class = sws_get_class(); - av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); return 0; } @@ -2307,6 +2307,12 @@ static void stream_component_close(VideoState *is, int stream_index) packet_queue_end(&is->audioq); if (is->swr_ctx) swr_free(&is->swr_ctx); + av_free_packet(&is->audio_pkt); + + if (is->rdft) { + av_rdft_end(is->rdft); + av_freep(&is->rdft_data); + } break; case AVMEDIA_TYPE_VIDEO: packet_queue_abort(&is->videoq); @@ -3029,7 +3035,6 @@ static void show_usage(void) static int opt_help(const char *opt, const char *arg) { - const AVClass *class; av_log_set_callback(log_callback_help); show_usage(); show_help_options(options, "Main options:\n", @@ -3037,18 +3042,10 @@ static int opt_help(const char *opt, const char *arg) show_help_options(options, "\nAdvanced options:\n", OPT_EXPERT, OPT_EXPERT); printf("\n"); - class = avcodec_get_class(); - av_opt_show2(&class, NULL, - AV_OPT_FLAG_DECODING_PARAM, 0); - printf("\n"); - class = avformat_get_class(); - av_opt_show2(&class, NULL, - AV_OPT_FLAG_DECODING_PARAM, 0); + show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM); + show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); #if !CONFIG_AVFILTER - printf("\n"); - class = sws_get_class(); - av_opt_show2(&class, NULL, - AV_OPT_FLAG_ENCODING_PARAM, 0); + show_help_children(sws_get_class(), AV_OPT_FLAG_ENCODING_PARAM); #endif printf("\nWhile playing:\n" "q, ESC quit\n" @@ -830,13 +830,13 @@ static void opt_input_file(void *optctx, const char *arg) static int opt_help(const char *opt, const char *arg) { - const AVClass *class = avformat_get_class(); av_log_set_callback(log_callback_help); show_usage(); show_help_options(options, "Main options:\n", 0, 0); printf("\n"); - av_opt_show2(&class, NULL, - AV_OPT_FLAG_DECODING_PARAM, 0); + + show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); + return 0; } diff --git a/ffserver.c b/ffserver.c index 000350cbf3..6823ceb81c 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3169,8 +3169,8 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, switch(rtp_c->rtp_protocol) { case RTSP_LOWER_TRANSPORT_UDP: - rtp_port = rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]); - rtcp_port = rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]); + rtp_port = ff_rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]); + rtcp_port = ff_rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]); avio_printf(c->pb, "Transport: RTP/AVP/UDP;unicast;" "client_port=%d-%d;server_port=%d-%d", th->client_port_min, th->client_port_max, @@ -3938,7 +3938,7 @@ static int ffserver_opt_default(const char *opt, const char *arg, int ret = 0; const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0); if(o) - ret = av_set_string3(avctx, opt, arg, 1, NULL); + ret = av_opt_set(avctx, opt, arg, 0); return ret; } diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 8a1774a758..c0397a8c71 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -343,9 +343,9 @@ OBJS-$(CONFIG_RV10_DECODER) += rv10.o OBJS-$(CONFIG_RV10_ENCODER) += rv10enc.o OBJS-$(CONFIG_RV20_DECODER) += rv10.o OBJS-$(CONFIG_RV20_ENCODER) += rv20enc.o -OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o \ +OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o rv34dsp.o \ mpegvideo.o error_resilience.o -OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv40dsp.o \ +OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv34dsp.o rv40dsp.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_SGI_DECODER) += sgidec.o diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index e60a778c6d..95523ca366 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -686,10 +686,10 @@ static av_cold int aac_encode_end(AVCodecContext *avctx) #define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM static const AVOption aacenc_options[] = { - {"stereo_mode", "Stereo coding method", offsetof(AACEncContext, options.stereo_mode), FF_OPT_TYPE_INT, {.dbl = 0}, -1, 1, AACENC_FLAGS, "stereo_mode"}, - {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"}, - {"ms_off", "Disable Mid/Side coding", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"}, - {"ms_force", "Force Mid/Side for the whole frame if possible", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"}, + {"stereo_mode", "Stereo coding method", offsetof(AACEncContext, options.stereo_mode), AV_OPT_TYPE_INT, {.dbl = 0}, -1, 1, AACENC_FLAGS, "stereo_mode"}, + {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"}, + {"ms_off", "Disable Mid/Side coding", 0, AV_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"}, + {"ms_force", "Force Mid/Side for the whole frame if possible", 0, AV_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"}, {NULL} }; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 4b277296d1..120041f2d0 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1451,13 +1451,13 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx) #define OFFSET(x) offsetof(AC3DecodeContext, x) #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) static const AVOption options[] = { - { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {1.0}, 0.0, 1.0, PAR }, + { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {1.0}, 0.0, 1.0, PAR }, -{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, 0, "dmix_mode"}, -{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, -{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, -{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, -{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, 0, "dmix_mode"}, +{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, +{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, { NULL}, }; diff --git a/libavcodec/ac3enc_opts_template.c b/libavcodec/ac3enc_opts_template.c index a8bbedbf9e..acb4ab477a 100644 --- a/libavcodec/ac3enc_opts_template.c +++ b/libavcodec/ac3enc_opts_template.c @@ -30,51 +30,51 @@ static const AVOption ac3_options[] = { static const AVOption eac3_options[] = { #endif /* Metadata Options */ -{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM}, +{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM}, #if AC3ENC_TYPE != AC3ENC_TYPE_EAC3 /* AC-3 downmix levels */ -{"center_mixlev", "Center Mix Level", OFFSET(center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_4POINT5DB }, 0.0, 1.0, AC3ENC_PARAM}, -{"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_6DB }, 0.0, 1.0, AC3ENC_PARAM}, +{"center_mixlev", "Center Mix Level", OFFSET(center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_4POINT5DB }, 0.0, 1.0, AC3ENC_PARAM}, +{"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_6DB }, 0.0, 1.0, AC3ENC_PARAM}, #endif /* audio production information */ -{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 111, AC3ENC_PARAM}, -{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_SMALL_ROOM, AC3ENC_PARAM, "room_type"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, - {"large", "Large Room", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_LARGE_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, - {"small", "Small Room", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_SMALL_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, +{"mixing_level", "Mixing Level", OFFSET(mixing_level), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 111, AC3ENC_PARAM}, +{"room_type", "Room Type", OFFSET(room_type), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_SMALL_ROOM, AC3ENC_PARAM, "room_type"}, + {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, + {"large", "Large Room", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_LARGE_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, + {"small", "Small Room", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_SMALL_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"}, /* other metadata options */ -{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM}, -{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), FF_OPT_TYPE_INT, {.dbl = -31 }, -31, -1, AC3ENC_PARAM}, -{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dsur_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, - {"on", "Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, - {"off", "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, -{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM}, +{"copyright", "Copyright Bit", OFFSET(copyright), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM}, +{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), AV_OPT_TYPE_INT, {.dbl = -31 }, -31, -1, AC3ENC_PARAM}, +{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dsur_mode"}, + {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, + {"on", "Dolby Surround Encoded", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, + {"off", "Not Dolby Surround Encoded", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"}, +{"original", "Original Bit Stream", OFFSET(original), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM}, /* extended bitstream information */ -{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_DOWNMIX_LORO, AC3ENC_PARAM, "dmix_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, - {"ltrt", "Lt/Rt Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_DOWNMIX_LTRT }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, - {"loro", "Lo/Ro Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_DOWNMIX_LORO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, -{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, -{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, -{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, -{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, -{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dsurex_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, - {"on", "Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, - {"off", "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, -{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dheadphone_mode"}, - {"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, - {"on", "Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, - {"off", "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, -{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_ADCONV_HDCD, AC3ENC_PARAM, "ad_conv_type"}, - {"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_ADCONV_STANDARD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, - {"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_ADCONV_HDCD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, +{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_DOWNMIX_LORO, AC3ENC_PARAM, "dmix_mode"}, + {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, + {"ltrt", "Lt/Rt Downmix Preferred", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_DOWNMIX_LTRT }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, + {"loro", "Lo/Ro Downmix Preferred", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_DOWNMIX_LORO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"}, +{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, +{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, +{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, +{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM}, +{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dsurex_mode"}, + {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, + {"on", "Dolby Surround EX Encoded", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, + {"off", "Not Dolby Surround EX Encoded", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"}, +{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_OFF, AC3ENC_PARAM, "dheadphone_mode"}, + {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, + {"on", "Dolby Headphone Encoded", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, + {"off", "Not Dolby Headphone Encoded", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"}, +{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_ADCONV_HDCD, AC3ENC_PARAM, "ad_conv_type"}, + {"standard", "Standard (default)", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_ADCONV_STANDARD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, + {"hdcd", "HDCD", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_ADCONV_HDCD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, /* Other Encoding Options */ -{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_ON }, AC3ENC_OPT_OFF, AC3ENC_OPT_ON, AC3ENC_PARAM}, -{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, AC3ENC_OPT_ON, AC3ENC_PARAM, "channel_coupling"}, - {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"}, -{"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), FF_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, 15, AC3ENC_PARAM, "cpl_start_band"}, - {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"}, +{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_ON }, AC3ENC_OPT_OFF, AC3ENC_OPT_ON, AC3ENC_PARAM}, +{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, AC3ENC_OPT_ON, AC3ENC_PARAM, "channel_coupling"}, + {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"}, +{"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), AV_OPT_TYPE_INT, {.dbl = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, 15, AC3ENC_PARAM, "cpl_start_band"}, + {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"}, {NULL} }; diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 698237e59e..d5c1d6ccab 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -37,7 +37,7 @@ #define DNX10BIT_QMAT_SHIFT 18 // The largest value that will not lead to overflow for 10bit samples. static const AVOption options[]={ - {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, VE}, + {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, VE}, {NULL} }; static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 4df3a1b11b..7345a7eef0 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -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, {.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" }, +{ "lpc_coeff_precision", "LPC coefficient precision", offsetof(FlacEncodeContext, options.lpc_coeff_precision), AV_OPT_TYPE_INT, {.dbl = 15 }, 0, MAX_LPC_PRECISION, FLAGS }, +{ "lpc_type", "LPC algorithm", offsetof(FlacEncodeContext, options.lpc_type), AV_OPT_TYPE_INT, {.dbl = FF_LPC_TYPE_DEFAULT }, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_NB-1, FLAGS, "lpc_type" }, +{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_NONE }, INT_MIN, INT_MAX, FLAGS, "lpc_type" }, +{ "fixed", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, FLAGS, "lpc_type" }, +{ "levinson", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, FLAGS, "lpc_type" }, +{ "cholesky", NULL, 0, AV_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), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, FLAGS }, +{ "min_partition_order", NULL, offsetof(FlacEncodeContext, options.min_partition_order), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, MAX_PARTITION_ORDER, FLAGS }, +{ "max_partition_order", NULL, offsetof(FlacEncodeContext, options.max_partition_order), AV_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), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, ORDER_METHOD_LOG, FLAGS, "predm" }, +{ "estimation", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_EST }, INT_MIN, INT_MAX, FLAGS, "predm" }, +{ "2level", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_2LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" }, +{ "4level", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_4LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" }, +{ "8level", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_8LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" }, +{ "search", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_SEARCH }, INT_MIN, INT_MAX, FLAGS, "predm" }, +{ "log", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = ORDER_METHOD_LOG }, INT_MIN, INT_MAX, FLAGS, "predm" }, { NULL }, }; diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index ec2155009b..fcefa2915e 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -277,7 +277,7 @@ static av_cold int MP3lame_encode_close(AVCodecContext *avctx) #define OFFSET(x) offsetof(Mp3AudioContext, x) #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "reservoir", "Use bit reservoir.", OFFSET(reservoir), FF_OPT_TYPE_INT, { 1 }, 0, 1, AE }, + { "reservoir", "Use bit reservoir.", OFFSET(reservoir), AV_OPT_TYPE_INT, { 1 }, 0, 1, AE }, { NULL }, }; diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index bef60799f1..7af773f581 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -88,7 +88,7 @@ typedef struct AMRContext { } AMRContext; static const AVOption options[] = { - { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), FF_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), AV_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { NULL } }; diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index c7f827fc19..b32fe4e1df 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -34,7 +34,7 @@ typedef struct AMRWBContext { } AMRWBContext; static const AVOption options[] = { - { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), FF_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), AV_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { NULL } }; diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index daa6ac9b7f..53993e3719 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -56,7 +56,7 @@ typedef struct OggVorbisContext { } OggVorbisContext ; static const AVOption options[]={ -{"iblock", "Sets the impulse block bias", offsetof(OggVorbisContext, iblock), FF_OPT_TYPE_DOUBLE, {.dbl = 0}, -15, 0, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM}, +{"iblock", "Sets the impulse block bias", offsetof(OggVorbisContext, iblock), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, -15, 0, AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_ENCODING_PARAM}, {NULL} }; static const AVClass class = { "libvorbis", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index a29e6f551d..97e5345f24 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -547,30 +547,29 @@ static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size, #define OFFSET(x) offsetof(VP8Context, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM - -static const AVOption options[]={ - { "cpu-used", "Quality/Speed ratio modifier", OFFSET(cpu_used), FF_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE}, +static const AVOption options[] = { + { "cpu-used", "Quality/Speed ratio modifier", OFFSET(cpu_used), AV_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE}, { "auto-alt-ref", "Enable use of alternate reference " - "frames (2-pass only)", OFFSET(auto_alt_ref), FF_OPT_TYPE_INT, {-1}, -1, 1, VE}, + "frames (2-pass only)", OFFSET(auto_alt_ref), AV_OPT_TYPE_INT, {-1}, -1, 1, VE}, { "lag-in-frames", "Number of frames to look ahead for " - "alternate reference frame selection", OFFSET(lag_in_frames), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE}, - { "arnr-maxframes", "altref noise reduction max frame count", OFFSET(arnr_max_frames), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE}, - { "arnr-strength", "altref noise reduction filter strength", OFFSET(arnr_strength), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE}, - { "arnr-type", "altref noise reduction filter type", OFFSET(arnr_type), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE, "arnr_type"}, - { "backward", NULL, 0, FF_OPT_TYPE_CONST, {1}, 0, 0, VE, "arnr_type" }, - { "forward", NULL, 0, FF_OPT_TYPE_CONST, {2}, 0, 0, VE, "arnr_type" }, - { "centered", NULL, 0, FF_OPT_TYPE_CONST, {3}, 0, 0, VE, "arnr_type" }, - { "deadline", "Time to spend encoding, in microseconds.", OFFSET(deadline), FF_OPT_TYPE_INT, {VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, - { "best", NULL, 0, FF_OPT_TYPE_CONST, {VPX_DL_BEST_QUALITY}, 0, 0, VE, "quality"}, - { "good", NULL, 0, FF_OPT_TYPE_CONST, {VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"}, - { "realtime", NULL, 0, FF_OPT_TYPE_CONST, {VPX_DL_REALTIME}, 0, 0, VE, "quality"}, - { "error-resilient", "Error resilience configuration", OFFSET(error_resilient), FF_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, VE, "er"}, + "alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE}, + { "arnr-maxframes", "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE}, + { "arnr-strength", "altref noise reduction filter strength", OFFSET(arnr_strength), AV_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE}, + { "arnr-type", "altref noise reduction filter type", OFFSET(arnr_type), AV_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE, "arnr_type"}, + { "backward", NULL, 0, AV_OPT_TYPE_CONST, {1}, 0, 0, VE, "arnr_type" }, + { "forward", NULL, 0, AV_OPT_TYPE_CONST, {2}, 0, 0, VE, "arnr_type" }, + { "centered", NULL, 0, AV_OPT_TYPE_CONST, {3}, 0, 0, VE, "arnr_type" }, + { "deadline", "Time to spend encoding, in microseconds.", OFFSET(deadline), AV_OPT_TYPE_INT, {VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, + { "best", NULL, 0, AV_OPT_TYPE_CONST, {VPX_DL_BEST_QUALITY}, 0, 0, VE, "quality"}, + { "good", NULL, 0, AV_OPT_TYPE_CONST, {VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"}, + { "realtime", NULL, 0, AV_OPT_TYPE_CONST, {VPX_DL_REALTIME}, 0, 0, VE, "quality"}, + { "error-resilient", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, VE, "er"}, #ifdef VPX_ERROR_RESILIENT_DEFAULT - { "default", "Improve resiliency against losses of whole frames", 0, FF_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"}, + { "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"}, { "partitions", "The frame partitions are independently decodable " "by the bool decoder, meaning that partitions can be decoded even " "though earlier partitions have been lost. Note that intra predicition" - " is still done over the partition boundary.", 0, FF_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"}, + " is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"}, #endif {"speed", "", offsetof(VP8Context, cpu_used), FF_OPT_TYPE_INT, {.dbl = 3}, -16, 16, VE}, {"quality", "", offsetof(VP8Context, deadline), FF_OPT_TYPE_INT, {.dbl = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 894a63eadb..7410112172 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -127,30 +127,6 @@ static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size, return p - buf; } -static int avfmt2_csp(int avfmt) -{ - switch (avfmt) { - case PIX_FMT_YUV420P: - case PIX_FMT_YUVJ420P: - case PIX_FMT_YUV420P9: - case PIX_FMT_YUV420P10: - return X264_CSP_I420; -#ifdef X264_CSP_I444 - case PIX_FMT_YUV444P: - return X264_CSP_I444; -#endif -#ifdef X264_CSP_BGR - case PIX_FMT_BGR24: - return X264_CSP_BGR; - - case PIX_FMT_RGB24: - return X264_CSP_RGB; -#endif - default: - return X264_CSP_NONE; - } -} - static int avfmt2_num_planes(int avfmt) { switch (avfmt) { @@ -181,7 +157,7 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf, int bufsize; x264_picture_init( &x4->pic ); - x4->pic.img.i_csp = avfmt2_csp(ctx->pix_fmt); + x4->pic.img.i_csp = x4->params.i_csp; if (x264_bit_depth > 8) x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt); @@ -271,6 +247,29 @@ static av_cold int X264_close(AVCodecContext *avctx) } \ } while (0); +static int convert_pix_fmt(enum PixelFormat pix_fmt) +{ + switch (pix_fmt) { + case PIX_FMT_YUV420P: + case PIX_FMT_YUVJ420P: + case PIX_FMT_YUV420P9: + case PIX_FMT_YUV420P10: return X264_CSP_I420; + case PIX_FMT_YUV422P: + case PIX_FMT_YUV422P10: return X264_CSP_I422; + case PIX_FMT_YUV444P: + case PIX_FMT_YUV444P9: + case PIX_FMT_YUV444P10: return X264_CSP_I444; +#ifdef X264_CSP_BGR + case PIX_FMT_BGR24: + return X264_CSP_BGR; + + case PIX_FMT_RGB24: + return X264_CSP_RGB; +#endif + }; + return 0; +} + #define PARSE_X264_OPT(name, var)\ if (x4->var && x264_param_parse(&x4->params, name, x4->var) < 0) {\ av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\ @@ -300,6 +299,7 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.pf_log = X264_log; x4->params.p_log_private = avctx; x4->params.i_log_level = X264_LOG_DEBUG; + x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); OPT_STR("weightp", x4->wpredp); @@ -533,8 +533,6 @@ static av_cold int X264_init(AVCodecContext *avctx) avctx->crf = x4->params.rc.f_rf_constant; #endif - x4->params.i_csp = avfmt2_csp(avctx->pix_fmt); - x4->enc = x264_encoder_open(&x4->params); if (!x4->enc) return -1; @@ -561,9 +559,8 @@ static av_cold int X264_init(AVCodecContext *avctx) static const enum PixelFormat pix_fmts_8bit[] = { PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, -#ifdef X264_CSP_I444 + PIX_FMT_YUV422P, PIX_FMT_YUV444P, -#endif #ifdef X264_CSP_BGR PIX_FMT_BGR24, PIX_FMT_RGB24, @@ -572,10 +569,13 @@ static const enum PixelFormat pix_fmts_8bit[] = { }; static const enum PixelFormat pix_fmts_9bit[] = { PIX_FMT_YUV420P9, + PIX_FMT_YUV444P9, PIX_FMT_NONE }; static const enum PixelFormat pix_fmts_10bit[] = { PIX_FMT_YUV420P10, + PIX_FMT_YUV422P10, + PIX_FMT_YUV444P10, PIX_FMT_NONE }; @@ -592,52 +592,52 @@ static av_cold void X264_init_static(AVCodec *codec) #define OFFSET(x) offsetof(X264Context, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "preset", "Set the encoding preset (cf. x264 --fullhelp)", OFFSET(preset), FF_OPT_TYPE_STRING, { .str = "medium" }, 0, 0, VE}, - { "tune", "Tune the encoding params (cf. x264 --fullhelp)", OFFSET(tune), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, - { "profile", "Set profile restrictions (cf. x264 --fullhelp) ", OFFSET(profile), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, - { "fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), FF_OPT_TYPE_INT, { 1 }, 0, 1, VE}, - {"level", "Specify level (as defined by Annex A)", OFFSET(level), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, - {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, - {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, - {"x264opts", "x264 options", OFFSET(x264opts), FF_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, - { "crf", "Select the quality for constant quality mode", OFFSET(crf), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, - { "crf_max", "In CRF mode, prevents VBV from lowering quality beyond this point.",OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, - { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, - { "aq-mode", "AQ method", OFFSET(aq_mode), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "aq_mode"}, - { "none", NULL, 0, FF_OPT_TYPE_CONST, {X264_AQ_NONE}, INT_MIN, INT_MAX, VE, "aq_mode" }, - { "variance", "Variance AQ (complexity mask)", 0, FF_OPT_TYPE_CONST, {X264_AQ_VARIANCE}, INT_MIN, INT_MAX, VE, "aq_mode" }, - { "autovariance", "Auto-variance AQ (experimental)", 0, FF_OPT_TYPE_CONST, {X264_AQ_AUTOVARIANCE}, INT_MIN, INT_MAX, VE, "aq_mode" }, - { "aq-strength", "AQ strength. Reduces blocking and blurring in flat and textured areas.", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {-1}, -1, FLT_MAX, VE}, - { "psy", "Use psychovisual optimizations.", OFFSET(psy), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE }, - { "psy-rd", "Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.", OFFSET(psy_rd), FF_OPT_TYPE_STRING, {0 }, 0, 0, VE}, - { "rc-lookahead", "Number of frames to look ahead for frametype and ratecontrol", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, - { "weightb", "Weighted prediction for B-frames.", OFFSET(weightb), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE }, - { "weightp", "Weighted prediction analysis method.", OFFSET(weightp), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "weightp" }, - { "none", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_NONE}, INT_MIN, INT_MAX, VE, "weightp" }, - { "simple", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_SIMPLE}, INT_MIN, INT_MAX, VE, "weightp" }, - { "smart", NULL, 0, FF_OPT_TYPE_CONST, {X264_WEIGHTP_SMART}, INT_MIN, INT_MAX, VE, "weightp" }, - { "ssim", "Calculate and print SSIM stats.", OFFSET(ssim), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE }, - { "intra-refresh", "Use Periodic Intra Refresh instead of IDR frames.",OFFSET(intra_refresh),FF_OPT_TYPE_INT, {-1 }, -1, 1, VE }, - { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), FF_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE }, - { "b-pyramid", "Keep some B-frames as references.", OFFSET(b_pyramid), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "b_pyramid" }, - { "none", NULL, 0, FF_OPT_TYPE_CONST, {X264_B_PYRAMID_NONE}, INT_MIN, INT_MAX, VE, "b_pyramid" }, - { "strict", "Strictly hierarchical pyramid", 0, FF_OPT_TYPE_CONST, {X264_B_PYRAMID_STRICT}, INT_MIN, INT_MAX, VE, "b_pyramid" }, - { "normal", "Non-strict (not Blu-ray compatible)", 0, FF_OPT_TYPE_CONST, {X264_B_PYRAMID_NORMAL}, INT_MIN, INT_MAX, VE, "b_pyramid" }, - { "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), FF_OPT_TYPE_INT, {-1}, -1, 1, VE }, - { "8x8dct", "High profile 8x8 transform.", OFFSET(dct8x8), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, - { "fast-pskip", NULL, OFFSET(fast_pskip), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, - { "aud", "Use access unit delimiters.", OFFSET(aud), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, - { "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, - { "deblock", "Loop filter parameters, in <alpha:beta> form.", OFFSET(deblock), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, - { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, + { "preset", "Set the encoding preset (cf. x264 --fullhelp)", OFFSET(preset), AV_OPT_TYPE_STRING, { .str = "medium" }, 0, 0, VE}, + { "tune", "Tune the encoding params (cf. x264 --fullhelp)", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, + { "profile", "Set profile restrictions (cf. x264 --fullhelp) ", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, + { "fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), AV_OPT_TYPE_INT, { 1 }, 0, 1, VE}, + {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, + {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, + {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, + {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, + { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, + { "crf_max", "In CRF mode, prevents VBV from lowering quality beyond this point.",OFFSET(crf_max), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, + { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, + { "aq-mode", "AQ method", OFFSET(aq_mode), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "aq_mode"}, + { "none", NULL, 0, AV_OPT_TYPE_CONST, {X264_AQ_NONE}, INT_MIN, INT_MAX, VE, "aq_mode" }, + { "variance", "Variance AQ (complexity mask)", 0, AV_OPT_TYPE_CONST, {X264_AQ_VARIANCE}, INT_MIN, INT_MAX, VE, "aq_mode" }, + { "autovariance", "Auto-variance AQ (experimental)", 0, AV_OPT_TYPE_CONST, {X264_AQ_AUTOVARIANCE}, INT_MIN, INT_MAX, VE, "aq_mode" }, + { "aq-strength", "AQ strength. Reduces blocking and blurring in flat and textured areas.", OFFSET(aq_strength), AV_OPT_TYPE_FLOAT, {-1}, -1, FLT_MAX, VE}, + { "psy", "Use psychovisual optimizations.", OFFSET(psy), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE }, + { "psy-rd", "Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.", OFFSET(psy_rd), AV_OPT_TYPE_STRING, {0 }, 0, 0, VE}, + { "rc-lookahead", "Number of frames to look ahead for frametype and ratecontrol", OFFSET(rc_lookahead), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, + { "weightb", "Weighted prediction for B-frames.", OFFSET(weightb), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE }, + { "weightp", "Weighted prediction analysis method.", OFFSET(weightp), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "weightp" }, + { "none", NULL, 0, AV_OPT_TYPE_CONST, {X264_WEIGHTP_NONE}, INT_MIN, INT_MAX, VE, "weightp" }, + { "simple", NULL, 0, AV_OPT_TYPE_CONST, {X264_WEIGHTP_SIMPLE}, INT_MIN, INT_MAX, VE, "weightp" }, + { "smart", NULL, 0, AV_OPT_TYPE_CONST, {X264_WEIGHTP_SMART}, INT_MIN, INT_MAX, VE, "weightp" }, + { "ssim", "Calculate and print SSIM stats.", OFFSET(ssim), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE }, + { "intra-refresh", "Use Periodic Intra Refresh instead of IDR frames.",OFFSET(intra_refresh),AV_OPT_TYPE_INT, {-1 }, -1, 1, VE }, + { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), AV_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE }, + { "b-pyramid", "Keep some B-frames as references.", OFFSET(b_pyramid), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "b_pyramid" }, + { "none", NULL, 0, AV_OPT_TYPE_CONST, {X264_B_PYRAMID_NONE}, INT_MIN, INT_MAX, VE, "b_pyramid" }, + { "strict", "Strictly hierarchical pyramid", 0, AV_OPT_TYPE_CONST, {X264_B_PYRAMID_STRICT}, INT_MIN, INT_MAX, VE, "b_pyramid" }, + { "normal", "Non-strict (not Blu-ray compatible)", 0, AV_OPT_TYPE_CONST, {X264_B_PYRAMID_NORMAL}, INT_MIN, INT_MAX, VE, "b_pyramid" }, + { "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), AV_OPT_TYPE_INT, {-1}, -1, 1, VE }, + { "8x8dct", "High profile 8x8 transform.", OFFSET(dct8x8), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "fast-pskip", NULL, OFFSET(fast_pskip), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "aud", "Use access unit delimiters.", OFFSET(aud), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "deblock", "Loop filter parameters, in <alpha:beta> form.", OFFSET(deblock), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, + { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, { "partitions", "A comma-separated list of partitions to consider. " - "Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all", OFFSET(partitions), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, - { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "direct-pred" }, - { "none", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" }, - { "spatial", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" }, - { "temporal", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" }, - { "auto", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" }, - { "slice-max-size","Constant quantization parameter rate control method",OFFSET(slice_max_size), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, + "Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all", OFFSET(partitions), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE}, + { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "direct-pred" }, + { "none", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" }, + { "spatial", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" }, + { "temporal", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" }, + { "auto", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" }, + { "slice-max-size","Constant quantization parameter rate control method",OFFSET(slice_max_size), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, { NULL }, }; diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index 3a35a46517..4d9bec03e6 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -378,19 +378,19 @@ static av_cold int XAVS_init(AVCodecContext *avctx) #define OFFSET(x) offsetof(XavsContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "crf", "Select the quality for constant quality mode", OFFSET(crf), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, - { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, - { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), FF_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE }, - { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, - { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "direct-pred" }, - { "none", NULL, 0, FF_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" }, - { "spatial", NULL, 0, FF_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" }, - { "temporal", NULL, 0, FF_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" }, - { "auto", NULL, 0, FF_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" }, - { "aud", "Use access unit delimiters.", OFFSET(aud), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, - { "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, - { "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), FF_OPT_TYPE_INT, {-1}, -1, 1, VE }, - { "fast-pskip", NULL, OFFSET(fast_pskip), FF_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE }, + { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, + { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), AV_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE }, + { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), AV_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE}, + { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "direct-pred" }, + { "none", NULL, 0, AV_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" }, + { "spatial", NULL, 0, AV_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" }, + { "temporal", NULL, 0, AV_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" }, + { "auto", NULL, 0, AV_OPT_TYPE_CONST, { XAVS_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" }, + { "aud", "Use access unit delimiters.", OFFSET(aud), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, + { "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), AV_OPT_TYPE_INT, {-1}, -1, 1, VE }, + { "fast-pskip", NULL, OFFSET(fast_pskip), AV_OPT_TYPE_INT, {-1 }, -1, 1, VE}, { NULL }, }; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index c7ddaebe21..944b2eb975 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1591,7 +1591,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) #define OFFSET(x) offsetof(MJpegDecodeContext, x) #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "extern_huff", "Use external huffman table.", OFFSET(extern_huff), FF_OPT_TYPE_INT, { 0 }, 0, 1, VD }, + { "extern_huff", "Use external huffman table.", OFFSET(extern_huff), AV_OPT_TYPE_INT, { 0 }, 0, 1, VD }, { NULL }, }; diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index fd50e73211..1772ed79f6 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -943,9 +943,9 @@ static void mpeg1_encode_block(MpegEncContext *s, #define COMMON_OPTS\ {TIMECODE_OPT(MpegEncContext,\ AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)},\ - { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE },\ - { "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE}, \ - { "scan_offset", "Reserve space for SVCD scan offset user data.", OFFSET(scan_offset), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },\ + { "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE}, \ + { "scan_offset", "Reserve space for SVCD scan offset user data.", OFFSET(scan_offset), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, static const AVOption mpeg1_options[] = { COMMON_OPTS @@ -954,8 +954,8 @@ static const AVOption mpeg1_options[] = { static const AVOption mpeg2_options[] = { COMMON_OPTS - { "non_linear_quant", "Use nonlinear quantizer.", OFFSET(q_scale_type), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, - { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "non_linear_quant", "Use nonlinear quantizer.", OFFSET(q_scale_type), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, { NULL }, }; diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index bf94028b2a..b39a7e7416 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -1289,8 +1289,8 @@ void ff_mpeg4_encode_video_packet_header(MpegEncContext *s) #define OFFSET(x) offsetof(MpegEncContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "data_partitioning", "Use data partitioning.", OFFSET(data_partitioning), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, - { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "data_partitioning", "Use data partitioning.", OFFSET(data_partitioning), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, { NULL }, }; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 6439dbf262..2925c2f780 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3825,8 +3825,8 @@ int dct_quantize_c(MpegEncContext *s, #define OFFSET(x) offsetof(MpegEncContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption h263_options[] = { - { "obmc", "use overlapped block motion compensation.", OFFSET(obmc), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, - { "structured_slices","Write slice start position at every GOB header instead of just GOB number.", OFFSET(h263_slice_structured), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE}, + { "obmc", "use overlapped block motion compensation.", OFFSET(obmc), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "structured_slices","Write slice start position at every GOB header instead of just GOB number.", OFFSET(h263_slice_structured), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE}, { NULL }, }; @@ -3851,10 +3851,10 @@ AVCodec ff_h263_encoder = { }; static const AVOption h263p_options[] = { - { "umv", "Use unlimited motion vectors.", OFFSET(umvplus), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, - { "aiv", "Use alternative inter VLC.", OFFSET(alt_inter_vlc), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, - { "obmc", "use overlapped block motion compensation.", OFFSET(obmc), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, - { "structured_slices", "Write slice start position at every GOB header instead of just GOB number.", OFFSET(h263_slice_structured), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE}, + { "umv", "Use unlimited motion vectors.", OFFSET(umvplus), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "aiv", "Use alternative inter VLC.", OFFSET(alt_inter_vlc), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "obmc", "use overlapped block motion compensation.", OFFSET(obmc), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "structured_slices", "Write slice start position at every GOB header instead of just GOB number.", OFFSET(h263_slice_structured), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE}, { NULL }, }; static const AVClass h263p_class = { diff --git a/libavcodec/options.c b/libavcodec/options.c index d412a94acb..91b7a515dd 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -39,22 +39,27 @@ static const char* context_to_name(void* ptr) { return "NULL"; } -static const AVOption *opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags) +static void *codec_child_next(void *obj, void *prev) { AVCodecContext *s = obj; - AVCodec *c = NULL; + if (!prev && s->codec && s->codec->priv_class && s->priv_data) + return s->priv_data; + return NULL; +} - if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ) && s->priv_data) { - if (s->codec && s->codec->priv_class) - return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags); - return NULL; - } +static const AVClass *codec_child_class_next(const AVClass *prev) +{ + AVCodec *c = NULL; - while ((c = av_codec_next(c))) { - const AVOption *o; - if (c->priv_class && (o = av_opt_find(&c->priv_class, name, unit, opt_flags, search_flags))) - return o; - } + /* find the codec that corresponds to prev */ + while (prev && (c = av_codec_next(c))) + if (c->priv_class == prev) + break; + + /* find next codec with priv options */ + while (c = av_codec_next(c)) + if (c->priv_class) + return c->priv_class; return NULL; } @@ -70,443 +75,443 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i #define AV_CODEC_DEFAULT_BITRATE 200*1000 static const AVOption options[]={ -{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, A|V|E}, -{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = 128*1000 }, INT_MIN, INT_MAX, A|E}, -{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E}, -{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, UINT_MAX, V|A|E|D, "flags"}, -{"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"}, +{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, A|V|E}, +{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.dbl = 128*1000 }, INT_MIN, INT_MAX, A|E}, +{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), AV_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E}, +{"flags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, UINT_MAX, V|A|E|D, "flags"}, +{"mv4", "use four motion vector by macroblock (mpeg4)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"obmc", "use overlapped block motion compensation (h263+)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_OBMC }, INT_MIN, INT_MAX, V|E, "flags"}, +{"obmc", "use overlapped block motion compensation (h263+)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_OBMC }, INT_MIN, INT_MAX, V|E, "flags"}, #endif -{"qpel", "use 1/4 pel motion compensation", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, -{"loop", "use loop filter", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, -{"qscale", "use fixed qscale", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, -{"gmc", "use gmc", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GMC }, INT_MIN, INT_MAX, V|E, "flags"}, -{"mv0", "always try a mb with mv=<0,0>", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_MV0 }, INT_MIN, INT_MAX, V|E, "flags"}, +{"qpel", "use 1/4 pel motion compensation", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, +{"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, +{"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, +{"gmc", "use gmc", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GMC }, INT_MIN, INT_MAX, V|E, "flags"}, +{"mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_MV0 }, INT_MIN, INT_MAX, V|E, "flags"}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"part", "use data partitioning", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PART }, INT_MIN, INT_MAX, V|E, "flags"}, +{"part", "use data partitioning", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PART }, INT_MIN, INT_MAX, V|E, "flags"}, #endif -{"input_preserved", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INPUT_PRESERVED }, INT_MIN, INT_MAX, 0, "flags"}, -{"pass1", "use internal 2pass ratecontrol in first pass mode", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"}, -{"pass2", "use internal 2pass ratecontrol in second pass mode", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, +{"input_preserved", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INPUT_PRESERVED }, INT_MIN, INT_MAX, 0, "flags"}, +{"pass1", "use internal 2pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"}, +{"pass2", "use internal 2pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, #if FF_API_MJPEG_GLOBAL_OPTS -{"extern_huff", "use external huffman table (for mjpeg)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_EXTERN_HUFF }, INT_MIN, INT_MAX, 0, "flags"}, +{"extern_huff", "use external huffman table (for mjpeg)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_EXTERN_HUFF }, INT_MIN, INT_MAX, 0, "flags"}, #endif -{"gray", "only decode/encode grayscale", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, -{"emu_edge", "don't draw edges", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"}, -{"psnr", "error[?] variables will be set during encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, -{"truncated", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"}, -{"naq", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"}, -{"ildct", "use interlaced dct", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, -{"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, +{"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, +{"emu_edge", "don't draw edges", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"}, +{"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, +{"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"}, +{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"}, +{"ildct", "use interlaced dct", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, +{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_ALT_SCAN }, INT_MIN, INT_MAX, V|E, "flags"}, +{"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_ALT_SCAN }, INT_MIN, INT_MAX, V|E, "flags"}, #endif -{"global_header", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, -{"bitexact", "use only bitexact stuff (except (i)dct)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_BITEXACT }, INT_MIN, INT_MAX, A|V|S|D|E, "flags"}, -{"aic", "h263 advanced intra coding / mpeg4 ac prediction", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_AC_PRED }, INT_MIN, INT_MAX, V|E, "flags"}, +{"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, +{"bitexact", "use only bitexact stuff (except (i)dct)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_BITEXACT }, INT_MIN, INT_MAX, A|V|S|D|E, "flags"}, +{"aic", "h263 advanced intra coding / mpeg4 ac prediction", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_AC_PRED }, INT_MIN, INT_MAX, V|E, "flags"}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"umv", "use unlimited motion vectors", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_H263P_UMV }, INT_MIN, INT_MAX, V|E, "flags"}, +{"umv", "use unlimited motion vectors", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_H263P_UMV }, INT_MIN, INT_MAX, V|E, "flags"}, #endif -{"cbp", "use rate distortion optimization for cbp", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CBP_RD }, INT_MIN, INT_MAX, V|E, "flags"}, -{"qprd", "use rate distortion optimization for qp selection", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QP_RD }, INT_MIN, INT_MAX, V|E, "flags"}, +{"cbp", "use rate distortion optimization for cbp", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CBP_RD }, INT_MIN, INT_MAX, V|E, "flags"}, +{"qprd", "use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_QP_RD }, INT_MIN, INT_MAX, V|E, "flags"}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"aiv", "h263 alternative inter vlc", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_H263P_AIV }, INT_MIN, INT_MAX, V|E, "flags"}, -{"slice", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_H263P_SLICE_STRUCT }, INT_MIN, INT_MAX, V|E, "flags"}, +{"aiv", "h263 alternative inter vlc", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_H263P_AIV }, INT_MIN, INT_MAX, V|E, "flags"}, +{"slice", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_H263P_SLICE_STRUCT }, INT_MIN, INT_MAX, V|E, "flags"}, #endif -{"ilme", "interlaced motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"}, +{"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"scan_offset", "will reserve space for svcd scan offset user data", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_SVCD_SCAN_OFFSET }, INT_MIN, INT_MAX, V|E, "flags"}, +{"scan_offset", "will reserve space for svcd scan offset user data", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_SVCD_SCAN_OFFSET }, INT_MIN, INT_MAX, V|E, "flags"}, #endif -{"cgop", "closed gop", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"}, -{"fast", "allow non spec compliant speedup tricks", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"sgop", "strictly enforce gop size", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_STRICT_GOP }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"noout", "skip bitstream encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"local_header", "place global headers at every keyframe instead of in extradata", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"showall", "Show all frames before the first keyframe", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"}, -{"sub_id", NULL, OFFSET(sub_id), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"me_method", "set motion estimation method", OFFSET(me_method), FF_OPT_TYPE_INT, {.dbl = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"}, -{"zero", "zero motion estimation (fastest)", 0, FF_OPT_TYPE_CONST, {.dbl = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"full", "full motion estimation (slowest)", 0, FF_OPT_TYPE_CONST, {.dbl = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"epzs", "EPZS motion estimation (default)", 0, FF_OPT_TYPE_CONST, {.dbl = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"esa", "esa motion estimation (alias for full)", 0, FF_OPT_TYPE_CONST, {.dbl = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"tesa", "tesa motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_TESA }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"dia", "dia motion estimation (alias for epzs)", 0, FF_OPT_TYPE_CONST, {.dbl = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"log", "log motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_LOG }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"phods", "phods motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_PHODS }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"x1", "X1 motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_X1 }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"hex", "hex motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"umh", "umh motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"iter", "iter motion estimation", 0, FF_OPT_TYPE_CONST, {.dbl = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX}, -{"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, {.dbl = 12 }, INT_MIN, INT_MAX, V|E}, -{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, -{"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, -{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|E}, -{"frame_size", NULL, OFFSET(frame_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|E}, -{"frame_number", NULL, OFFSET(frame_number), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -FLT_MAX, FLT_MAX, V|E}, -{"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -1, FLT_MAX, V|E}, -{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, {.dbl = 2 }, -1, 69, V|E}, -{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, {.dbl = 31 }, -1, 69, V|E}, -{"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, {.dbl = 3 }, INT_MIN, INT_MAX, V|E}, -{"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -1, FF_MAX_B_FRAMES, V|E}, -{"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, -{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E}, +{"cgop", "closed gop", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"}, +{"fast", "allow non spec compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"sgop", "strictly enforce gop size", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_STRICT_GOP }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"local_header", "place global headers at every keyframe instead of in extradata", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"}, +{"sub_id", NULL, OFFSET(sub_id), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.dbl = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"}, +{"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.dbl = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.dbl = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"epzs", "EPZS motion estimation (default)", 0, AV_OPT_TYPE_CONST, {.dbl = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"esa", "esa motion estimation (alias for full)", 0, AV_OPT_TYPE_CONST, {.dbl = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"tesa", "tesa motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_TESA }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"dia", "dia motion estimation (alias for epzs)", 0, AV_OPT_TYPE_CONST, {.dbl = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"log", "log motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_LOG }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"phods", "phods motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_PHODS }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"x1", "X1 motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_X1 }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" }, +{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX}, +{"g", "set the group of picture size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.dbl = 12 }, INT_MIN, INT_MAX, V|E}, +{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, +{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, +{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|E}, +{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|E}, +{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -FLT_MAX, FLT_MAX, V|E}, +{"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -1, FLT_MAX, V|E}, +{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), AV_OPT_TYPE_INT, {.dbl = 2 }, -1, 69, V|E}, +{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.dbl = 31 }, -1, 69, V|E}, +{"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.dbl = 3 }, INT_MIN, INT_MAX, V|E}, +{"bf", "use 'frames' B frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, -1, FF_MAX_B_FRAMES, V|E}, +{"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, +{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E}, #if FF_API_X264_GLOBAL_OPTS -{"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E}, +{"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E}, #endif -{"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"i_tex_bits", NULL, OFFSET(i_tex_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"p_tex_bits", NULL, OFFSET(p_tex_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"i_count", NULL, OFFSET(i_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"p_count", NULL, OFFSET(p_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"skip_count", NULL, OFFSET(skip_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"misc_bits", NULL, OFFSET(misc_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"frame_bits", NULL, OFFSET(frame_bits), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"codec_tag", NULL, OFFSET(codec_tag), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"bug", "workaround not auto detected encoder bugs", OFFSET(workaround_bugs), FF_OPT_TYPE_FLAGS, {.dbl = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, -{"autodetect", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, -{"old_msmpeg4", "some old lavc generated msmpeg4v3 files (no autodetection)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, "bug"}, -{"xvid_ilace", "Xvid interlacing bug (autodetected if fourcc==XVIX)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"}, -{"ump4", "(autodetected if fourcc==UMP4)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"}, -{"no_padding", "padding bug (autodetected)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"}, -{"amv", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, "bug"}, -{"ac_vlc", "illegal vlc bug (autodetected per fourcc)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"}, -{"qpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_QPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, -{"std_qpel", "old standard qpel (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"}, -{"qpel_chroma2", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_QPEL_CHROMA2 }, INT_MIN, INT_MAX, V|D, "bug"}, -{"direct_blocksize", "direct-qpel-blocksize bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_DIRECT_BLOCKSIZE }, INT_MIN, INT_MAX, V|D, "bug"}, -{"edge", "edge padding bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_EDGE }, INT_MIN, INT_MAX, V|D, "bug"}, -{"hpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_HPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, -{"dc_clip", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_DC_CLIP }, INT_MIN, INT_MAX, V|D, "bug"}, -{"ms", "workaround various bugs in microsofts broken decoders", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_MS }, INT_MIN, INT_MAX, V|D, "bug"}, -{"trunc", "trancated frames", 0, FF_OPT_TYPE_CONST, {.dbl = FF_BUG_TRUNCATED}, INT_MIN, INT_MAX, V|D, "bug"}, -{"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|V|D|E, "strict"}, -{"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_VERY_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"normal", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"unofficial", "allow unofficial extensions", 0, FF_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"experimental", "allow non standardized experimental things", 0, FF_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"b_qoffset", "qp offset between P and B frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, -{"er", "set error detection aggressivity", OFFSET(error_recognition), FF_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "er"}, -{"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, V|D, "er"}, -{"compliant", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_COMPLIANT }, INT_MIN, INT_MAX, V|D, "er"}, -{"aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"}, +{"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"i_tex_bits", NULL, OFFSET(i_tex_bits), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"p_tex_bits", NULL, OFFSET(p_tex_bits), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"i_count", NULL, OFFSET(i_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"p_count", NULL, OFFSET(p_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"skip_count", NULL, OFFSET(skip_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"misc_bits", NULL, OFFSET(misc_bits), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"frame_bits", NULL, OFFSET(frame_bits), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"bug", "workaround not auto detected encoder bugs", OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.dbl = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, +{"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, +{"old_msmpeg4", "some old lavc generated msmpeg4v3 files (no autodetection)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, "bug"}, +{"xvid_ilace", "Xvid interlacing bug (autodetected if fourcc==XVIX)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"}, +{"ump4", "(autodetected if fourcc==UMP4)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"}, +{"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"}, +{"amv", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, "bug"}, +{"ac_vlc", "illegal vlc bug (autodetected per fourcc)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"}, +{"qpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_QPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, +{"std_qpel", "old standard qpel (autodetected per fourcc/version)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"}, +{"qpel_chroma2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_QPEL_CHROMA2 }, INT_MIN, INT_MAX, V|D, "bug"}, +{"direct_blocksize", "direct-qpel-blocksize bug (autodetected per fourcc/version)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_DIRECT_BLOCKSIZE }, INT_MIN, INT_MAX, V|D, "bug"}, +{"edge", "edge padding bug (autodetected per fourcc/version)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_EDGE }, INT_MIN, INT_MAX, V|D, "bug"}, +{"hpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_HPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, +{"dc_clip", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_DC_CLIP }, INT_MIN, INT_MAX, V|D, "bug"}, +{"ms", "workaround various bugs in microsofts broken decoders", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_MS }, INT_MIN, INT_MAX, V|D, "bug"}, +{"trunc", "trancated frames", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_TRUNCATED}, INT_MIN, INT_MAX, V|D, "bug"}, +{"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|V|D|E, "strict"}, +{"very", "strictly conform to a older more strict version of the spec or reference software", 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_VERY_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"}, +{"strict", "strictly conform to all the things in the spec no matter what consequences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"}, +{"normal", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, +{"unofficial", "allow unofficial extensions", 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, +{"experimental", "allow non standardized experimental things", 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, +{"b_qoffset", "qp offset between P and B frames", OFFSET(b_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, +{"er", "set error detection aggressivity", OFFSET(error_recognition), AV_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "er"}, +{"careful", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, V|D, "er"}, +{"compliant", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_COMPLIANT }, INT_MIN, INT_MAX, V|D, "er"}, +{"aggressive", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"}, #if FF_API_VERY_AGGRESSIVE -{"very_aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"}, +{"very_aggressive", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"}, #endif /* FF_API_VERY_AGGRESSIVE */ -{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"}, -{"has_b_frames", NULL, OFFSET(has_b_frames), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"block_align", NULL, OFFSET(block_align), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"parse_only", NULL, OFFSET(parse_only), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"stats_out", NULL, OFFSET(stats_out), FF_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX}, -{"stats_in", NULL, OFFSET(stats_in), FF_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX}, -{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E}, -{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, -{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"rc_override_count", NULL, OFFSET(rc_override_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"rc_eq", "set rate control equation", OFFSET(rc_eq), FF_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E}, -{"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|V|E}, -{"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E}, -{"i_qfactor", "qp factor between P and I frames", OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, {.dbl = -0.8 }, -FLT_MAX, FLT_MAX, V|E}, -{"i_qoffset", "qp offset between P and I frames", OFFSET(i_quant_offset), FF_OPT_TYPE_FLOAT, {.dbl = 0.0 }, -FLT_MAX, FLT_MAX, V|E}, -{"rc_init_cplx", "initial complexity for 1-pass encoding", OFFSET(rc_initial_cplx), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, -{"dct", "DCT algorithm", OFFSET(dct_algo), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, V|E, "dct"}, -{"auto", "autoselect a good one (default)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"}, -{"fastint", "fast integer", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"}, -{"int", "accurate integer", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"}, -{"mmx", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"}, -{"mlib", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_MLIB }, INT_MIN, INT_MAX, V|E, "dct"}, -{"altivec", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"}, -{"faan", "floating point AAN DCT", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"}, -{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"idct", "select IDCT implementation", OFFSET(idct_algo), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, V|E|D, "idct"}, -{"auto", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"int", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simple", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplemmx", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"libmpeg2mmx", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"ps2", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"mlib", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_MLIB }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"arm", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"altivec", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"sh4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplearm", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplearmv5te", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplearmv6", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simpleneon", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplealpha", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"h264", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_H264 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"vp3", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_VP3 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"ipp", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"xvidmmx", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"faani", "floating point AAN IDCT", 0, FF_OPT_TYPE_CONST, {.dbl = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"}, -{"slice_count", NULL, OFFSET(slice_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"ec", "set error concealment strategy", OFFSET(error_concealment), FF_OPT_TYPE_FLAGS, {.dbl = 3 }, INT_MIN, INT_MAX, V|D, "ec"}, -{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_EC_GUESS_MVS }, INT_MIN, INT_MAX, V|D, "ec"}, -{"deblock", "use strong deblock filter for damaged MBs", 0, FF_OPT_TYPE_CONST, {.dbl = FF_EC_DEBLOCK }, INT_MIN, INT_MAX, V|D, "ec"}, -{"bits_per_coded_sample", NULL, OFFSET(bits_per_coded_sample), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"pred", "prediction method", OFFSET(prediction_method), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "pred"}, -{"left", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PRED_LEFT }, INT_MIN, INT_MAX, V|E, "pred"}, -{"plane", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PRED_PLANE }, INT_MIN, INT_MAX, V|E, "pred"}, -{"median", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PRED_MEDIAN }, INT_MIN, INT_MAX, V|E, "pred"}, -{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10, V|E}, -{"debug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, V|A|S|E|D, "debug"}, -{"pict", "picture info", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_PICT_INFO }, INT_MIN, INT_MAX, V|D, "debug"}, -{"rc", "rate control", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_RC }, INT_MIN, INT_MAX, V|E, "debug"}, -{"bitstream", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"}, -{"mb_type", "macroblock (MB) type", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, -{"qp", "per-block quantization parameter (QP)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"mv", "motion vector", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"}, -{"dct_coeff", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"}, -{"skip", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"startcode", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, "debug"}, -{"pts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_PTS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"er", "error recognition", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"}, -{"mmco", "memory management control operations (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"}, -{"bugs", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, -{"buffers", "picture buffer allocations", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"thread_ops", "threading operations", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"}, -{"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"ildctcmp", "interlaced dct compare function", OFFSET(ildct_cmp), FF_OPT_TYPE_INT, {.dbl = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"preme", "pre motion estimation", OFFSET(pre_me), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sad", "sum of absolute differences, fast (default)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sse", "sum of squared errors", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"satd", "sum of absolute Hadamard transformed differences", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dct", "sum of absolute DCT transformed differences", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_DCT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"bit", "number of bits needed for the block", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"rd", "rate distortion optimal, slow", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"zero", "0", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsad", "sum of absolute vertical differences", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsse", "sum of squared vertical differences", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"nsse", "noise preserving sum of squared differences", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"}, +{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"parse_only", NULL, OFFSET(parse_only), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"stats_out", NULL, OFFSET(stats_out), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX}, +{"stats_in", NULL, OFFSET(stats_in), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX}, +{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E}, +{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, +{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"rc_eq", "set rate control equation", OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E}, +{"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|V|E}, +{"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E}, +{"i_qfactor", "qp factor between P and I frames", OFFSET(i_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = -0.8 }, -FLT_MAX, FLT_MAX, V|E}, +{"i_qoffset", "qp offset between P and I frames", OFFSET(i_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 0.0 }, -FLT_MAX, FLT_MAX, V|E}, +{"rc_init_cplx", "initial complexity for 1-pass encoding", OFFSET(rc_initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, +{"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, V|E, "dct"}, +{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"}, +{"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"}, +{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"}, +{"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"}, +{"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_MLIB }, INT_MIN, INT_MAX, V|E, "dct"}, +{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"}, +{"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"}, +{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, +{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, +{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, +{"p_mask", "inter masking", OFFSET(p_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, +{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, +{"idct", "select IDCT implementation", OFFSET(idct_algo), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, V|E|D, "idct"}, +{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"int", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simple", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"mlib", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_MLIB }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplearm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplearmv5te", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplearmv6", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simpleneon", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"simplealpha", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"h264", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_H264 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"vp3", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_VP3 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"ipp", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"xvidmmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"faani", "floating point AAN IDCT", 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"}, +{"slice_count", NULL, OFFSET(slice_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"ec", "set error concealment strategy", OFFSET(error_concealment), AV_OPT_TYPE_FLAGS, {.dbl = 3 }, INT_MIN, INT_MAX, V|D, "ec"}, +{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_EC_GUESS_MVS }, INT_MIN, INT_MAX, V|D, "ec"}, +{"deblock", "use strong deblock filter for damaged MBs", 0, AV_OPT_TYPE_CONST, {.dbl = FF_EC_DEBLOCK }, INT_MIN, INT_MAX, V|D, "ec"}, +{"bits_per_coded_sample", NULL, OFFSET(bits_per_coded_sample), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"pred", "prediction method", OFFSET(prediction_method), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "pred"}, +{"left", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PRED_LEFT }, INT_MIN, INT_MAX, V|E, "pred"}, +{"plane", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PRED_PLANE }, INT_MIN, INT_MAX, V|E, "pred"}, +{"median", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PRED_MEDIAN }, INT_MIN, INT_MAX, V|E, "pred"}, +{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10, V|E}, +{"debug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, V|A|S|E|D, "debug"}, +{"pict", "picture info", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_PICT_INFO }, INT_MIN, INT_MAX, V|D, "debug"}, +{"rc", "rate control", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_RC }, INT_MIN, INT_MAX, V|E, "debug"}, +{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"}, +{"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, +{"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"}, +{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"}, +{"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"}, +{"skip", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"}, +{"startcode", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, "debug"}, +{"pts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_PTS }, INT_MIN, INT_MAX, V|D, "debug"}, +{"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"}, +{"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"}, +{"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"}, +{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"}, +{"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, +{"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"}, +{"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, "debug"}, +{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"}, +{"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"bf", "forward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.dbl = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"}, +{"cmp", "full pel me compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"ildctcmp", "interlaced dct compare function", OFFSET(ildct_cmp), AV_OPT_TYPE_INT, {.dbl = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"preme", "pre motion estimation", OFFSET(pre_me), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"sad", "sum of absolute differences, fast (default)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"sse", "sum of squared errors", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"satd", "sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"dct", "sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_DCT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"bit", "number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"rd", "rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"zero", "0", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"nsse", "noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, #if CONFIG_SNOW_ENCODER -{"w53", "5/3 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"w97", "9/7 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, #endif -{"dctmax", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"chroma", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_CMP_CHROMA }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"subq", "sub pel motion estimation quality", OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, {.dbl = 8 }, INT_MIN, INT_MAX, V|E}, -{"dtg_active_format", NULL, OFFSET(dtg_active_format), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"ibias", "intra quant bias", OFFSET(intra_quant_bias), FF_OPT_TYPE_INT, {.dbl = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, -{"pbias", "inter quant bias", OFFSET(inter_quant_bias), FF_OPT_TYPE_INT, {.dbl = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, -{"color_table_id", NULL, OFFSET(color_table_id), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"internal_buffer_count", NULL, OFFSET(internal_buffer_count), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"global_quality", NULL, OFFSET(global_quality), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"coder", NULL, OFFSET(coder_type), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"}, -{"vlc", "variable length coder / huffman coder", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"}, -{"ac", "arithmetic coder", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"}, -{"raw", "raw (no encoding)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"}, -{"rle", "run-length coder", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"}, -{"deflate", "deflate-based coder", 0, FF_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"}, -{"context", "context model", OFFSET(context_model), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"slice_flags", NULL, OFFSET(slice_flags), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"simple", "use mbcmp (default)", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"bits", "use fewest bits", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"rd", "use best rate distortion", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"lmin", "min lagrange factor (VBR)", OFFSET(lmin), FF_OPT_TYPE_INT, {.dbl = 2*FF_QP2LAMBDA }, 0, INT_MAX, V|E}, -{"lmax", "max lagrange factor (VBR)", OFFSET(lmax), FF_OPT_TYPE_INT, {.dbl = 31*FF_QP2LAMBDA }, 0, INT_MAX, V|E}, -{"nr", "noise reduction", OFFSET(noise_reduction), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, {.dbl = CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE }, 0, UINT_MAX, V|A|E|D, "flags2"}, -{"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_CMP_CHROMA }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"subq", "sub pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.dbl = 8 }, INT_MIN, INT_MAX, V|E}, +{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.dbl = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, +{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.dbl = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, +{"color_table_id", NULL, OFFSET(color_table_id), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"internal_buffer_count", NULL, OFFSET(internal_buffer_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, +{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"}, +{"vlc", "variable length coder / huffman coder", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"}, +{"ac", "arithmetic coder", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"}, +{"raw", "raw (no encoding)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"}, +{"rle", "run-length coder", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"}, +{"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.dbl = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"}, +{"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "mbd"}, +{"simple", "use mbcmp (default)", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"}, +{"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"}, +{"rd", "use best rate distortion", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"}, +{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"lmin", "min lagrange factor (VBR)", OFFSET(lmin), AV_OPT_TYPE_INT, {.dbl = 2*FF_QP2LAMBDA }, 0, INT_MAX, V|E}, +{"lmax", "max lagrange factor (VBR)", OFFSET(lmax), AV_OPT_TYPE_INT, {.dbl = 31*FF_QP2LAMBDA }, 0, INT_MAX, V|E}, +{"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"inter_threshold", NULL, OFFSET(inter_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.dbl = CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE }, 0, UINT_MAX, V|A|E|D, "flags2"}, +{"error", NULL, OFFSET(error_rate), AV_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"}, -{"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"}, +{"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D, "aa"}, +{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_AA_AUTO }, INT_MIN, INT_MAX, V|D, "aa"}, +{"fastint", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_AA_FASTINT }, INT_MIN, INT_MAX, V|D, "aa"}, +{"int", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_AA_INT }, INT_MIN, INT_MAX, V|D, "aa"}, +{"float", NULL, 0, AV_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, V|E}, -{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E}, -{"nssew", "nsse weight", OFFSET(nsse_weight), FF_OPT_TYPE_INT, {.dbl = 8 }, INT_MIN, INT_MAX, V|E}, -{"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D}, -{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D}, -{"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, {.dbl = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"}, -{"unknown", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"}, -{"aac_main", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_MAIN }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_low", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_ssr", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_SSR }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_ltp", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_LTP }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_es", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_96_24", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_hd_hra", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_HRA }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_hd_ma", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"}, -{"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, -{"unknown", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, -{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|A|D}, -{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), FF_OPT_TYPE_INT, {.dbl = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"border_mask", "increases the quantizer for macroblocks close to borders", OFFSET(border_masking), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, -{"mblmin", "min macroblock lagrange factor (VBR)", OFFSET(mb_lmin), FF_OPT_TYPE_INT, {.dbl = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E}, -{"mblmax", "max macroblock lagrange factor (VBR)", OFFSET(mb_lmax), FF_OPT_TYPE_INT, {.dbl = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E}, -{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), FF_OPT_TYPE_INT, {.dbl = 256 }, INT_MIN, INT_MAX, V|E}, -{"skip_loop_filter", NULL, OFFSET(skip_loop_filter), FF_OPT_TYPE_INT, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"skip_idct" , NULL, OFFSET(skip_idct) , FF_OPT_TYPE_INT, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"skip_frame" , NULL, OFFSET(skip_frame) , FF_OPT_TYPE_INT, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"none" , NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AVDISCARD_NONE }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"default" , NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"noref" , NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AVDISCARD_NONREF }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"bidir" , NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AVDISCARD_BIDIR }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"nokey" , NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AVDISCARD_NONKEY }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"all" , NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AVDISCARD_ALL }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 4, V|E}, -{"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 10, V|E}, +{"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E|D}, +{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E}, +{"nssew", "nsse weight", OFFSET(nsse_weight), AV_OPT_TYPE_INT, {.dbl = 8 }, INT_MIN, INT_MAX, V|E}, +{"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D}, +{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|D}, +{"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.dbl = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"}, +{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"}, +{"aac_main", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_MAIN }, INT_MIN, INT_MAX, A|E, "profile"}, +{"aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"}, +{"aac_ssr", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_SSR }, INT_MIN, INT_MAX, A|E, "profile"}, +{"aac_ltp", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_AAC_LTP }, INT_MIN, INT_MAX, A|E, "profile"}, +{"dts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "profile"}, +{"dts_es", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "profile"}, +{"dts_96_24", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "profile"}, +{"dts_hd_hra", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_HRA }, INT_MIN, INT_MAX, A|E, "profile"}, +{"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"}, +{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, +{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, +{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|A|D}, +{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.dbl = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, +{"border_mask", "increases the quantizer for macroblocks close to borders", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, +{"mblmin", "min macroblock lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.dbl = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E}, +{"mblmax", "max macroblock lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.dbl = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E}, +{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.dbl = 256 }, INT_MIN, INT_MAX, V|E}, +{"skip_loop_filter", NULL, OFFSET(skip_loop_filter), AV_OPT_TYPE_INT, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"skip_idct" , NULL, OFFSET(skip_idct) , AV_OPT_TYPE_INT, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"skip_frame" , NULL, OFFSET(skip_frame) , AV_OPT_TYPE_INT, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"none" , NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AVDISCARD_NONE }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"default" , NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"noref" , NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AVDISCARD_NONREF }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"bidir" , NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AVDISCARD_BIDIR }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"nokey" , NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AVDISCARD_NONKEY }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"all" , NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AVDISCARD_ALL }, INT_MIN, INT_MAX, V|D, "avdiscard"}, +{"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), AV_OPT_TYPE_INT, {.dbl = 1 }, 0, 4, V|E}, +{"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 10, V|E}, #if FF_API_X264_GLOBAL_OPTS -{"crf", "enables constant quality mode, and selects the quality (x264/VP8)", OFFSET(crf), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 63, V|E}, -{"cqp", "constant quantization parameter rate control method", OFFSET(cqp), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E}, +{"crf", "enables constant quality mode, and selects the quality (x264/VP8)", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 63, V|E}, +{"cqp", "constant quantization parameter rate control method", OFFSET(cqp), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E}, #endif -{"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), FF_OPT_TYPE_INT, {.dbl = 25 }, INT_MIN, INT_MAX, V|E}, -{"refs", "reference frames to consider for motion compensation", OFFSET(refs), FF_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E}, -{"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.dbl = 25 }, INT_MIN, INT_MAX, V|E}, +{"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E}, +{"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, #if FF_API_X264_GLOBAL_OPTS -{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, +{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, #endif -{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, +{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, #if FF_API_X264_GLOBAL_OPTS -{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E}, -{"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BPYRAMID }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_WPRED }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MIXED_REFS }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"dct8x8", "high profile 8x8 transform (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_8X8DCT }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"fastpskip", "fast pskip (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_FASTPSKIP }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"aud", "access unit delimiters (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_AUD }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E}, +{"bpyramid", "allows B-frames to be used as references for predicting", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BPYRAMID }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"wpred", "weighted biprediction for b-frames (H.264)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_WPRED }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MIXED_REFS }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"dct8x8", "high profile 8x8 transform (H.264)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_8X8DCT }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"fastpskip", "fast pskip (H.264)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_FASTPSKIP }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"aud", "access unit delimiters (H.264)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_AUD }, INT_MIN, INT_MAX, V|E, "flags2"}, #endif -{"skiprd", "RD optimal MB level residual skipping", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SKIP_RD }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"skiprd", "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SKIP_RD }, INT_MIN, INT_MAX, V|E, "flags2"}, #if FF_API_X264_GLOBAL_OPTS -{"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E}, -{"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E}, -{"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E}, -{"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "partitions"}, -{"parti4x4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_I4X4 }, INT_MIN, INT_MAX, V|E, "partitions"}, -{"parti8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_I8X8 }, INT_MIN, INT_MAX, V|E, "partitions"}, -{"partp4x4", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_P4X4 }, INT_MIN, INT_MAX, V|E, "partitions"}, -{"partp8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_P8X8 }, INT_MIN, INT_MAX, V|E, "partitions"}, -{"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = X264_PART_B8X8 }, INT_MIN, INT_MAX, V|E, "partitions"}, +{"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E}, +{"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E}, +{"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, -6, 6, V|E}, +{"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E, "partitions"}, +{"parti4x4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = X264_PART_I4X4 }, INT_MIN, INT_MAX, V|E, "partitions"}, +{"parti8x8", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = X264_PART_I8X8 }, INT_MIN, INT_MAX, V|E, "partitions"}, +{"partp4x4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = X264_PART_P4X4 }, INT_MIN, INT_MAX, V|E, "partitions"}, +{"partp8x8", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = X264_PART_P8X8 }, INT_MIN, INT_MAX, V|E, "partitions"}, +{"partb8x8", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = X264_PART_B8X8 }, INT_MIN, INT_MAX, V|E, "partitions"}, #endif -{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), FF_OPT_TYPE_INT, {.dbl = 6 }, 0, INT_MAX, V|E}, -{"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, {.dbl = 256 }, 0, INT_MAX, V|E}, +{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.dbl = 6 }, 0, INT_MAX, V|E}, +{"mv0_threshold", NULL, OFFSET(mv0_threshold), AV_OPT_TYPE_INT, {.dbl = 256 }, 0, INT_MAX, V|E}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_VLC }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"ivlc", "intra vlc table", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_VLC }, INT_MIN, INT_MAX, V|E, "flags2"}, #endif -{"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, {.dbl = 40 }, 1, INT_MAX, V|E}, -{"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, {.dbl = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, -{"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, +{"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), AV_OPT_TYPE_INT, {.dbl = 40 }, 1, INT_MAX, V|E}, +{"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.dbl = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E}, +{"min_prediction_order", NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, +{"max_prediction_order", NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, #if FF_API_FLAC_GLOBAL_OPTS -{"lpc_coeff_precision", "deprecated, use flac-specific options", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|E}, -{"prediction_order_method", "deprecated, use flac-specific options", OFFSET(prediction_order_method), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, -{"min_partition_order", "deprecated, use flac-specific options", OFFSET(min_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, -{"max_partition_order", "deprecated, use flac-specific options", OFFSET(max_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, +{"lpc_coeff_precision", "deprecated, use flac-specific options", OFFSET(lpc_coeff_precision), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|E}, +{"prediction_order_method", "deprecated, use flac-specific options", OFFSET(prediction_order_method), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, +{"min_partition_order", "deprecated, use flac-specific options", OFFSET(min_partition_order), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, +{"max_partition_order", "deprecated, use flac-specific options", OFFSET(max_partition_order), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, #endif -{"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, {.dbl = 0 }, 0, INT64_MAX, V|E}, +{"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.dbl = 0 }, 0, INT64_MAX, V|E}, #if FF_API_MPEGVIDEO_GLOBAL_OPTS -{"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_DROP_FRAME_TIMECODE }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NON_LINEAR_QUANT }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"drop_frame_timecode", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_DROP_FRAME_TIMECODE }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"non_linear_q", "use non linear quantizer", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NON_LINEAR_QUANT }, INT_MIN, INT_MAX, V|E, "flags2"}, #endif #if FF_API_REQUEST_CHANNELS -{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D}, +{"request_channels", "set desired number of audio channels", OFFSET(request_channels), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D}, #endif #if FF_API_DRC_SCALE -{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {.dbl = 0.0 }, 0.0, 1.0, A|D}, +{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 0.0 }, 0.0, 1.0, A|D}, #endif #if FF_API_LAME_GLOBAL_OPTS -{"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BIT_RESERVOIR }, INT_MIN, INT_MAX, A|E, "flags2"}, +{"reservoir", "use bit reservoir", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BIT_RESERVOIR }, INT_MIN, INT_MAX, A|E, "flags2"}, #endif #if FF_API_X264_GLOBAL_OPTS -{"mbtree", "use macroblock tree ratecontrol (x264 only)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MBTREE }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"mbtree", "use macroblock tree ratecontrol (x264 only)", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MBTREE }, INT_MIN, INT_MAX, V|E, "flags2"}, #endif -{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, -{"channel_layout", NULL, OFFSET(channel_layout), FF_OPT_TYPE_INT64, {.dbl = DEFAULT }, 0, INT64_MAX, A|E|D, "channel_layout"}, -{"request_channel_layout", NULL, OFFSET(request_channel_layout), FF_OPT_TYPE_INT64, {.dbl = DEFAULT }, 0, INT64_MAX, A|D, "request_channel_layout"}, -{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), FF_OPT_TYPE_FLOAT, {.dbl = 1.0/3 }, 0.0, FLT_MAX, V|E}, -{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), FF_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E}, -{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), FF_OPT_TYPE_INT, {.dbl = 1 }, 1, INT_MAX, A|V|E|D}, -{"color_primaries", NULL, OFFSET(color_primaries), FF_OPT_TYPE_INT, {.dbl = AVCOL_PRI_UNSPECIFIED }, 1, AVCOL_PRI_NB-1, V|E|D}, -{"color_trc", NULL, OFFSET(color_trc), FF_OPT_TYPE_INT, {.dbl = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, V|E|D}, -{"colorspace", NULL, OFFSET(colorspace), FF_OPT_TYPE_INT, {.dbl = AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D}, -{"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, {.dbl = AVCOL_RANGE_UNSPECIFIED }, 0, AVCOL_RANGE_NB-1, V|E|D}, -{"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, {.dbl = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, V|E|D}, +{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, +{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_INT64, {.dbl = DEFAULT }, 0, INT64_MAX, A|E|D, "channel_layout"}, +{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_INT64, {.dbl = DEFAULT }, 0, INT64_MAX, A|D, "request_channel_layout"}, +{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 1.0/3 }, 0.0, FLT_MAX, V|E}, +{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E}, +{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), AV_OPT_TYPE_INT, {.dbl = 1 }, 1, INT_MAX, A|V|E|D}, +{"color_primaries", NULL, OFFSET(color_primaries), AV_OPT_TYPE_INT, {.dbl = AVCOL_PRI_UNSPECIFIED }, 1, AVCOL_PRI_NB-1, V|E|D}, +{"color_trc", NULL, OFFSET(color_trc), AV_OPT_TYPE_INT, {.dbl = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, V|E|D}, +{"colorspace", NULL, OFFSET(colorspace), AV_OPT_TYPE_INT, {.dbl = AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D}, +{"color_range", NULL, OFFSET(color_range), AV_OPT_TYPE_INT, {.dbl = AVCOL_RANGE_UNSPECIFIED }, 0, AVCOL_RANGE_NB-1, V|E|D}, +{"chroma_sample_location", NULL, OFFSET(chroma_sample_location), AV_OPT_TYPE_INT, {.dbl = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, V|E|D}, #if FF_API_X264_GLOBAL_OPTS -{"psy", "use psycho visual optimization", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_PSY }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"psy_rd", "specify psycho visual strength", OFFSET(psy_rd), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E}, -{"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E}, -{"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, V|E}, -{"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E}, -{"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, {.dbl = 40 }, -1, INT_MAX, V|E}, -{"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SSIM }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_REFRESH }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E}, +{"psy", "use psycho visual optimization", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_PSY }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"psy_rd", "specify psycho visual strength", OFFSET(psy_rd), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E}, +{"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, V|E}, +{"aq_mode", "specify aq method", OFFSET(aq_mode), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, V|E}, +{"aq_strength", "specify aq strength", OFFSET(aq_strength), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1, FLT_MAX, V|E}, +{"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), AV_OPT_TYPE_INT, {.dbl = 40 }, -1, INT_MAX, V|E}, +{"ssim", "ssim will be calculated during encoding", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_SSIM }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_INTRA_REFRESH }, INT_MIN, INT_MAX, V|E, "flags2"}, +{"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, V|E}, #endif -{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX }, +{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX }, #if FF_API_FLAC_GLOBAL_OPTS -{"lpc_type", "deprecated, use flac-specific options", OFFSET(lpc_type), FF_OPT_TYPE_INT, {.dbl = AV_LPC_TYPE_DEFAULT }, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_NB-1, A|E}, -{"none", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_NONE }, INT_MIN, INT_MAX, A|E, "lpc_type"}, -{"fixed", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, A|E, "lpc_type"}, -{"levinson", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, A|E, "lpc_type"}, -{"cholesky", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_CHOLESKY }, INT_MIN, INT_MAX, A|E, "lpc_type"}, -{"lpc_passes", "deprecated, use flac-specific options", OFFSET(lpc_passes), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, +{"lpc_type", "deprecated, use flac-specific options", OFFSET(lpc_type), AV_OPT_TYPE_INT, {.dbl = AV_LPC_TYPE_DEFAULT }, AV_LPC_TYPE_DEFAULT, AV_LPC_TYPE_NB-1, A|E}, +{"none", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_NONE }, INT_MIN, INT_MAX, A|E, "lpc_type"}, +{"fixed", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, A|E, "lpc_type"}, +{"levinson", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, A|E, "lpc_type"}, +{"cholesky", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_LPC_TYPE_CHOLESKY }, INT_MIN, INT_MAX, A|E, "lpc_type"}, +{"lpc_passes", "deprecated, use flac-specific options", OFFSET(lpc_passes), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, #endif -{"slices", "number of slices, used in parallelized decoding", OFFSET(slices), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E}, -{"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_FLAGS, {.dbl = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|E|D, "thread_type"}, -{"slice", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, -{"frame", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_FRAME }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, -{"audio_service_type", "audio service type", OFFSET(audio_service_type), FF_OPT_TYPE_INT, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"}, -{"ma", "Main Audio Service", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"ef", "Effects", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_EFFECTS }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"vi", "Visually Impaired", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"hi", "Hearing Impaired", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"di", "Dialogue", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_DIALOGUE }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"co", "Commentary", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_COMMENTARY }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"em", "Emergency", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_EMERGENCY }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"vo", "Voice Over", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_VOICE_OVER }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"ka", "Karaoke", 0, FF_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_KARAOKE }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"request_sample_fmt", "sample format audio decoders should prefer", OFFSET(request_sample_fmt), FF_OPT_TYPE_INT, {.dbl = AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NB-1, A|D, "request_sample_fmt"}, -{"u8" , "8-bit unsigned integer", 0, FF_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_U8 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, -{"s16", "16-bit signed integer", 0, FF_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_S16 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, -{"s32", "32-bit signed integer", 0, FF_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_S32 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, -{"flt", "32-bit float", 0, FF_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_FLT }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, -{"dbl", "64-bit double", 0, FF_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_DBL }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, +{"slices", "number of slices, used in parallelized decoding", OFFSET(slices), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E}, +{"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.dbl = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|E|D, "thread_type"}, +{"slice", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, +{"frame", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_THREAD_FRAME }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, +{"audio_service_type", "audio service type", OFFSET(audio_service_type), AV_OPT_TYPE_INT, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"}, +{"ma", "Main Audio Service", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"ef", "Effects", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_EFFECTS }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"vi", "Visually Impaired", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"hi", "Hearing Impaired", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"di", "Dialogue", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_DIALOGUE }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"co", "Commentary", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_COMMENTARY }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"em", "Emergency", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_EMERGENCY }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"vo", "Voice Over", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_VOICE_OVER }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"ka", "Karaoke", 0, AV_OPT_TYPE_CONST, {.dbl = AV_AUDIO_SERVICE_TYPE_KARAOKE }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, +{"request_sample_fmt", "sample format audio decoders should prefer", OFFSET(request_sample_fmt), AV_OPT_TYPE_INT, {.dbl = AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NB-1, A|D, "request_sample_fmt"}, +{"u8" , "8-bit unsigned integer", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_U8 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, +{"s16", "16-bit signed integer", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_S16 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, +{"s32", "32-bit signed integer", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_S32 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, +{"flt", "32-bit float", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_FLT }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, +{"dbl", "64-bit double", 0, AV_OPT_TYPE_CONST, {.dbl = AV_SAMPLE_FMT_DBL }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"}, {NULL}, }; @@ -523,7 +528,8 @@ static const AVClass av_codec_context_class = { .option = options, .version = LIBAVUTIL_VERSION_INT, .log_level_offset_offset = OFFSET(log_level_offset), - .opt_find = opt_find, + .child_next = codec_child_next, + .child_class_next = codec_child_class_next, }; void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){ diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h index f215b15ffc..585edfdd65 100644 --- a/libavcodec/qdm2_tablegen.h +++ b/libavcodec/qdm2_tablegen.h @@ -90,7 +90,7 @@ static av_cold void rnd_table_init(void) { static av_cold void init_noise_samples(void) { int i; - int random_seed = 0; + unsigned random_seed = 0; float delta = 1.0 / 16384.0; for (i = 0; i < 128;i++) { random_seed = random_seed * 214013 + 2531011; diff --git a/libavcodec/rv30dsp.c b/libavcodec/rv30dsp.c index 0753ec837f..83439600ce 100644 --- a/libavcodec/rv30dsp.c +++ b/libavcodec/rv30dsp.c @@ -253,6 +253,9 @@ RV30_MC(avg_, 8) RV30_MC(avg_, 16) av_cold void ff_rv30dsp_init(RV34DSPContext *c, DSPContext* dsp) { + + ff_rv34dsp_init(c, dsp); + c->put_pixels_tab[0][ 0] = dsp->put_h264_qpel_pixels_tab[0][0]; c->put_pixels_tab[0][ 1] = put_rv30_tpel16_mc10_c; c->put_pixels_tab[0][ 2] = put_rv30_tpel16_mc20_c; diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index db9e07b4b9..7df6a61eb9 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -171,82 +171,6 @@ static av_cold void rv34_init_tables(void) /** @} */ // vlc group - -/** - * @name RV30/40 inverse transform functions - * @{ - */ - -static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block) -{ - int i; - - for(i = 0; i < 4; i++){ - const int z0 = 13*(block[i+8*0] + block[i+8*2]); - const int z1 = 13*(block[i+8*0] - block[i+8*2]); - const int z2 = 7* block[i+8*1] - 17*block[i+8*3]; - const int z3 = 17* block[i+8*1] + 7*block[i+8*3]; - - temp[4*i+0] = z0 + z3; - temp[4*i+1] = z1 + z2; - temp[4*i+2] = z1 - z2; - temp[4*i+3] = z0 - z3; - } -} - -/** - * Real Video 3.0/4.0 inverse transform - * Code is almost the same as in SVQ3, only scaling is different. - */ -static void rv34_inv_transform(DCTELEM *block){ - int temp[16]; - int i; - - rv34_row_transform(temp, block); - - for(i = 0; i < 4; i++){ - const int z0 = 13*(temp[4*0+i] + temp[4*2+i]) + 0x200; - const int z1 = 13*(temp[4*0+i] - temp[4*2+i]) + 0x200; - const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i]; - const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i]; - - block[i*8+0] = (z0 + z3) >> 10; - block[i*8+1] = (z1 + z2) >> 10; - block[i*8+2] = (z1 - z2) >> 10; - block[i*8+3] = (z0 - z3) >> 10; - } - -} - -/** - * RealVideo 3.0/4.0 inverse transform for DC block - * - * Code is almost the same as rv34_inv_transform() - * but final coefficients are multiplied by 1.5 and have no rounding. - */ -static void rv34_inv_transform_noround(DCTELEM *block){ - int temp[16]; - int i; - - rv34_row_transform(temp, block); - - for(i = 0; i < 4; i++){ - const int z0 = 13*(temp[4*0+i] + temp[4*2+i]); - const int z1 = 13*(temp[4*0+i] - temp[4*2+i]); - const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i]; - const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i]; - - block[i*8+0] = ((z0 + z3) * 3) >> 11; - block[i*8+1] = ((z1 + z2) * 3) >> 11; - block[i*8+2] = ((z1 - z2) * 3) >> 11; - block[i*8+3] = ((z0 - z3) * 3) >> 11; - } - -} - -/** @} */ // transform - - /** * @name RV30/40 4x4 block decoding functions * @{ @@ -1226,7 +1150,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types) memset(block16, 0, sizeof(block16)); rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0); rv34_dequant4x4_16x16(block16, rv34_qscale_tab[luma_dc_quant],rv34_qscale_tab[s->qscale]); - rv34_inv_transform_noround(block16); + r->rdsp.rv34_inv_transform_tab[1](block16); } for(i = 0; i < 16; i++, cbp >>= 1){ @@ -1238,7 +1162,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types) rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[s->qscale],rv34_qscale_tab[s->qscale]); if(r->is16) //FIXME: optimize s->block[blknum][blkoff] = block16[(i & 3) | ((i & 0xC) << 1)]; - rv34_inv_transform(s->block[blknum] + blkoff); + r->rdsp.rv34_inv_transform_tab[0](s->block[blknum] + blkoff); } if(r->block_type == RV34_MB_P_MIX16x16) r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1); @@ -1248,7 +1172,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types) blkoff = ((i & 1) << 2) + ((i & 2) << 4); rv34_decode_block(s->block[blknum] + blkoff, gb, r->cur_vlcs, r->chroma_vlc, 1); rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[rv34_chroma_quant[1][s->qscale]],rv34_qscale_tab[rv34_chroma_quant[0][s->qscale]]); - rv34_inv_transform(s->block[blknum] + blkoff); + r->rdsp.rv34_inv_transform_tab[0](s->block[blknum] + blkoff); } if (IS_INTRA(s->current_picture_ptr->f.mb_type[mb_pos])) rv34_output_macroblock(r, intra_types, cbp2, r->is16); diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c new file mode 100644 index 0000000000..59038a7a31 --- /dev/null +++ b/libavcodec/rv34dsp.c @@ -0,0 +1,106 @@ +/* + * RV30/40 decoder common dsp functions + * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov + * Copyright (c) 2011 Janne Grunau + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * RV30/40 decoder common dsp functions + */ +#include "dsputil.h" +#include "rv34dsp.h" + +/** + * @name RV30/40 inverse transform functions + * @{ + */ + +static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block) +{ + int i; + + for(i = 0; i < 4; i++){ + const int z0 = 13*(block[i+8*0] + block[i+8*2]); + const int z1 = 13*(block[i+8*0] - block[i+8*2]); + const int z2 = 7* block[i+8*1] - 17*block[i+8*3]; + const int z3 = 17* block[i+8*1] + 7*block[i+8*3]; + + temp[4*i+0] = z0 + z3; + temp[4*i+1] = z1 + z2; + temp[4*i+2] = z1 - z2; + temp[4*i+3] = z0 - z3; + } +} + +/** + * Real Video 3.0/4.0 inverse transform + * Code is almost the same as in SVQ3, only scaling is different. + */ +static void rv34_inv_transform_c(DCTELEM *block){ + int temp[16]; + int i; + + rv34_row_transform(temp, block); + + for(i = 0; i < 4; i++){ + const int z0 = 13*(temp[4*0+i] + temp[4*2+i]) + 0x200; + const int z1 = 13*(temp[4*0+i] - temp[4*2+i]) + 0x200; + const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i]; + const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i]; + + block[i*8+0] = (z0 + z3) >> 10; + block[i*8+1] = (z1 + z2) >> 10; + block[i*8+2] = (z1 - z2) >> 10; + block[i*8+3] = (z0 - z3) >> 10; + } +} + +/** + * RealVideo 3.0/4.0 inverse transform for DC block + * + * Code is almost the same as rv34_inv_transform() + * but final coefficients are multiplied by 1.5 and have no rounding. + */ +static void rv34_inv_transform_noround_c(DCTELEM *block){ + int temp[16]; + int i; + + rv34_row_transform(temp, block); + + for(i = 0; i < 4; i++){ + const int z0 = 13*(temp[4*0+i] + temp[4*2+i]); + const int z1 = 13*(temp[4*0+i] - temp[4*2+i]); + const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i]; + const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i]; + + block[i*8+0] = ((z0 + z3) * 3) >> 11; + block[i*8+1] = ((z1 + z2) * 3) >> 11; + block[i*8+2] = ((z1 - z2) * 3) >> 11; + block[i*8+3] = ((z0 - z3) * 3) >> 11; + } +} + +/** @} */ // transform + + +av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) { + c->rv34_inv_transform_tab[0] = rv34_inv_transform_c; + c->rv34_inv_transform_tab[1] = rv34_inv_transform_noround_c; +} diff --git a/libavcodec/rv34dsp.h b/libavcodec/rv34dsp.h index e1def7dc26..a2ab5f232b 100644 --- a/libavcodec/rv34dsp.h +++ b/libavcodec/rv34dsp.h @@ -34,15 +34,19 @@ typedef void (*rv40_weight_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src2/*align width (8 or 16)*/, int w1, int w2, int stride); +typedef void (*rv34_inv_transform_func)(DCTELEM *block); + typedef struct RV34DSPContext { qpel_mc_func put_pixels_tab[4][16]; 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]; + rv34_inv_transform_func rv34_inv_transform_tab[2]; } RV34DSPContext; void ff_rv30dsp_init(RV34DSPContext *c, DSPContext* dsp); +void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp); void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp); void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp); diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c index 625ce9ebbd..b879643ba1 100644 --- a/libavcodec/rv40dsp.c +++ b/libavcodec/rv40dsp.c @@ -295,6 +295,9 @@ RV40_WEIGHT_FUNC(16) RV40_WEIGHT_FUNC(8) av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) { + + ff_rv34dsp_init(c, dsp); + c->put_pixels_tab[0][ 0] = dsp->put_h264_qpel_pixels_tab[0][0]; c->put_pixels_tab[0][ 1] = put_rv40_qpel16_mc10_c; c->put_pixels_tab[0][ 2] = dsp->put_h264_qpel_pixels_tab[0][2]; diff --git a/libavcodec/snow.c b/libavcodec/snow.c index b866c8f8d8..c22a910a59 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -3682,7 +3682,7 @@ static av_cold int encode_end(AVCodecContext *avctx) #define OFFSET(x) offsetof(SnowContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "memc_only", "Only do ME/MC (I frames -> ref, P frame -> ME+MC).", OFFSET(memc_only), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "memc_only", "Only do ME/MC (I frames -> ref, P frame -> ME+MC).", OFFSET(memc_only), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE }, { NULL }, }; diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 21901fad70..209d825057 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -30,7 +30,7 @@ /** Markers used in VC-1 AP frame data */ //@{ -enum VC1Code{ +enum VC1Code { VC1_CODE_RES0 = 0x00000100, VC1_CODE_ENDOFSEQ = 0x0000010A, VC1_CODE_SLICE, @@ -133,10 +133,10 @@ enum TransformTypes { TT_8X8, TT_8X4_BOTTOM, TT_8X4_TOP, - TT_8X4, //Both halves + TT_8X4, // both halves TT_4X8_RIGHT, TT_4X8_LEFT, - TT_4X8, //Both halves + TT_4X8, // both halves TT_4X4 }; //@} @@ -224,16 +224,16 @@ typedef struct VC1Context{ /** Frame decoding info for all profiles */ //@{ - uint8_t mv_mode; ///< MV coding monde - uint8_t mv_mode2; ///< Secondary MV coding mode (B frames) - int k_x; ///< Number of bits for MVs (depends on MV range) - int k_y; ///< Number of bits for MVs (depends on MV range) - int range_x, range_y; ///< MV range - uint8_t pq, altpq; ///< Current/alternate frame quantizer scale - uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT + uint8_t mv_mode; ///< MV coding monde + uint8_t mv_mode2; ///< Secondary MV coding mode (B frames) + int k_x; ///< Number of bits for MVs (depends on MV range) + int k_y; ///< Number of bits for MVs (depends on MV range) + int range_x, range_y; ///< MV range + uint8_t pq, altpq; ///< Current/alternate frame quantizer scale + uint8_t zz_8x8[4][64]; ///< Zigzag table for TT_8x8, permuted for IDCT int left_blk_sh, top_blk_sh; ///< Either 3 or 0, positions of l/t in blk[] - const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode - const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode + const uint8_t* zz_8x4; ///< Zigzag scan table for TT_8x4 coding mode + const uint8_t* zz_4x8; ///< Zigzag scan table for TT_4x8 coding mode /** pquant parameters */ //@{ uint8_t dquantfrm; @@ -245,15 +245,15 @@ typedef struct VC1Context{ * @see 8.1.1.10, p(1)10 */ //@{ - int c_ac_table_index; ///< Chroma index from ACFRM element - int y_ac_table_index; ///< Luma index from AC2FRM element + int c_ac_table_index; ///< Chroma index from ACFRM element + int y_ac_table_index; ///< Luma index from AC2FRM element //@} - int ttfrm; ///< Transform type info present at frame level - uint8_t ttmbf; ///< Transform type flag + int ttfrm; ///< Transform type info present at frame level + uint8_t ttmbf; ///< Transform type flag int *ttblk_base, *ttblk; ///< Transform type at the block level - int codingset; ///< index of current table set from 11.8 to use for luma block decoding - int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding - int pqindex; ///< raw pqindex used in coding set selection + int codingset; ///< index of current table set from 11.8 to use for luma block decoding + int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding + int pqindex; ///< raw pqindex used in coding set selection int a_avail, c_avail; uint8_t *mb_type_base, *mb_type[3]; @@ -273,24 +273,24 @@ typedef struct VC1Context{ * -# 2 -> [-512, 511.f] x [-128, 127.f] * -# 3 -> [-1024, 1023.f] x [-256, 255.f] */ - uint8_t mvrange; ///< Extended MV range flag - uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use - VLC *cbpcy_vlc; ///< CBPCY VLC table - int tt_index; ///< Index for Transform Type tables (to decode TTMB) - uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) - uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs - uint8_t* forward_mb_plane; ///< bitplane for "forward" MBs - int mv_type_is_raw; ///< mv type mb plane is not coded - int dmb_is_raw; ///< direct mb plane is raw - int fmb_is_raw; ///< forward mb plane is raw - int skip_is_raw; ///< skip mb plane is not coded - uint8_t luty[256], lutuv[256];///< lookup tables used for intensity compensation - int use_ic; ///< use intensity compensation in B-frames - int rnd; ///< rounding control + uint8_t mvrange; ///< Extended MV range flag + uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use + VLC *cbpcy_vlc; ///< CBPCY VLC table + int tt_index; ///< Index for Transform Type tables (to decode TTMB) + uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) + uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs + uint8_t* forward_mb_plane; ///< bitplane for "forward" MBs + int mv_type_is_raw; ///< mv type mb plane is not coded + int dmb_is_raw; ///< direct mb plane is raw + int fmb_is_raw; ///< forward mb plane is raw + int skip_is_raw; ///< skip mb plane is not coded + uint8_t luty[256], lutuv[256]; ///< lookup tables used for intensity compensation + int use_ic; ///< use intensity compensation in B-frames + int rnd; ///< rounding control /** Frame decoding info for S/M profiles only */ //@{ - uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128) + uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128) uint8_t interpfrm; //@} @@ -342,22 +342,22 @@ typedef struct VC1Context{ uint8_t *mv_f_base, *mv_f[2]; ///< 0: MV obtained from same field, 1: opposite field uint8_t *mv_f_last_base, *mv_f_last[2]; uint8_t *mv_f_next_base, *mv_f_next[2]; - int field_mode; ///< 1 for interlaced field pictures + int field_mode; ///< 1 for interlaced field pictures int fptype; int second_field; - int refdist; ///< distance of the current picture from reference - int numref; ///< number of past field pictures used as reference - // 0 corresponds to 1 and 1 corresponds to 2 references - int reffield; ///< if numref = 0 (1 reference) then reffield decides which - // field to use among the two fields from previous frame - int intcompfield; ///< which of the two fields to be intensity compensated - // 0: both fields, 1: bottom field, 2: top field + int refdist; ///< distance of the current picture from reference + int numref; ///< number of past field pictures used as reference + // 0 corresponds to 1 and 1 corresponds to 2 references + int reffield; ///< if numref = 0 (1 reference) then reffield decides which + // field to use among the two fields from previous frame + int intcompfield; ///< which of the two fields to be intensity compensated + // 0: both fields, 1: bottom field, 2: top field int cur_field_type; ///< 0: top, 1: bottom int ref_field_type[2]; ///< forward and backward reference field type (top or bottom) int blocks_off, mb_off; - int qs_last; ///< if qpel has been used in the previous (tr.) picture + int qs_last; ///< if qpel has been used in the previous (tr.) picture int bmvtype; - int frfd, brfd; ///< reference frame distance (forward or backward) + int frfd, brfd; ///< reference frame distance (forward or backward) int pic_header_flag; /** Frame decoding info for sprite modes */ @@ -378,11 +378,11 @@ typedef struct VC1Context{ uint32_t *cbp_base, *cbp; uint8_t *is_intra_base, *is_intra; int16_t (*luma_mv_base)[2], (*luma_mv)[2]; - uint8_t bfraction_lut_index;///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[]) - uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element) - uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element) + uint8_t bfraction_lut_index; ///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[]) + uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element) + uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element) - int parse_only; ///< Context is used within parser + int parse_only; ///< Context is used within parser int warn_interlaced; } VC1Context; @@ -394,11 +394,12 @@ static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, cons { uint32_t mrk = 0xFFFFFFFF; - if(end-src < 4) return end; - while(src < end){ + if (end-src < 4) + return end; + while (src < end) { mrk = (mrk << 8) | *src++; - if(IS_MARKER(mrk)) - return src-4; + if (IS_MARKER(mrk)) + return src - 4; } return end; } @@ -407,12 +408,13 @@ static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, ui { int dsize = 0, i; - if(size < 4){ - for(dsize = 0; dsize < size; dsize++) *dst++ = *src++; + if (size < 4) { + for (dsize = 0; dsize < size; dsize++) + *dst++ = *src++; return size; } - for(i = 0; i < size; i++, src++) { - if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { + for (i = 0; i < size; i++, src++) { + if (src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { dst[dsize++] = src[1]; src++; i++; diff --git a/libavcodec/vc1data.c b/libavcodec/vc1data.c index 321224bbba..7f979ba109 100644 --- a/libavcodec/vc1data.c +++ b/libavcodec/vc1data.c @@ -32,21 +32,21 @@ /** Table for conversion between TTBLK and TTMB */ const int ff_vc1_ttblk_to_tt[3][8] = { - { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT }, - { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP }, - { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP } + { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT }, + { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP }, + { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP } }; const int ff_vc1_ttfrm_to_tt[4] = { TT_8X8, TT_8X4, TT_4X8, TT_4X4 }; /** MV P mode - the 5th element is only used for mode 1 */ const uint8_t ff_vc1_mv_pmode_table[2][5] = { - { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV }, - { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN } + { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV }, + { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN } }; const uint8_t ff_vc1_mv_pmode_table2[2][4] = { - { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV }, - { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN } + { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV }, + { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN } }; /* MBMODE table for interlaced frame P-picture */ @@ -54,50 +54,48 @@ const uint8_t ff_vc1_mbmode_intfrp[2][15][4] = { { /* 1: 4-MV, 0: non-4-MV */ /* Type, FIELDTX, 1-MV Differential present, Residuals (CBP) present */ /* Table 164 - Table 167 */ - { MV_PMODE_INTFR_1MV , 0, 1, 1}, - { MV_PMODE_INTFR_1MV , 1, 1, 1}, - { MV_PMODE_INTFR_1MV , 0, 1, 0}, - { MV_PMODE_INTFR_1MV , 0, 0, 1}, - { MV_PMODE_INTFR_1MV , 1, 0, 1}, - { MV_PMODE_INTFR_2MV_FIELD , 0, 0, 1}, - { MV_PMODE_INTFR_2MV_FIELD , 1, 0, 1}, - { MV_PMODE_INTFR_2MV_FIELD , 0, 0, 0}, - { MV_PMODE_INTFR_INTRA , 0, 0, 0} }, + { MV_PMODE_INTFR_1MV , 0, 1, 1 }, + { MV_PMODE_INTFR_1MV , 1, 1, 1 }, + { MV_PMODE_INTFR_1MV , 0, 1, 0 }, + { MV_PMODE_INTFR_1MV , 0, 0, 1 }, + { MV_PMODE_INTFR_1MV , 1, 0, 1 }, + { MV_PMODE_INTFR_2MV_FIELD, 0, 0, 1 }, + { MV_PMODE_INTFR_2MV_FIELD, 1, 0, 1 }, + { MV_PMODE_INTFR_2MV_FIELD, 0, 0, 0 }, + { MV_PMODE_INTFR_INTRA , 0, 0, 0 } + }, { /* Table 160 - Table 163 */ - { MV_PMODE_INTFR_1MV , 0, 1, 1 }, - { MV_PMODE_INTFR_1MV , 1, 1, 1 }, - { MV_PMODE_INTFR_1MV , 0, 1, 0 }, - { MV_PMODE_INTFR_1MV , 0, 0, 1 }, - { MV_PMODE_INTFR_1MV , 1, 0, 1 }, - { MV_PMODE_INTFR_2MV_FIELD , 0, 0, 1 }, - { MV_PMODE_INTFR_2MV_FIELD , 1, 0, 1 }, - { MV_PMODE_INTFR_2MV_FIELD , 0, 0, 0 }, - { MV_PMODE_INTFR_4MV , 0, 0, 1 }, - { MV_PMODE_INTFR_4MV , 1, 0, 1 }, - { MV_PMODE_INTFR_4MV , 0, 0, 0 }, - { MV_PMODE_INTFR_4MV_FIELD , 0, 0, 1 }, - { MV_PMODE_INTFR_4MV_FIELD , 1, 0, 1 }, - { MV_PMODE_INTFR_4MV_FIELD , 0, 0, 0 }, - { MV_PMODE_INTFR_INTRA , 0, 0, 0 } + { MV_PMODE_INTFR_1MV , 0, 1, 1 }, + { MV_PMODE_INTFR_1MV , 1, 1, 1 }, + { MV_PMODE_INTFR_1MV , 0, 1, 0 }, + { MV_PMODE_INTFR_1MV , 0, 0, 1 }, + { MV_PMODE_INTFR_1MV , 1, 0, 1 }, + { MV_PMODE_INTFR_2MV_FIELD, 0, 0, 1 }, + { MV_PMODE_INTFR_2MV_FIELD, 1, 0, 1 }, + { MV_PMODE_INTFR_2MV_FIELD, 0, 0, 0 }, + { MV_PMODE_INTFR_4MV , 0, 0, 1 }, + { MV_PMODE_INTFR_4MV , 1, 0, 1 }, + { MV_PMODE_INTFR_4MV , 0, 0, 0 }, + { MV_PMODE_INTFR_4MV_FIELD, 0, 0, 1 }, + { MV_PMODE_INTFR_4MV_FIELD, 1, 0, 1 }, + { MV_PMODE_INTFR_4MV_FIELD, 0, 0, 0 }, + { MV_PMODE_INTFR_INTRA , 0, 0, 0 } } }; const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 }, - ff_vc1_fps_dr[2] = { 1000, 1001 }; + ff_vc1_fps_dr[2] = { 1000, 1001 }; const uint8_t ff_vc1_pquant_table[3][32] = { - { /* Implicit quantizer */ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31 - }, - { /* Explicit quantizer, pquantizer uniform */ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 - }, - { /* Explicit quantizer, pquantizer non-uniform */ - 0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31 - } + /* Implicit quantizer */ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31 }, + /* Explicit quantizer, pquantizer uniform */ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, + /* Explicit quantizer, pquantizer non-uniform */ + { 0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 31 } }; /** @name VC-1 VLC tables and defines @@ -149,27 +147,27 @@ VLC ff_vc1_ac_coeff_table[8]; //@} -#if B_FRACTION_DEN==840 //original bfraction from vc9data.h, not conforming to standard +#if B_FRACTION_DEN == 840 // original bfraction from vc9data.h, not conforming to standard /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */ const int16_t ff_vc1_bfraction_lut[23] = { - 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/, - 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/, - 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/, - 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/, - 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/, - 525 /*5/8*/, 735 /*7/8*/, - -1 /*inv.*/, 0 /*BI fm*/ + 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/, + 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/, + 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/, + 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/, + 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/, + 525 /*5/8*/, 735 /*7/8*/, + -1 /*inv.*/, 0 /*BI fm*/ }; #else /* pre-computed scales for all bfractions and base=256 */ const int16_t ff_vc1_bfraction_lut[23] = { - 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/, - 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/, - 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/, - 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/, - 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/, - 160 /*5/8*/, 224 /*7/8*/, - -1 /*inv.*/, 0 /*BI fm*/ + 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/, + 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/, + 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/, + 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/, + 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/, + 160 /*5/8*/, 224 /*7/8*/, + -1 /*inv.*/, 0 /*BI fm*/ }; #endif @@ -183,348 +181,473 @@ const uint8_t ff_vc1_bfraction_bits[23] = { 7, 7 }; const uint8_t ff_vc1_bfraction_codes[23] = { - 0, 1, 2, 3, - 4, 5, 6, - 112, 113, 114, 115, - 116, 117, 118, 119, - 120, 121, 122, 123, - 124, 125, - 126, 127 + 0, 1, 2, 3, + 4, 5, 6, + 112, 113, 114, 115, + 116, 117, 118, 119, + 120, 121, 122, 123, + 124, 125, + 126, 127 }; //Same as H.264 -const AVRational ff_vc1_pixel_aspect[16]={ - {0, 1}, - {1, 1}, - {12, 11}, - {10, 11}, - {16, 11}, - {40, 33}, - {24, 11}, - {20, 11}, - {32, 11}, - {80, 33}, - {18, 11}, - {15, 11}, - {64, 33}, - {160, 99}, - {0, 1}, - {0, 1} +const AVRational ff_vc1_pixel_aspect[16] = { + { 0, 1 }, + { 1, 1 }, + { 12, 11 }, + { 10, 11 }, + { 16, 11 }, + { 40, 33 }, + { 24, 11 }, + { 20, 11 }, + { 32, 11 }, + { 80, 33 }, + { 18, 11 }, + { 15, 11 }, + { 64, 33 }, + { 160, 99 }, + { 0, 1 }, + { 0, 1 } }; /* BitPlane IMODE - such a small table... */ const uint8_t ff_vc1_imode_codes[7] = { - 0, 2, 1, 3, 1, 2, 3 + 0, 2, 1, 3, 1, 2, 3 }; const uint8_t ff_vc1_imode_bits[7] = { - 4, 2, 3, 2, 4, 3, 3 + 4, 2, 3, 2, 4, 3, 3 }; /* Normal-2 imode */ const uint8_t ff_vc1_norm2_codes[4] = { - 0, 4, 5, 3 + 0, 4, 5, 3 }; const uint8_t ff_vc1_norm2_bits[4] = { - 1, 3, 3, 2 + 1, 3, 3, 2 }; const uint16_t ff_vc1_norm6_codes[64] = { -0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E, -0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037, -0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036, -0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007, + 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E, + 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037, + 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036, + 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007, }; const uint8_t ff_vc1_norm6_bits[64] = { - 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13, - 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, - 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, - 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6, + 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13, + 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, + 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, + 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6, }; /* 4MV Block pattern VLC tables */ const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = { - { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2}, - { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0}, - { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0}, - { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10} + { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2 }, + { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0 }, + { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0 }, + { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10 } }; const uint8_t ff_vc1_4mv_block_pattern_bits[4][16] = { - { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2}, - { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2}, - { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3}, - { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4} + { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2 }, + { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2 }, + { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3 }, + { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4 } }; /* 2MV Block pattern VLC tables */ const uint8_t ff_vc1_2mv_block_pattern_codes[4][4] = { - { 2, 1, 0, 3}, { 1, 0, 2, 3}, { 2, 0, 3, 1}, { 1, 3, 2, 0} + { 2, 1, 0, 3 }, { 1, 0, 2, 3 }, { 2, 0, 3, 1 }, { 1, 3, 2, 0 } }; const uint8_t ff_vc1_2mv_block_pattern_bits[4][4] = { - { 2, 2, 2, 2}, { 1, 2, 3, 3}, { 3, 2, 3, 1}, { 1, 3, 3, 2} + { 2, 2, 2, 2 }, { 1, 2, 3, 3 }, { 3, 2, 3, 1 }, { 1, 3, 3, 2 } }; /* Interlaced frame picture 4MV MBMODE VLC tables (p. 246, p. 360) */ const uint16_t ff_vc1_intfr_4mv_mbmode_codes[4][15] = { - { 22, 17, 0, 47, 32, 10, 1, 3, 67, 133, 132, 92, 19, 93, 18}, - { 3, 45, 0, 7, 23, 6, 1, 2, 10, 39, 44, 8, 18, 77, 76}, - { 15, 6, 28, 9, 41, 6, 2, 15, 14, 8, 40, 29, 0, 21, 11}, - { 7, 198, 1, 2, 193, 13, 25, 0, 97, 1599, 98, 398, 798, 192, 1598} + { 22, 17, 0, 47, 32, 10, 1, 3, 67, 133, 132, 92, 19, 93, 18 }, + { 3, 45, 0, 7, 23, 6, 1, 2, 10, 39, 44, 8, 18, 77, 76 }, + { 15, 6, 28, 9, 41, 6, 2, 15, 14, 8, 40, 29, 0, 21, 11 }, + { 7, 198, 1, 2, 193, 13, 25, 0, 97, 1599, 98, 398, 798, 192, 1598 } }; const uint8_t ff_vc1_intfr_4mv_mbmode_bits[4][15] = { - { 5, 5, 2, 6, 6, 4, 2, 2, 7, 8, 8, 7, 5, 7, 5}, - { 3, 6, 3, 3, 5, 3, 3, 3, 4, 6, 6, 4, 5, 7, 7}, - { 4, 3, 5, 5, 7, 4, 2, 5, 5, 5, 7, 5, 2, 6, 5}, - { 4, 9, 1, 3, 9, 5, 6, 2, 8, 12, 8, 10, 11, 9, 12} + { 5, 5, 2, 6, 6, 4, 2, 2, 7, 8, 8, 7, 5, 7, 5 }, + { 3, 6, 3, 3, 5, 3, 3, 3, 4, 6, 6, 4, 5, 7, 7 }, + { 4, 3, 5, 5, 7, 4, 2, 5, 5, 5, 7, 5, 2, 6, 5 }, + { 4, 9, 1, 3, 9, 5, 6, 2, 8, 12, 8, 10, 11, 9, 12 } }; /* Interlaced frame picture NON-4MV MBMODE VLC tables (p. 363) */ const uint8_t ff_vc1_intfr_non4mv_mbmode_codes[4][9] = { - { 9, 22, 0, 17, 16, 10, 1, 3, 23}, - { 7, 0, 5, 2, 1, 1, 6, 3, 4}, - { 1, 0, 10, 23, 44, 8, 3, 9, 45}, - { 7, 97, 1, 2, 49, 13, 25, 0, 96} + { 9, 22, 0, 17, 16, 10, 1, 3, 23 }, + { 7, 0, 5, 2, 1, 1, 6, 3, 4 }, + { 1, 0, 10, 23, 44, 8, 3, 9, 45 }, + { 7, 97, 1, 2, 49, 13, 25, 0, 96 } }; const uint8_t ff_vc1_intfr_non4mv_mbmode_bits[4][9] = { - { 4, 5, 2, 5, 5, 4, 2, 2, 5}, - { 3, 4, 6, 2, 3, 2, 3, 5, 6}, - { 2, 2, 4, 5, 6, 4, 2, 4, 6}, - { 4, 8, 1, 3, 7, 5, 6, 2, 8} + { 4, 5, 2, 5, 5, 4, 2, 2, 5 }, + { 3, 4, 6, 2, 3, 2, 3, 5, 6 }, + { 2, 2, 4, 5, 6, 4, 2, 4, 6 }, + { 4, 8, 1, 3, 7, 5, 6, 2, 8 } }; /* Interlaced field picture MBMODE VLC tables (p. 356 - 11.4.1, 11.4.2) */ /* mixed-MV */ const uint8_t ff_vc1_if_mmv_mbmode_codes[8][8] = { - { 16, 17, 3, 3, 0, 5, 9, 2 }, - { 8, 9, 3, 6, 7, 0, 5, 2 }, - { 16, 17, 5, 3, 0, 3, 9, 2 }, - { 56, 57, 15, 4, 5, 6, 29, 0 }, - { 52, 53, 27, 14, 15, 2, 12, 0 }, - { 56, 57, 29, 5, 6, 0, 15, 4 }, - { 16, 17, 6, 7, 0, 1, 9, 5 }, - { 56, 57, 0, 5, 6, 29, 4, 15 } + { 16, 17, 3, 3, 0, 5, 9, 2 }, + { 8, 9, 3, 6, 7, 0, 5, 2 }, + { 16, 17, 5, 3, 0, 3, 9, 2 }, + { 56, 57, 15, 4, 5, 6, 29, 0 }, + { 52, 53, 27, 14, 15, 2, 12, 0 }, + { 56, 57, 29, 5, 6, 0, 15, 4 }, + { 16, 17, 6, 7, 0, 1, 9, 5 }, + { 56, 57, 0, 5, 6, 29, 4, 15 } }; const uint8_t ff_vc1_if_mmv_mbmode_bits[8][8] = { - { 6, 6, 2, 3, 2, 4, 5, 2 }, - { 5, 5, 3, 3, 3, 2, 4, 2 }, - { 6, 6, 4, 3, 2, 2, 5, 2 }, - { 6, 6, 4, 3, 3, 3, 5, 1 }, - { 6, 6, 5, 4, 4, 2, 4, 1 }, - { 6, 6, 5, 3, 3, 1, 4, 3 }, - { 5, 5, 3, 3, 2, 2, 4, 3 }, - { 6, 6, 1, 3, 3, 5, 3, 4 } + { 6, 6, 2, 3, 2, 4, 5, 2 }, + { 5, 5, 3, 3, 3, 2, 4, 2 }, + { 6, 6, 4, 3, 2, 2, 5, 2 }, + { 6, 6, 4, 3, 3, 3, 5, 1 }, + { 6, 6, 5, 4, 4, 2, 4, 1 }, + { 6, 6, 5, 3, 3, 1, 4, 3 }, + { 5, 5, 3, 3, 2, 2, 4, 3 }, + { 6, 6, 1, 3, 3, 5, 3, 4 } }; /* 1MV */ const uint8_t ff_vc1_if_1mv_mbmode_codes[8][6] = { - { 0, 1, 1, 1, 1, 1 }, - { 0, 1, 1, 1, 1, 1 }, - { 16, 17, 3, 0, 9, 5 }, - { 20, 21, 3, 11, 0, 4 }, - { 4, 5, 2, 3, 3, 0 }, - { 4, 5, 3, 2, 0, 3 }, - { 0, 1, 1, 1, 1, 1 }, - { 16, 17, 9, 5, 3, 0 } + { 0, 1, 1, 1, 1, 1 }, + { 0, 1, 1, 1, 1, 1 }, + { 16, 17, 3, 0, 9, 5 }, + { 20, 21, 3, 11, 0, 4 }, + { 4, 5, 2, 3, 3, 0 }, + { 4, 5, 3, 2, 0, 3 }, + { 0, 1, 1, 1, 1, 1 }, + { 16, 17, 9, 5, 3, 0 } }; const uint8_t ff_vc1_if_1mv_mbmode_bits[8][6] = { - { 5, 5, 1, 3, 2, 4 }, - { 5, 5, 1, 2, 3, 4 }, - { 5, 5, 2, 1, 4, 3 }, - { 5, 5, 2, 4, 1, 3 }, - { 4, 4, 2, 3, 2, 2 }, - { 4, 4, 3, 2, 2, 2 }, - { 5, 5, 3, 4, 1, 2 }, - { 5, 5, 4, 3, 2, 1 } + { 5, 5, 1, 3, 2, 4 }, + { 5, 5, 1, 2, 3, 4 }, + { 5, 5, 2, 1, 4, 3 }, + { 5, 5, 2, 4, 1, 3 }, + { 4, 4, 2, 3, 2, 2 }, + { 4, 4, 3, 2, 2, 2 }, + { 5, 5, 3, 4, 1, 2 }, + { 5, 5, 4, 3, 2, 1 } }; /* Interlaced frame/field picture MVDATA VLC tables */ /* 1-reference tables */ const uint32_t ff_vc1_1ref_mvdata_codes[4][72] = { /* uint32_t may be too big */ - {5, 12, 30, 18, 12, 52, 117, 112, 0, 8, 27, 8, 29, 124, 214, 478, 431, 5, 27, 38, 30, 18, 118, 77, - 502, 500, 57, 127, 39, 106, 113, 53, 113, 104, 476, 39, 115, 255, 232, 233, 126, 505, 501, 509, 62, 458, 1017, 76, - 105, 506, 479, 503, 112, 477, 3661, 1831, 914, 456, 459, 1016, 430, 504, 507, 58574, 58575, 29280, 29281, 29282, 29283, 29284, 29285, 29286}, - {7, 1, 7, 22, 1, 69, 24, 694, 6, 4, 23, 16, 41, 44, 346, 102, 414, 9, 40, 23, 0, 42, 4, 91, - 181, 206, 6, 68, 15, 70, 14, 172, 50, 55, 4587, 10, 26, 287, 22, 20, 43, 360, 85, 9173, 87, 47, 54, 46, - 361, 84, 1147, 415, 11133, 142, 2782, 1145, 1390, 2292, 5567, 1144, 9172, 44529, 22265, 712462, 712463, 356224, 356225, 356226, 356227, 356228, 356229, 356230}, - {2, 6, 7, 13, 7, 48, 255, 496, 2, 0, 5, 25, 30, 7, 99, 253, 35, 14, 27, 26, 6, 9, 24, 197, - 51, 497, 2, 1019, 499, 34, 508, 66, 1571, 131, 1568, 125, 64, 67, 996, 997, 401, 4073, 261, 520, 252, 1572, 1570, 400, - 1574, 2037, 3147, 8144, 4173, 101, 3138, 201, 1575, 3139, 3146, 4174, 8145, 4175, 1042, 66766, 66767, 33376, 33377, 33378, 33379, 33380, 33381, 33382}, - {13, 1, 4, 0, 23, 5, 127, 77, 3, 17, 62, 59, 23, 103, 74, 195, 242, 10, 44, 50, 61, 21, 40, 147, - 204, 150, 3, 117, 32, 45, 33, 41, 144, 464, 507, 28, 76, 96, 9, 8, 45, 159, 506, 317, 49, 252, 88, 146, - 240, 241, 205, 389, 357, 78, 145, 233, 388, 465, 486, 151, 487, 179, 316, 5710, 5711, 2848, 2849, 2850, 2851, 2852, 2853, 2854} + { + 0x00005, 0x0000C, 0x0001E, 0x00012, 0x0000C, 0x00034, 0x00075, 0x00070, + 0x00000, 0x00008, 0x0001B, 0x00008, 0x0001D, 0x0007C, 0x000D6, 0x001DE, + 0x001AF, 0x00005, 0x0001B, 0x00026, 0x0001E, 0x00012, 0x00076, 0x0004D, + 0x001F6, 0x001F4, 0x00039, 0x0007F, 0x00027, 0x0006A, 0x00071, 0x00035, + 0x00071, 0x00068, 0x001DC, 0x00027, 0x00073, 0x000FF, 0x000E8, 0x000E9, + 0x0007E, 0x001F9, 0x001F5, 0x001FD, 0x0003E, 0x001CA, 0x003F9, 0x0004C, + 0x00069, 0x001FA, 0x001DF, 0x001F7, 0x00070, 0x001DD, 0x00E4D, 0x00727, + 0x00392, 0x001C8, 0x001CB, 0x003F8, 0x001AE, 0x001F8, 0x001FB, 0x0E4CE, + 0x0E4CF, 0x07260, 0x07261, 0x07262, 0x07263, 0x07264, 0x07265, 0x07266 + }, + { + 0x00007, 0x00001, 0x00007, 0x00016, 0x00001, 0x00045, 0x00018, 0x002B6, + 0x00006, 0x00004, 0x00017, 0x00010, 0x00029, 0x0002C, 0x0015A, 0x00066, + 0x0019E, 0x00009, 0x00028, 0x00017, 0x00000, 0x0002A, 0x00004, 0x0005B, + 0x000B5, 0x000CE, 0x00006, 0x00044, 0x0000F, 0x00046, 0x0000E, 0x000AC, + 0x00032, 0x00037, 0x011EB, 0x0000A, 0x0001A, 0x0011F, 0x00016, 0x00014, + 0x0002B, 0x00168, 0x00055, 0x023D5, 0x00057, 0x0002F, 0x00036, 0x0002E, + 0x00169, 0x00054, 0x0047B, 0x0019F, 0x02B7D, 0x0008E, 0x00ADE, 0x00479, + 0x0056E, 0x008F4, 0x015BF, 0x00478, 0x023D4, 0x0ADF1, 0x056F9, 0xADF0E, + 0xADF0F, 0x56F80, 0x56F81, 0x56F82, 0x56F83, 0x56F84, 0x56F85, 0x56F86 + }, + { + 0x00002, 0x00006, 0x00007, 0x0000D, 0x00007, 0x00030, 0x000FF, 0x001F0, + 0x00002, 0x00000, 0x00005, 0x00019, 0x0001E, 0x00007, 0x00063, 0x000FD, + 0x00023, 0x0000E, 0x0001B, 0x0001A, 0x00006, 0x00009, 0x00018, 0x000C5, + 0x00033, 0x001F1, 0x00002, 0x003FB, 0x001F3, 0x00022, 0x001FC, 0x00042, + 0x00623, 0x00083, 0x00620, 0x0007D, 0x00040, 0x00043, 0x003E4, 0x003E5, + 0x00191, 0x00FE9, 0x00105, 0x00208, 0x000FC, 0x00624, 0x00622, 0x00190, + 0x00626, 0x007F5, 0x00C4B, 0x01FD0, 0x0104D, 0x00065, 0x00C42, 0x000C9, + 0x00627, 0x00C43, 0x00C4A, 0x0104E, 0x01FD1, 0x0104F, 0x00412, 0x104CE, + 0x104CF, 0x08260, 0x08261, 0x08262, 0x08263, 0x08264, 0x08265, 0x08266 + }, + { + 0x0000D, 0x00001, 0x00004, 0x00000, 0x00017, 0x00005, 0x0007F, 0x0004D, + 0x00003, 0x00011, 0x0003E, 0x0003B, 0x00017, 0x00067, 0x0004A, 0x000C3, + 0x000F2, 0x0000A, 0x0002C, 0x00032, 0x0003D, 0x00015, 0x00028, 0x00093, + 0x000CC, 0x00096, 0x00003, 0x00075, 0x00020, 0x0002D, 0x00021, 0x00029, + 0x00090, 0x001D0, 0x001FB, 0x0001C, 0x0004C, 0x00060, 0x00009, 0x00008, + 0x0002D, 0x0009F, 0x001FA, 0x0013D, 0x00031, 0x000FC, 0x00058, 0x00092, + 0x000F0, 0x000F1, 0x000CD, 0x00185, 0x00165, 0x0004E, 0x00091, 0x000E9, + 0x00184, 0x001D1, 0x001E6, 0x00097, 0x001E7, 0x000B3, 0x0013C, 0x0164E, + 0x0164F, 0x00B20, 0x00B21, 0x00B22, 0x00B23, 0x00B24, 0x00B25, 0x00B26 + } }; const uint8_t ff_vc1_1ref_mvdata_bits[4][72] = { - {3, 4, 5, 5, 5, 6, 7, 7, 2, 4, 5, 5, 6, 7, 8, 9, 9, 4, 6, 6, 6, 6, 7, 8, - 9, 9, 6, 8, 7, 7, 7, 7, 8, 8, 9, 6, 8, 8, 8, 8, 8, 9, 9, 9, 7, 10, 10, 8, - 8, 9, 9, 9, 8, 9, 13, 12, 11, 10, 10, 10, 9, 9, 9, 17, 17, 16, 16, 16, 16, 16, 16, 16}, - {3, 3, 4, 5, 5, 7, 8, 10, 3, 4, 5, 5, 6, 7, 9, 10, 12, 4, 6, 6, 5, 6, 6, 8, - 9, 11, 4, 7, 7, 7, 7, 8, 9, 9, 13, 5, 8, 9, 8, 8, 9, 10, 10, 14, 7, 9, 9, 9, - 10, 10, 11, 12, 14, 8, 12, 11, 11, 12, 13, 11, 14, 16, 15, 20, 20, 19, 19, 19, 19, 19, 19, 19}, - {3, 4, 4, 4, 5, 6, 8, 9, 2, 4, 5, 5, 5, 6, 7, 8, 8, 4, 7, 7, 6, 6, 7, 8, - 8, 9, 5, 10, 9, 8, 9, 9, 11, 10, 11, 7, 9, 9, 10, 10, 11, 12, 11, 12, 8, 11, 11, 11, - 11, 11, 12, 13, 15, 9, 12, 10, 11, 12, 12, 15, 13, 15, 13, 19, 19, 18, 18, 18, 18, 18, 18, 18}, - {4, 4, 4, 4, 5, 5, 7, 7, 3, 5, 6, 6, 6, 7, 7, 8, 8, 4, 6, 6, 6, 6, 7, 8, - 8, 8, 4, 7, 6, 6, 6, 7, 8, 9, 9, 5, 7, 7, 6, 6, 7, 8, 9, 9, 6, 8, 8, 8, - 8, 8, 8, 9, 10, 7, 8, 8, 9, 9, 9, 8, 9, 9, 9, 14, 14, 13, 13, 13, 13, 13, 13, 13} + { + 3, 4, 5, 5, 5, 6, 7, 7, 2, 4, 5, 5, 6, 7, 8, 9, 9, 4, + 6, 6, 6, 6, 7, 8, 9, 9, 6, 8, 7, 7, 7, 7, 8, 8, 9, 6, + 8, 8, 8, 8, 8, 9, 9, 9, 7, 10, 10, 8, 8, 9, 9, 9, 8, 9, + 13, 12, 11, 10, 10, 10, 9, 9, 9, 17, 17, 16, 16, 16, 16, 16, 16, 16 + }, + { + 3, 3, 4, 5, 5, 7, 8, 10, 3, 4, 5, 5, 6, 7, 9, 10, 12, 4, + 6, 6, 5, 6, 6, 8, 9, 11, 4, 7, 7, 7, 7, 8, 9, 9, 13, 5, + 8, 9, 8, 8, 9, 10, 10, 14, 7, 9, 9, 9, 10, 10, 11, 12, 14, 8, + 12, 11, 11, 12, 13, 11, 14, 16, 15, 20, 20, 19, 19, 19, 19, 19, 19, 19 + }, + { + 3, 4, 4, 4, 5, 6, 8, 9, 2, 4, 5, 5, 5, 6, 7, 8, 8, 4, + 7, 7, 6, 6, 7, 8, 8, 9, 5, 10, 9, 8, 9, 9, 11, 10, 11, 7, + 9, 9, 10, 10, 11, 12, 11, 12, 8, 11, 11, 11, 11, 11, 12, 13, 15, 9, + 12, 10, 11, 12, 12, 15, 13, 15, 13, 19, 19, 18, 18, 18, 18, 18, 18, 18 + }, + { + 4, 4, 4, 4, 5, 5, 7, 7, 3, 5, 6, 6, 6, 7, 7, 8, 8, 4, + 6, 6, 6, 6, 7, 8, 8, 8, 4, 7, 6, 6, 6, 7, 8, 9, 9, 5, + 7, 7, 6, 6, 7, 8, 9, 9, 6, 8, 8, 8, 8, 8, 8, 9, 10, 7, + 8, 8, 9, 9, 9, 8, 9, 9, 9, 14, 14, 13, 13, 13, 13, 13, 13, 13 + } }; /* 2-reference tables */ const uint32_t ff_vc1_2ref_mvdata_codes[8][126] = { /* table 132 - table 139 */ - {12, 28, 11, 0, 14, 42, 80, 872, 2, 26, 4, 58, 29, 108, - 239, 444, 351, 15, 3, 28, 13, 11, 62, 167, 326, 409, 6, 31, - 4, 60, 7, 446, 139, 44, 1971, 5, 219, 86, 236, 82, 445, 120, - 207, 1395, 9, 35, 237, 24, 6, 68, 245, 121, 1746, 110, 43, 349, - 23, 895, 324, 206, 40, 171, 16, 437, 247, 166, 123, 40, 493, 489, - 1789, 4, 245, 41, 650, 651, 655, 3577, 821, 7813, 238, 701, 43, 984, - 977, 408, 489, 1309, 180, 63, 1109, 555, 553, 1105, 1400, 1970, 1392, 341, - 50, 976, 84, 1747, 1393, 1108, 820, 7153, 183, 41, 7812, 364, 411, 7152, - 1401, 3907, 181, 2209, 42, 365, 2208, 1952, 977, 2789, 340, 2788, 2617, 2616}, - {3, 9, 22, 16, 215, 821, 1396, 1365, 0, 29, 9, 23, 44, 173, - 884, 1715, 1399, 15, 24, 10, 46, 34, 380, 3707, 7049, 5592, 8, 52, - 109, 35, 450, 886, 723, 7242, 13066, 20, 106, 114, 108, 227, 411, 1855, - 7408, 2881, 50, 230, 224, 207, 171, 412, 683, 3627, 5593, 111, 451, 175, - 191, 172, 381, 1763, 3625, 6532, 84, 181, 378, 429, 409, 376, 856, 722, - 7243, 91, 680, 817, 904, 907, 880, 1811, 3267, 7409, 441, 1519, 1848, 754, - 827, 697, 1771, 1392, 3620, 925, 1442, 1443, 3709, 1518, 1849, 1364, 2725, 2724, - 887, 7413, 3022, 3705, 1632, 1652, 1770, 3708, 3429, 758, 5594, 7048, 1441, 7412, - 1510, 3624, 1397, 3428, 820, 13067, 5595, 2880, 3023, 3525, 3626, 1653, 1393, 1363}, - {4, 2, 16, 3, 23, 69, 62, 126, 3, 2, 40, 30, 21, 71, - 2, 333, 96, 11, 38, 36, 20, 50, 111, 195, 1329, 1765, 21, 63, - 45, 1, 318, 221, 246, 773, 817, 14, 3, 52, 51, 26, 330, 197, - 244, 1764, 1, 60, 125, 141, 157, 49, 110, 662, 205, 37, 329, 50, - 137, 54, 136, 111, 3, 797, 14, 426, 638, 97, 334, 335, 103, 255, - 387, 54, 855, 245, 198, 194, 665, 281, 561, 848, 44, 399, 1328, 663, - 4, 440, 192, 634, 785, 156, 1569, 409, 796, 247, 995, 854, 393, 5, - 107, 2242, 816, 1279, 1264, 849, 1266, 498, 883, 0, 3137, 2243, 2540, 994, - 772, 1271, 1265, 496, 328, 3136, 2541, 2240, 2241, 1267, 1278, 254, 499, 425}, - {0, 4, 47, 82, 16, 173, 1291, 400, 3, 22, 7, 13, 187, 371, - 201, 1295, 5932, 3, 17, 5, 67, 35, 75, 814, 11867, 1154, 9, 42, - 20, 42, 264, 1482, 1626, 8502, 8498, 11, 19, 65, 184, 372, 256, 5338, - 16462, 5175, 43, 133, 167, 160, 332, 666, 812, 8499, 5162, 81, 644, 172, - 258, 69, 68, 2075, 1630, 3255, 24, 1292, 530, 740, 515, 148, 290, 2074, - 1621, 51, 698, 582, 578, 2670, 1036, 2056, 8500, 16463, 373, 1029, 583, 298, - 2580, 699, 401, 2127, 5176, 175, 2967, 1155, 5179, 811, 579, 5163, 2392, 10687, - 73, 2668, 5339, 1197, 5342, 2126, 5172, 599, 11866, 519, 5173, 5177, 3254, 5178, - 404, 1620, 8501, 21372, 348, 576, 4114, 21373, 2393, 4248, 5174, 1631, 8230, 8503}, - {5, 25, 22, 17, 62, 94, 239, 226, 0, 57, 43, 38, 40, 18, - 194, 237, 285, 13, 49, 42, 37, 32, 92, 493, 589, 1904, 6, 122, - 96, 79, 72, 57, 390, 531, 3782, 15, 38, 95, 117, 112, 39, 475, - 966, 1935, 63, 166, 240, 58, 82, 78, 227, 473, 783, 16, 477, 167, - 247, 34, 146, 964, 751, 1890, 121, 143, 474, 135, 232, 186, 374, 238, - 944, 133, 281, 782, 264, 466, 268, 1907, 1060, 1076, 113, 1501, 449, 935, - 295, 141, 539, 1970, 479, 984, 1892, 3812, 947, 1869, 472, 1500, 2122, 1177, - 965, 7566, 1893, 1077, 1905, 450, 280, 956, 897, 903, 31539, 4247, 4246, 7885, - 3737, 3868, 3869, 3813, 284, 31538, 15768, 7567, 3736, 3943, 957, 896, 1176, 902}, - {13, 16, 46, 57, 13, 116, 237, 182, 1, 2, 0, 48, 41, 112, - 243, 140, 358, 9, 51, 120, 6, 196, 11, 355, 204, 1470, 31, 47, - 100, 24, 198, 10, 354, 704, 3827, 7, 15, 227, 202, 178, 399, 942, - 1887, 3153, 21, 71, 238, 226, 234, 9, 362, 707, 1437, 61, 8, 473, - 50, 14, 366, 812, 1627, 6507, 2, 15, 472, 141, 180, 484, 103, 791, - 1940, 34, 958, 789, 52, 55, 734, 108, 3838, 1644, 40, 971, 940, 53, - 363, 957, 705, 1580, 7678, 14, 1438, 1471, 218, 1577, 1412, 3767, 2826, 1645, - 12, 1918, 1436, 1912, 1886, 1882, 1581, 823, 820, 407, 7767, 7652, 6506, 7766, - 3152, 2879, 7764, 2827, 398, 438, 7765, 3252, 2878, 3766, 7653, 7679, 821, 439}, - {1, 11, 25, 111, 42, 117, 2027, 355, 1, 14, 26, 62, 28, 45, - 356, 2028, 357, 4, 6, 54, 127, 174, 344, 348, 1389, 1037584, 0, 4, - 123, 243, 59, 2029, 691, 716, 1390, 24, 62, 23, 30, 175, 1015, 1391, - 717, 1037585, 20, 173, 170, 20, 168, 339, 232, 510, 3535, 120, 440, 338, - 254, 689, 349, 352, 1037586, 1037587, 122, 688, 485, 233, 252, 1766, 3528, 1412, - 1037588, 171, 3550, 345, 1012, 3529, 3530, 506, 1037589, 1037590, 252, 511, 484, 175, - 346, 359, 3531, 1413, 1037591, 1015, 16213, 1037592, 3548, 1414, 16214, 1037593, 16215, 1037594, - 442, 1415, 1416, 3551, 690, 1037595, 3534, 1014, 1037596, 4052, 1037597, 1037598, 1037599, 518784, - 518785, 1388, 518786, 518787, 886, 1417, 1418, 518788, 518789, 3549, 518790, 518791, 1419, 32425}, - {3, 14, 15, 126, 98, 198, 3289, 1598, 2, 2, 0, 24, 12, 105, - 57, 1799, 3198, 2, 13, 27, 15, 410, 1607, 6711, 214724, 13421, 1, 30, - 127, 10, 225, 1633, 3300, 214725, 214726, 29, 48, 13, 203, 409, 800, 142, - 25902, 214727, 62, 57, 53, 51, 415, 448, 3290, 214728, 214729, 11, 208, 414, - 34, 56, 398, 798, 12948, 572, 50, 18, 19, 113, 413, 32, 3207, 3264, - 214730, 824, 1619, 418, 810, 802, 3303, 132, 287, 214731, 805, 1609, 811, 119, - 1608, 1602, 3206, 3212, 214732, 58, 6583, 67, 807, 140, 141, 3213, 214733, 214734, - 823, 3301, 133, 806, 839, 3236, 3199, 3354, 214735, 808, 107360, 107361, 3288, 1676, - 12949, 12950, 25903, 26328, 817, 1798, 573, 118, 3265, 898, 3302, 26329, 26330, 26331} + { + 0x0000C, 0x0001C, 0x0000B, 0x00000, 0x0000E, 0x0002A, 0x00050, 0x00368, + 0x00002, 0x0001A, 0x00004, 0x0003A, 0x0001D, 0x0006C, 0x000EF, 0x001BC, + 0x0015F, 0x0000F, 0x00003, 0x0001C, 0x0000D, 0x0000B, 0x0003E, 0x000A7, + 0x00146, 0x00199, 0x00006, 0x0001F, 0x00004, 0x0003C, 0x00007, 0x001BE, + 0x0008B, 0x0002C, 0x007B3, 0x00005, 0x000DB, 0x00056, 0x000EC, 0x00052, + 0x001BD, 0x00078, 0x000CF, 0x00573, 0x00009, 0x00023, 0x000ED, 0x00018, + 0x00006, 0x00044, 0x000F5, 0x00079, 0x006D2, 0x0006E, 0x0002B, 0x0015D, + 0x00017, 0x0037F, 0x00144, 0x000CE, 0x00028, 0x000AB, 0x00010, 0x001B5, + 0x000F7, 0x000A6, 0x0007B, 0x00028, 0x001ED, 0x001E9, 0x006FD, 0x00004, + 0x000F5, 0x00029, 0x0028A, 0x0028B, 0x0028F, 0x00DF9, 0x00335, 0x01E85, + 0x000EE, 0x002BD, 0x0002B, 0x003D8, 0x003D1, 0x00198, 0x001E9, 0x0051D, + 0x000B4, 0x0003F, 0x00455, 0x0022B, 0x00229, 0x00451, 0x00578, 0x007B2, + 0x00570, 0x00155, 0x00032, 0x003D0, 0x00054, 0x006D3, 0x00571, 0x00454, + 0x00334, 0x01BF1, 0x000B7, 0x00029, 0x01E84, 0x0016C, 0x0019B, 0x01BF0, + 0x00579, 0x00F43, 0x000B5, 0x008A1, 0x0002A, 0x0016D, 0x008A0, 0x007A0, + 0x003D1, 0x00AE5, 0x00154, 0x00AE4, 0x00A39, 0x00A38 + }, + { + 0x00003, 0x00009, 0x00016, 0x00010, 0x000D7, 0x00335, 0x00574, 0x00555, + 0x00000, 0x0001D, 0x00009, 0x00017, 0x0002C, 0x000AD, 0x00374, 0x006B3, + 0x00577, 0x0000F, 0x00018, 0x0000A, 0x0002E, 0x00022, 0x0017C, 0x00E7B, + 0x01B89, 0x015D8, 0x00008, 0x00034, 0x0006D, 0x00023, 0x001C2, 0x00376, + 0x002D3, 0x01C4A, 0x0330A, 0x00014, 0x0006A, 0x00072, 0x0006C, 0x000E3, + 0x0019B, 0x0073F, 0x01CF0, 0x00B41, 0x00032, 0x000E6, 0x000E0, 0x000CF, + 0x000AB, 0x0019C, 0x002AB, 0x00E2B, 0x015D9, 0x0006F, 0x001C3, 0x000AF, + 0x000BF, 0x000AC, 0x0017D, 0x006E3, 0x00E29, 0x01984, 0x00054, 0x000B5, + 0x0017A, 0x001AD, 0x00199, 0x00178, 0x00358, 0x002D2, 0x01C4B, 0x0005B, + 0x002A8, 0x00331, 0x00388, 0x0038B, 0x00370, 0x00713, 0x00CC3, 0x01CF1, + 0x001B9, 0x005EF, 0x00738, 0x002F2, 0x0033B, 0x002B9, 0x006EB, 0x00570, + 0x00E24, 0x0039D, 0x005A2, 0x005A3, 0x00E7D, 0x005EE, 0x00739, 0x00554, + 0x00AA5, 0x00AA4, 0x00377, 0x01CF5, 0x00BCE, 0x00E79, 0x00660, 0x00674, + 0x006EA, 0x00E7C, 0x00D65, 0x002F6, 0x015DA, 0x01B88, 0x005A1, 0x01CF4, + 0x005E6, 0x00E28, 0x00575, 0x00D64, 0x00334, 0x0330B, 0x015DB, 0x00B40, + 0x00BCF, 0x00DC5, 0x00E2A, 0x00675, 0x00571, 0x00553 + }, + { + 0x00004, 0x00002, 0x00010, 0x00003, 0x00017, 0x00045, 0x0003E, 0x0007E, + 0x00003, 0x00002, 0x00028, 0x0001E, 0x00015, 0x00047, 0x00002, 0x0014D, + 0x00060, 0x0000B, 0x00026, 0x00024, 0x00014, 0x00032, 0x0006F, 0x000C3, + 0x00531, 0x006E5, 0x00015, 0x0003F, 0x0002D, 0x00001, 0x0013E, 0x000DD, + 0x000F6, 0x00305, 0x00331, 0x0000E, 0x00003, 0x00034, 0x00033, 0x0001A, + 0x0014A, 0x000C5, 0x000F4, 0x006E4, 0x00001, 0x0003C, 0x0007D, 0x0008D, + 0x0009D, 0x00031, 0x0006E, 0x00296, 0x000CD, 0x00025, 0x00149, 0x00032, + 0x00089, 0x00036, 0x00088, 0x0006F, 0x00003, 0x0031D, 0x0000E, 0x001AA, + 0x0027E, 0x00061, 0x0014E, 0x0014F, 0x00067, 0x000FF, 0x00183, 0x00036, + 0x00357, 0x000F5, 0x000C6, 0x000C2, 0x00299, 0x00119, 0x00231, 0x00350, + 0x0002C, 0x0018F, 0x00530, 0x00297, 0x00004, 0x001B8, 0x000C0, 0x0027A, + 0x00311, 0x0009C, 0x00621, 0x00199, 0x0031C, 0x000F7, 0x003E3, 0x00356, + 0x00189, 0x00005, 0x0006B, 0x008C2, 0x00330, 0x004FF, 0x004F0, 0x00351, + 0x004F2, 0x001F2, 0x00373, 0x00000, 0x00C41, 0x008C3, 0x009EC, 0x003E2, + 0x00304, 0x004F7, 0x004F1, 0x001F0, 0x00148, 0x00C40, 0x009ED, 0x008C0, + 0x008C1, 0x004F3, 0x004FE, 0x000FE, 0x001F3, 0x001A9 + }, + { + 0x00000, 0x00004, 0x0002F, 0x00052, 0x00010, 0x000AD, 0x0050B, 0x00190, + 0x00003, 0x00016, 0x00007, 0x0000D, 0x000BB, 0x00173, 0x000C9, 0x0050F, + 0x0172C, 0x00003, 0x00011, 0x00005, 0x00043, 0x00023, 0x0004B, 0x0032E, + 0x02E5B, 0x00482, 0x00009, 0x0002A, 0x00014, 0x0002A, 0x00108, 0x005CA, + 0x0065A, 0x02136, 0x02132, 0x0000B, 0x00013, 0x00041, 0x000B8, 0x00174, + 0x00100, 0x014DA, 0x0404E, 0x01437, 0x0002B, 0x00085, 0x000A7, 0x000A0, + 0x0014C, 0x0029A, 0x0032C, 0x02133, 0x0142A, 0x00051, 0x00284, 0x000AC, + 0x00102, 0x00045, 0x00044, 0x0081B, 0x0065E, 0x00CB7, 0x00018, 0x0050C, + 0x00212, 0x002E4, 0x00203, 0x00094, 0x00122, 0x0081A, 0x00655, 0x00033, + 0x002BA, 0x00246, 0x00242, 0x00A6E, 0x0040C, 0x00808, 0x02134, 0x0404F, + 0x00175, 0x00405, 0x00247, 0x0012A, 0x00A14, 0x002BB, 0x00191, 0x0084F, + 0x01438, 0x000AF, 0x00B97, 0x00483, 0x0143B, 0x0032B, 0x00243, 0x0142B, + 0x00958, 0x029BF, 0x00049, 0x00A6C, 0x014DB, 0x004AD, 0x014DE, 0x0084E, + 0x01434, 0x00257, 0x02E5A, 0x00207, 0x01435, 0x01439, 0x00CB6, 0x0143A, + 0x00194, 0x00654, 0x02135, 0x0537C, 0x0015C, 0x00240, 0x01012, 0x0537D, + 0x00959, 0x01098, 0x01436, 0x0065F, 0x02026, 0x02137 + }, + { + 0x00005, 0x00019, 0x00016, 0x00011, 0x0003E, 0x0005E, 0x000EF, 0x000E2, + 0x00000, 0x00039, 0x0002B, 0x00026, 0x00028, 0x00012, 0x000C2, 0x000ED, + 0x0011D, 0x0000D, 0x00031, 0x0002A, 0x00025, 0x00020, 0x0005C, 0x001ED, + 0x0024D, 0x00770, 0x00006, 0x0007A, 0x00060, 0x0004F, 0x00048, 0x00039, + 0x00186, 0x00213, 0x00EC6, 0x0000F, 0x00026, 0x0005F, 0x00075, 0x00070, + 0x00027, 0x001DB, 0x003C6, 0x0078F, 0x0003F, 0x000A6, 0x000F0, 0x0003A, + 0x00052, 0x0004E, 0x000E3, 0x001D9, 0x0030F, 0x00010, 0x001DD, 0x000A7, + 0x000F7, 0x00022, 0x00092, 0x003C4, 0x002EF, 0x00762, 0x00079, 0x0008F, + 0x001DA, 0x00087, 0x000E8, 0x000BA, 0x00176, 0x000EE, 0x003B0, 0x00085, + 0x00119, 0x0030E, 0x00108, 0x001D2, 0x0010C, 0x00773, 0x00424, 0x00434, + 0x00071, 0x005DD, 0x001C1, 0x003A7, 0x00127, 0x0008D, 0x0021B, 0x007B2, + 0x001DF, 0x003D8, 0x00764, 0x00EE4, 0x003B3, 0x0074D, 0x001D8, 0x005DC, + 0x0084A, 0x00499, 0x003C5, 0x01D8E, 0x00765, 0x00435, 0x00771, 0x001C2, + 0x00118, 0x003BC, 0x00381, 0x00387, 0x07B33, 0x01097, 0x01096, 0x01ECD, + 0x00E99, 0x00F1C, 0x00F1D, 0x00EE5, 0x0011C, 0x07B32, 0x03D98, 0x01D8F, + 0x00E98, 0x00F67, 0x003BD, 0x00380, 0x00498, 0x00386 + }, + { + 0x0000D, 0x00010, 0x0002E, 0x00039, 0x0000D, 0x00074, 0x000ED, 0x000B6, + 0x00001, 0x00002, 0x00000, 0x00030, 0x00029, 0x00070, 0x000F3, 0x0008C, + 0x00166, 0x00009, 0x00033, 0x00078, 0x00006, 0x000C4, 0x0000B, 0x00163, + 0x000CC, 0x005BE, 0x0001F, 0x0002F, 0x00064, 0x00018, 0x000C6, 0x0000A, + 0x00162, 0x002C0, 0x00EF3, 0x00007, 0x0000F, 0x000E3, 0x000CA, 0x000B2, + 0x0018F, 0x003AE, 0x0075F, 0x00C51, 0x00015, 0x00047, 0x000EE, 0x000E2, + 0x000EA, 0x00009, 0x0016A, 0x002C3, 0x0059D, 0x0003D, 0x00008, 0x001D9, + 0x00032, 0x0000E, 0x0016E, 0x0032C, 0x0065B, 0x0196B, 0x00002, 0x0000F, + 0x001D8, 0x0008D, 0x000B4, 0x001E4, 0x00067, 0x00317, 0x00794, 0x00022, + 0x003BE, 0x00315, 0x00034, 0x00037, 0x002DE, 0x0006C, 0x00EFE, 0x0066C, + 0x00028, 0x003CB, 0x003AC, 0x00035, 0x0016B, 0x003BD, 0x002C1, 0x0062C, + 0x01DFE, 0x0000E, 0x0059E, 0x005BF, 0x000DA, 0x00629, 0x00584, 0x00EB7, + 0x00B0A, 0x0066D, 0x0000C, 0x0077E, 0x0059C, 0x00778, 0x0075E, 0x0075A, + 0x0062D, 0x00337, 0x00334, 0x00197, 0x01E57, 0x01DE4, 0x0196A, 0x01E56, + 0x00C50, 0x00B3F, 0x01E54, 0x00B0B, 0x0018E, 0x001B6, 0x01E55, 0x00CB4, + 0x00B3E, 0x00EB6, 0x01DE5, 0x01DFF, 0x00335, 0x001B7 + }, + { + 0x00001, 0x0000B, 0x00019, 0x0006F, 0x0002A, 0x00075, 0x007EB, 0x00163, + 0x00001, 0x0000E, 0x0001A, 0x0003E, 0x0001C, 0x0002D, 0x00164, 0x007EC, + 0x00165, 0x00004, 0x00006, 0x00036, 0x0007F, 0x000AE, 0x00158, 0x0015C, + 0x0056D, 0xFD510, 0x00000, 0x00004, 0x0007B, 0x000F3, 0x0003B, 0x007ED, + 0x002B3, 0x002CC, 0x0056E, 0x00018, 0x0003E, 0x00017, 0x0001E, 0x000AF, + 0x003F7, 0x0056F, 0x002CD, 0xFD511, 0x00014, 0x000AD, 0x000AA, 0x00014, + 0x000A8, 0x00153, 0x000E8, 0x001FE, 0x00DCF, 0x00078, 0x001B8, 0x00152, + 0x000FE, 0x002B1, 0x0015D, 0x00160, 0xFD512, 0xFD513, 0x0007A, 0x002B0, + 0x001E5, 0x000E9, 0x000FC, 0x006E6, 0x00DC8, 0x00584, 0xFD514, 0x000AB, + 0x00DDE, 0x00159, 0x003F4, 0x00DC9, 0x00DCA, 0x001FA, 0xFD515, 0xFD516, + 0x000FC, 0x001FF, 0x001E4, 0x000AF, 0x0015A, 0x00167, 0x00DCB, 0x00585, + 0xFD517, 0x003F7, 0x03F55, 0xFD518, 0x00DDC, 0x00586, 0x03F56, 0xFD519, + 0x03F57, 0xFD51A, 0x001BA, 0x00587, 0x00588, 0x00DDF, 0x002B2, 0xFD51B, + 0x00DCE, 0x003F6, 0xFD51C, 0x00FD4, 0xFD51D, 0xFD51E, 0xFD51F, 0x7EA80, + 0x7EA81, 0x0056C, 0x7EA82, 0x7EA83, 0x00376, 0x00589, 0x0058A, 0x7EA84, + 0x7EA85, 0x00DDD, 0x7EA86, 0x7EA87, 0x0058B, 0x07EA9 + }, + { + 0x00003, 0x0000E, 0x0000F, 0x0007E, 0x00062, 0x000C6, 0x00CD9, 0x0063E, + 0x00002, 0x00002, 0x00000, 0x00018, 0x0000C, 0x00069, 0x00039, 0x00707, + 0x00C7E, 0x00002, 0x0000D, 0x0001B, 0x0000F, 0x0019A, 0x00647, 0x01A37, + 0x346C4, 0x0346D, 0x00001, 0x0001E, 0x0007F, 0x0000A, 0x000E1, 0x00661, + 0x00CE4, 0x346C5, 0x346C6, 0x0001D, 0x00030, 0x0000D, 0x000CB, 0x00199, + 0x00320, 0x0008E, 0x0652E, 0x346C7, 0x0003E, 0x00039, 0x00035, 0x00033, + 0x0019F, 0x001C0, 0x00CDA, 0x346C8, 0x346C9, 0x0000B, 0x000D0, 0x0019E, + 0x00022, 0x00038, 0x0018E, 0x0031E, 0x03294, 0x0023C, 0x00032, 0x00012, + 0x00013, 0x00071, 0x0019D, 0x00020, 0x00C87, 0x00CC0, 0x346CA, 0x00338, + 0x00653, 0x001A2, 0x0032A, 0x00322, 0x00CE7, 0x00084, 0x0011F, 0x346CB, + 0x00325, 0x00649, 0x0032B, 0x00077, 0x00648, 0x00642, 0x00C86, 0x00C8C, + 0x346CC, 0x0003A, 0x019B7, 0x00043, 0x00327, 0x0008C, 0x0008D, 0x00C8D, + 0x346CD, 0x346CE, 0x00337, 0x00CE5, 0x00085, 0x00326, 0x00347, 0x00CA4, + 0x00C7F, 0x00D1A, 0x346CF, 0x00328, 0x1A360, 0x1A361, 0x00CD8, 0x0068C, + 0x03295, 0x03296, 0x0652F, 0x066D8, 0x00331, 0x00706, 0x0023D, 0x00076, + 0x00CC1, 0x00382, 0x00CE6, 0x066D9, 0x066DA, 0x066DB + } }; const uint8_t ff_vc1_2ref_mvdata_bits[8][126] = { - {4, 5, 5, 5, 6, 7, 8, 10, 2, 5, 5, 6, 6, 7, - 8, 9, 10, 4, 5, 6, 6, 7, 8, 9, 10, 11, 4, 6, - 6, 7, 7, 9, 9, 10, 12, 5, 8, 8, 8, 8, 9, 9, - 10, 12, 5, 7, 8, 7, 7, 8, 9, 9, 11, 7, 9, 10, - 9, 10, 10, 10, 10, 12, 6, 9, 9, 9, 9, 9, 10, 10, - 11, 7, 10, 10, 11, 11, 11, 12, 12, 14, 8, 11, 10, 11, - 11, 11, 11, 12, 12, 8, 12, 11, 11, 12, 12, 12, 12, 13, - 8, 12, 11, 11, 12, 12, 12, 13, 12, 9, 14, 13, 11, 13, - 12, 13, 12, 13, 9, 13, 13, 12, 12, 13, 13, 13, 13, 13}, - {3, 4, 5, 6, 8, 10, 11, 11, 2, 5, 5, 6, 7, 8, - 10, 11, 11, 4, 5, 5, 6, 7, 9, 12, 13, 13, 4, 6, - 7, 7, 9, 10, 11, 13, 14, 5, 7, 7, 7, 8, 9, 11, - 13, 13, 6, 8, 8, 8, 8, 9, 10, 12, 13, 7, 9, 8, - 8, 8, 9, 11, 12, 13, 7, 9, 9, 9, 9, 9, 10, 11, - 13, 8, 10, 10, 10, 10, 10, 11, 12, 13, 9, 11, 11, 10, - 10, 10, 11, 11, 12, 10, 12, 12, 12, 11, 11, 11, 12, 12, - 10, 13, 12, 12, 11, 11, 11, 12, 12, 10, 13, 13, 12, 13, - 11, 12, 11, 12, 10, 14, 13, 13, 12, 12, 12, 11, 11, 11}, - {4, 4, 5, 5, 6, 7, 8, 9, 2, 5, 6, 6, 6, 7, - 7, 9, 9, 4, 6, 6, 6, 7, 8, 9, 11, 12, 5, 7, - 7, 7, 9, 9, 10, 11, 12, 5, 7, 7, 7, 7, 9, 9, - 10, 12, 5, 8, 8, 8, 8, 8, 9, 10, 10, 6, 9, 8, - 8, 8, 8, 9, 9, 11, 6, 10, 10, 9, 9, 9, 9, 10, - 10, 7, 11, 10, 9, 9, 10, 9, 10, 11, 7, 10, 11, 10, - 10, 10, 9, 10, 11, 8, 12, 11, 11, 10, 11, 11, 10, 10, - 8, 12, 12, 11, 11, 11, 11, 10, 11, 8, 13, 12, 12, 11, - 11, 11, 11, 10, 9, 13, 12, 12, 12, 11, 11, 10, 10, 10}, - {3, 4, 6, 7, 7, 9, 11, 11, 2, 5, 5, 6, 8, 9, - 10, 11, 13, 3, 5, 5, 7, 8, 9, 12, 14, 13, 4, 6, - 6, 7, 9, 11, 13, 14, 14, 5, 7, 7, 8, 9, 9, 13, - 15, 13, 6, 8, 8, 8, 9, 10, 12, 14, 13, 7, 10, 9, - 9, 9, 9, 12, 13, 14, 7, 11, 10, 10, 10, 10, 11, 12, - 13, 8, 11, 12, 12, 12, 11, 12, 14, 15, 9, 11, 12, 11, - 12, 11, 11, 12, 13, 9, 12, 13, 13, 12, 12, 13, 14, 14, - 9, 12, 13, 13, 13, 12, 13, 12, 14, 10, 13, 13, 14, 13, - 11, 13, 14, 15, 10, 12, 13, 15, 14, 13, 13, 13, 14, 14}, - {4, 5, 5, 5, 6, 7, 8, 8, 2, 6, 6, 6, 6, 6, - 8, 9, 10, 4, 6, 6, 6, 6, 7, 9, 10, 11, 4, 7, - 7, 7, 7, 7, 9, 10, 12, 5, 7, 7, 7, 7, 7, 9, - 10, 11, 6, 8, 8, 7, 7, 7, 8, 9, 10, 6, 9, 8, - 8, 7, 8, 10, 10, 11, 7, 9, 9, 8, 8, 8, 9, 9, - 10, 8, 10, 10, 9, 9, 9, 11, 11, 11, 8, 11, 10, 10, - 9, 9, 10, 11, 10, 10, 12, 12, 11, 11, 10, 11, 12, 11, - 10, 13, 12, 11, 11, 10, 10, 11, 11, 11, 15, 13, 13, 13, - 12, 12, 12, 12, 10, 15, 14, 13, 12, 12, 11, 11, 11, 11}, - {4, 5, 6, 6, 6, 7, 8, 8, 2, 4, 5, 6, 6, 7, - 8, 8, 9, 4, 6, 7, 7, 8, 8, 9, 10, 11, 5, 6, - 7, 7, 8, 8, 9, 10, 12, 5, 7, 8, 8, 8, 9, 10, - 11, 12, 5, 7, 8, 8, 8, 8, 9, 10, 11, 6, 8, 9, - 8, 8, 9, 10, 11, 13, 5, 8, 9, 8, 8, 9, 9, 10, - 11, 6, 10, 10, 9, 9, 10, 10, 12, 13, 6, 10, 10, 9, - 9, 10, 10, 11, 13, 7, 11, 11, 11, 11, 11, 12, 12, 13, - 7, 11, 11, 11, 11, 11, 11, 12, 12, 9, 13, 13, 13, 13, - 12, 12, 13, 12, 9, 12, 13, 12, 12, 12, 13, 13, 12, 12}, - {3, 5, 6, 8, 9, 10, 12, 12, 1, 5, 6, 7, 8, 9, - 12, 12, 12, 4, 6, 7, 8, 9, 12, 12, 14, 21, 4, 6, - 8, 9, 9, 12, 13, 13, 14, 6, 9, 8, 8, 9, 13, 14, - 13, 21, 6, 9, 9, 8, 9, 10, 11, 12, 13, 8, 10, 10, - 11, 11, 12, 12, 21, 21, 8, 11, 10, 11, 11, 12, 13, 14, - 21, 9, 13, 10, 11, 13, 13, 12, 21, 21, 9, 12, 10, 11, - 12, 12, 13, 14, 21, 11, 15, 21, 13, 14, 15, 21, 15, 21, - 10, 14, 14, 13, 13, 21, 13, 13, 21, 13, 21, 21, 21, 20, - 20, 14, 20, 20, 11, 14, 14, 20, 20, 13, 20, 20, 14, 16}, - {2, 5, 6, 8, 9, 10, 13, 13, 2, 4, 5, 6, 8, 9, - 10, 13, 14, 3, 5, 7, 8, 10, 12, 15, 20, 16, 4, 6, - 8, 8, 10, 12, 13, 20, 20, 7, 8, 8, 9, 10, 11, 12, - 16, 20, 7, 8, 8, 8, 10, 11, 13, 20, 20, 8, 10, 10, - 10, 10, 11, 12, 15, 14, 8, 9, 9, 9, 10, 10, 13, 13, - 20, 11, 12, 11, 11, 11, 13, 12, 13, 20, 11, 12, 11, 11, - 12, 12, 13, 13, 20, 10, 14, 11, 11, 12, 12, 13, 20, 20, - 11, 13, 12, 11, 12, 13, 14, 14, 20, 11, 19, 19, 13, 13, - 15, 15, 16, 16, 11, 13, 14, 11, 13, 12, 13, 16, 16, 16} -}; - -const uint8_t wmv3_dc_scale_table[32]={ - 0, 2, 4, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21 + { + 4, 5, 5, 5, 6, 7, 8, 10, 2, 5, 5, 6, 6, 7, 8, 9, + 10, 4, 5, 6, 6, 7, 8, 9, 10, 11, 4, 6, 6, 7, 7, 9, + 9, 10, 12, 5, 8, 8, 8, 8, 9, 9, 10, 12, 5, 7, 8, 7, + 7, 8, 9, 9, 11, 7, 9, 10, 9, 10, 10, 10, 10, 12, 6, 9, + 9, 9, 9, 9, 10, 10, 11, 7, 10, 10, 11, 11, 11, 12, 12, 14, + 8, 11, 10, 11, 11, 11, 11, 12, 12, 8, 12, 11, 11, 12, 12, 12, + 12, 13, 8, 12, 11, 11, 12, 12, 12, 13, 12, 9, 14, 13, 11, 13, + 12, 13, 12, 13, 9, 13, 13, 12, 12, 13, 13, 13, 13, 13 + }, + { + 3, 4, 5, 6, 8, 10, 11, 11, 2, 5, 5, 6, 7, 8, 10, 11, + 11, 4, 5, 5, 6, 7, 9, 12, 13, 13, 4, 6, 7, 7, 9, 10, + 11, 13, 14, 5, 7, 7, 7, 8, 9, 11, 13, 13, 6, 8, 8, 8, + 8, 9, 10, 12, 13, 7, 9, 8, 8, 8, 9, 11, 12, 13, 7, 9, + 9, 9, 9, 9, 10, 11, 13, 8, 10, 10, 10, 10, 10, 11, 12, 13, + 9, 11, 11, 10, 10, 10, 11, 11, 12, 10, 12, 12, 12, 11, 11, 11, + 12, 12, 10, 13, 12, 12, 11, 11, 11, 12, 12, 10, 13, 13, 12, 13, + 11, 12, 11, 12, 10, 14, 13, 13, 12, 12, 12, 11, 11, 11 + }, + { + 4, 4, 5, 5, 6, 7, 8, 9, 2, 5, 6, 6, 6, 7, 7, 9, + 9, 4, 6, 6, 6, 7, 8, 9, 11, 12, 5, 7, 7, 7, 9, 9, + 10, 11, 12, 5, 7, 7, 7, 7, 9, 9, 10, 12, 5, 8, 8, 8, + 8, 8, 9, 10, 10, 6, 9, 8, 8, 8, 8, 9, 9, 11, 6, 10, + 10, 9, 9, 9, 9, 10, 10, 7, 11, 10, 9, 9, 10, 9, 10, 11, + 7, 10, 11, 10, 10, 10, 9, 10, 11, 8, 12, 11, 11, 10, 11, 11, + 10, 10, 8, 12, 12, 11, 11, 11, 11, 10, 11, 8, 13, 12, 12, 11, + 11, 11, 11, 10, 9, 13, 12, 12, 12, 11, 11, 10, 10, 10 + }, + { + 3, 4, 6, 7, 7, 9, 11, 11, 2, 5, 5, 6, 8, 9, 10, 11, + 13, 3, 5, 5, 7, 8, 9, 12, 14, 13, 4, 6, 6, 7, 9, 11, + 13, 14, 14, 5, 7, 7, 8, 9, 9, 13, 15, 13, 6, 8, 8, 8, + 9, 10, 12, 14, 13, 7, 10, 9, 9, 9, 9, 12, 13, 14, 7, 11, + 10, 10, 10, 10, 11, 12, 13, 8, 11, 12, 12, 12, 11, 12, 14, 15, + 9, 11, 12, 11, 12, 11, 11, 12, 13, 9, 12, 13, 13, 12, 12, 13, + 14, 14, 9, 12, 13, 13, 13, 12, 13, 12, 14, 10, 13, 13, 14, 13, + 11, 13, 14, 15, 10, 12, 13, 15, 14, 13, 13, 13, 14, 14 + }, + { + 4, 5, 5, 5, 6, 7, 8, 8, 2, 6, 6, 6, 6, 6, 8, 9, + 10, 4, 6, 6, 6, 6, 7, 9, 10, 11, 4, 7, 7, 7, 7, 7, + 9, 10, 12, 5, 7, 7, 7, 7, 7, 9, 10, 11, 6, 8, 8, 7, + 7, 7, 8, 9, 10, 6, 9, 8, 8, 7, 8, 10, 10, 11, 7, 9, + 9, 8, 8, 8, 9, 9, 10, 8, 10, 10, 9, 9, 9, 11, 11, 11, + 8, 11, 10, 10, 9, 9, 10, 11, 10, 10, 12, 12, 11, 11, 10, 11, + 12, 11, 10, 13, 12, 11, 11, 10, 10, 11, 11, 11, 15, 13, 13, 13, + 12, 12, 12, 12, 10, 15, 14, 13, 12, 12, 11, 11, 11, 11 + }, + { + 4, 5, 6, 6, 6, 7, 8, 8, 2, 4, 5, 6, 6, 7, 8, 8, + 9, 4, 6, 7, 7, 8, 8, 9, 10, 11, 5, 6, 7, 7, 8, 8, + 9, 10, 12, 5, 7, 8, 8, 8, 9, 10, 11, 12, 5, 7, 8, 8, + 8, 8, 9, 10, 11, 6, 8, 9, 8, 8, 9, 10, 11, 13, 5, 8, + 9, 8, 8, 9, 9, 10, 11, 6, 10, 10, 9, 9, 10, 10, 12, 13, + 6, 10, 10, 9, 9, 10, 10, 11, 13, 7, 11, 11, 11, 11, 11, 12, + 12, 13, 7, 11, 11, 11, 11, 11, 11, 12, 12, 9, 13, 13, 13, 13, + 12, 12, 13, 12, 9, 12, 13, 12, 12, 12, 13, 13, 12, 12 + }, + { + 3, 5, 6, 8, 9, 10, 12, 12, 1, 5, 6, 7, 8, 9, 12, 12, + 12, 4, 6, 7, 8, 9, 12, 12, 14, 21, 4, 6, 8, 9, 9, 12, + 13, 13, 14, 6, 9, 8, 8, 9, 13, 14, 13, 21, 6, 9, 9, 8, + 9, 10, 11, 12, 13, 8, 10, 10, 11, 11, 12, 12, 21, 21, 8, 11, + 10, 11, 11, 12, 13, 14, 21, 9, 13, 10, 11, 13, 13, 12, 21, 21, + 9, 12, 10, 11, 12, 12, 13, 14, 21, 11, 15, 21, 13, 14, 15, 21, + 15, 21, 10, 14, 14, 13, 13, 21, 13, 13, 21, 13, 21, 21, 21, 20, + 20, 14, 20, 20, 11, 14, 14, 20, 20, 13, 20, 20, 14, 16 + }, + { + 2, 5, 6, 8, 9, 10, 13, 13, 2, 4, 5, 6, 8, 9, 10, 13, + 14, 3, 5, 7, 8, 10, 12, 15, 20, 16, 4, 6, 8, 8, 10, 12, + 13, 20, 20, 7, 8, 8, 9, 10, 11, 12, 16, 20, 7, 8, 8, 8, + 10, 11, 13, 20, 20, 8, 10, 10, 10, 10, 11, 12, 15, 14, 8, 9, + 9, 9, 10, 10, 13, 13, 20, 11, 12, 11, 11, 11, 13, 12, 13, 20, + 11, 12, 11, 11, 12, 12, 13, 13, 20, 10, 14, 11, 11, 12, 12, 13, + 20, 20, 11, 13, 12, 11, 12, 13, 14, 14, 20, 11, 19, 19, 13, 13, + 15, 15, 16, 16, 11, 13, 14, 11, 13, 12, 13, 16, 16, 16 + } +}; + +const uint8_t wmv3_dc_scale_table[32] = { + 0, 2, 4, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, + 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21 }; /* P-Picture CBPCY VLC tables */ @@ -584,108 +707,137 @@ const uint8_t ff_vc1_cbpcy_p_bits[4][64] = { }; /* Interlaced CBPCY VLC tables (Table 124 - Table 131) */ - const uint16_t ff_vc1_icbpcy_p_codes[8][63] = { { - 12058, 12059, 6028, 144, 680, 681, 3015, 145, 682, 683, 1504, 74, 150, - 151, 189, 146, 684, 685, 1505, 152, 306, 307, 377, 308, 618, 619, 764, - 78, 64, 65, 43, 147, 686, 687, 1506, 310, 622, 623, 765, 158, 318, - 319, 383, 80, 66, 67, 44, 81, 164, 165, 190, 83, 68, 69, 45, - 84, 70, 71, 46, 3, 0, 1, 1 - }, { - 65, 66, 256, 67, 136, 137, 257, 69, 140, 141, 258, 16, 34, - 35, 36, 71, 16, 17, 259, 37, 88, 89, 90, 91, 90, 91, 92, - 12, 48, 49, 25, 9, 20, 21, 44, 92, 93, 94, 95, 38, 93, - 94, 95, 13, 52, 53, 27, 20, 39, 42, 43, 14, 56, 57, 29, - 15, 60, 61, 31, 5, 9, 0, 3 - }, { - 50, 51, 26, 38, 228, 229, 486, 39, 230, 231, 487, 14, 99, - 108, 119, 40, 232, 233, 488, 123, 218, 219, 236, 245, 440, 441, 474, - 33, 75, 84, 43, 41, 234, 235, 489, 74, 442, 443, 475, 32, 222, - 223, 242, 34, 85, 88, 45, 15, 112, 113, 120, 35, 89, 92, 47, - 36, 93, 98, 48, 2, 31, 6, 0 - }, { - 40, 41, 157, 0, 490, 491, 492, 1, 493, 494, 495, 5, 240, - 241, 59, 2, 496, 497, 498, 63, 348, 349, 153, 16, 976, 977, 304, - 15, 158, 159, 251, 3, 499, 500, 501, 17, 978, 979, 305, 9, 350, - 351, 156, 16, 168, 169, 56, 6, 242, 243, 77, 17, 170, 171, 57, - 18, 172, 173, 58, 6, 22, 23, 14 - }, { - 60, 61, 31, 10, 97, 98, 2, 11, 99, 100, 3, 7, 3, - 4, 11, 12, 101, 102, 4, 18, 10, 11, 20, 27, 24, 25, 52, - 44, 103, 104, 53, 13, 105, 108, 5, 96, 26, 27, 53, 19, 14, - 15, 21, 45, 109, 110, 56, 8, 8, 9, 12, 46, 111, 114, 58, - 47, 115, 0, 59, 7, 20, 21, 4 - }, { - 56, 57, 157, 10, 145, 146, 147, 11, 148, 149, 150, 3, 238, - 239, 54, 12, 151, 152, 153, 8, 484, 485, 106, 24, 972, 973, 214, - 14, 158, 159, 245, 13, 154, 155, 156, 25, 974, 975, 215, 9, 488, - 489, 144, 15, 232, 233, 246, 5, 240, 241, 55, 16, 234, 235, 247, - 17, 236, 237, 52, 0, 62, 63, 2 - }, { - 60, 61, 463, 0, 191, 224, 508, 1, 225, 226, 509, 9, 497, - 498, 499, 2, 227, 228, 510, 17, 1006, 1007, 1008, 33, 2018, 2019, 2020, - 24, 1015, 1022, 1023, 3, 229, 230, 128, 46, 2021, 2022, 2023, 22, 1012, - 1013, 1014, 25, 258, 259, 260, 10, 500, 501, 502, 26, 261, 262, 263, - 27, 376, 377, 462, 29, 189, 190, 496 - }, { - 3, 4, 438, 4, 46, 47, 14, 5, 48, 49, 15, 3, 10, - 11, 20, 6, 50, 51, 16, 5, 48, 49, 50, 9, 102, 103, 104, - 29, 439, 440, 441, 7, 52, 53, 17, 22, 105, 106, 107, 10, 54, - 55, 216, 30, 442, 443, 444, 4, 21, 22, 23, 31, 445, 446, 447, - 0, 16, 17, 18, 28, 217, 218, 19 + 0x2F1A, 0x2F1B, 0x178C, 0x0090, 0x02A8, 0x02A9, 0x0BC7, 0x0091, + 0x02AA, 0x02AB, 0x05E0, 0x004A, 0x0096, 0x0097, 0x00BD, 0x0092, + 0x02AC, 0x02AD, 0x05E1, 0x0098, 0x0132, 0x0133, 0x0179, 0x0134, + 0x026A, 0x026B, 0x02FC, 0x004E, 0x0040, 0x0041, 0x002B, 0x0093, + 0x02AE, 0x02AF, 0x05E2, 0x0136, 0x026E, 0x026F, 0x02FD, 0x009E, + 0x013E, 0x013F, 0x017F, 0x0050, 0x0042, 0x0043, 0x002C, 0x0051, + 0x00A4, 0x00A5, 0x00BE, 0x0053, 0x0044, 0x0045, 0x002D, 0x0054, + 0x0046, 0x0047, 0x002E, 0x0003, 0x0000, 0x0001, 0x0001 + }, + { + 0x0041, 0x0042, 0x0100, 0x0043, 0x0088, 0x0089, 0x0101, 0x0045, + 0x008C, 0x008D, 0x0102, 0x0010, 0x0022, 0x0023, 0x0024, 0x0047, + 0x0010, 0x0011, 0x0103, 0x0025, 0x0058, 0x0059, 0x005A, 0x005B, + 0x005A, 0x005B, 0x005C, 0x000C, 0x0030, 0x0031, 0x0019, 0x0009, + 0x0014, 0x0015, 0x002C, 0x005C, 0x005D, 0x005E, 0x005F, 0x0026, + 0x005D, 0x005E, 0x005F, 0x000D, 0x0034, 0x0035, 0x001B, 0x0014, + 0x0027, 0x002A, 0x002B, 0x000E, 0x0038, 0x0039, 0x001D, 0x000F, + 0x003C, 0x003D, 0x001F, 0x0005, 0x0009, 0x0000, 0x0003 + }, + { + 0x0032, 0x0033, 0x001A, 0x0026, 0x00E4, 0x00E5, 0x01E6, 0x0027, + 0x00E6, 0x00E7, 0x01E7, 0x000E, 0x0063, 0x006C, 0x0077, 0x0028, + 0x00E8, 0x00E9, 0x01E8, 0x007B, 0x00DA, 0x00DB, 0x00EC, 0x00F5, + 0x01B8, 0x01B9, 0x01DA, 0x0021, 0x004B, 0x0054, 0x002B, 0x0029, + 0x00EA, 0x00EB, 0x01E9, 0x004A, 0x01BA, 0x01BB, 0x01DB, 0x0020, + 0x00DE, 0x00DF, 0x00F2, 0x0022, 0x0055, 0x0058, 0x002D, 0x000F, + 0x0070, 0x0071, 0x0078, 0x0023, 0x0059, 0x005C, 0x002F, 0x0024, + 0x005D, 0x0062, 0x0030, 0x0002, 0x001F, 0x0006, 0x0000 + }, + { + 0x0028, 0x0029, 0x009D, 0x0000, 0x01EA, 0x01EB, 0x01EC, 0x0001, + 0x01ED, 0x01EE, 0x01EF, 0x0005, 0x00F0, 0x00F1, 0x003B, 0x0002, + 0x01F0, 0x01F1, 0x01F2, 0x003F, 0x015C, 0x015D, 0x0099, 0x0010, + 0x03D0, 0x03D1, 0x0130, 0x000F, 0x009E, 0x009F, 0x00FB, 0x0003, + 0x01F3, 0x01F4, 0x01F5, 0x0011, 0x03D2, 0x03D3, 0x0131, 0x0009, + 0x015E, 0x015F, 0x009C, 0x0010, 0x00A8, 0x00A9, 0x0038, 0x0006, + 0x00F2, 0x00F3, 0x004D, 0x0011, 0x00AA, 0x00AB, 0x0039, 0x0012, + 0x00AC, 0x00AD, 0x003A, 0x0006, 0x0016, 0x0017, 0x000E + }, + { + 0x003C, 0x003D, 0x001F, 0x000A, 0x0061, 0x0062, 0x0002, 0x000B, + 0x0063, 0x0064, 0x0003, 0x0007, 0x0003, 0x0004, 0x000B, 0x000C, + 0x0065, 0x0066, 0x0004, 0x0012, 0x000A, 0x000B, 0x0014, 0x001B, + 0x0018, 0x0019, 0x0034, 0x002C, 0x0067, 0x0068, 0x0035, 0x000D, + 0x0069, 0x006C, 0x0005, 0x0060, 0x001A, 0x001B, 0x0035, 0x0013, + 0x000E, 0x000F, 0x0015, 0x002D, 0x006D, 0x006E, 0x0038, 0x0008, + 0x0008, 0x0009, 0x000C, 0x002E, 0x006F, 0x0072, 0x003A, 0x002F, + 0x0073, 0x0000, 0x003B, 0x0007, 0x0014, 0x0015, 0x0004 + }, + { + 0x0038, 0x0039, 0x009D, 0x000A, 0x0091, 0x0092, 0x0093, 0x000B, + 0x0094, 0x0095, 0x0096, 0x0003, 0x00EE, 0x00EF, 0x0036, 0x000C, + 0x0097, 0x0098, 0x0099, 0x0008, 0x01E4, 0x01E5, 0x006A, 0x0018, + 0x03CC, 0x03CD, 0x00D6, 0x000E, 0x009E, 0x009F, 0x00F5, 0x000D, + 0x009A, 0x009B, 0x009C, 0x0019, 0x03CE, 0x03CF, 0x00D7, 0x0009, + 0x01E8, 0x01E9, 0x0090, 0x000F, 0x00E8, 0x00E9, 0x00F6, 0x0005, + 0x00F0, 0x00F1, 0x0037, 0x0010, 0x00EA, 0x00EB, 0x00F7, 0x0011, + 0x00EC, 0x00ED, 0x0034, 0x0000, 0x003E, 0x003F, 0x0002 + }, + { + 0x003C, 0x003D, 0x01CF, 0x0000, 0x00BF, 0x00E0, 0x01FC, 0x0001, + 0x00E1, 0x00E2, 0x01FD, 0x0009, 0x01F1, 0x01F2, 0x01F3, 0x0002, + 0x00E3, 0x00E4, 0x01FE, 0x0011, 0x03EE, 0x03EF, 0x03F0, 0x0021, + 0x07E2, 0x07E3, 0x07E4, 0x0018, 0x03F7, 0x03FE, 0x03FF, 0x0003, + 0x00E5, 0x00E6, 0x0080, 0x002E, 0x07E5, 0x07E6, 0x07E7, 0x0016, + 0x03F4, 0x03F5, 0x03F6, 0x0019, 0x0102, 0x0103, 0x0104, 0x000A, + 0x01F4, 0x01F5, 0x01F6, 0x001A, 0x0105, 0x0106, 0x0107, 0x001B, + 0x0178, 0x0179, 0x01CE, 0x001D, 0x00BD, 0x00BE, 0x01F0 + }, + { + 0x0003, 0x0004, 0x01B6, 0x0004, 0x002E, 0x002F, 0x000E, 0x0005, + 0x0030, 0x0031, 0x000F, 0x0003, 0x000A, 0x000B, 0x0014, 0x0006, + 0x0032, 0x0033, 0x0010, 0x0005, 0x0030, 0x0031, 0x0032, 0x0009, + 0x0066, 0x0067, 0x0068, 0x001D, 0x01B7, 0x01B8, 0x01B9, 0x0007, + 0x0034, 0x0035, 0x0011, 0x0016, 0x0069, 0x006A, 0x006B, 0x000A, + 0x0036, 0x0037, 0x00D8, 0x001E, 0x01BA, 0x01BB, 0x01BC, 0x0004, + 0x0015, 0x0016, 0x0017, 0x001F, 0x01BD, 0x01BE, 0x01BF, 0x0000, + 0x0010, 0x0011, 0x0012, 0x001C, 0x00D9, 0x00DA, 0x0013 } }; const uint8_t ff_vc1_icbpcy_p_bits[8][63] = { { - 15, 15, 14, 9, 11, 11, 13, 9, 11, 11, 12, 8, 9, - 9, 9, 9, 11, 11, 12, 9, 10, 10, 10, 10, 11, 11, 11, - 8, 8, 8, 7, 9, 11, 11, 12, 10, 11, 11, 11, 9, 10, - 10, 10, 8, 8, 8, 7, 8, 9, 9, 9, 8, 8, 8, 7, - 8, 8, 8, 7, 3, 3, 3, 1 - }, { - 7, 7, 9, 7, 8, 8, 9, 7, 8, 8, 9, 6, 7, - 7, 7, 7, 7, 7, 9, 7, 8, 8, 8, 8, 9, 9, 9, - 6, 7, 7, 6, 6, 7, 7, 8, 8, 9, 9, 9, 7, 8, - 8, 8, 6, 7, 7, 6, 6, 7, 7, 7, 6, 7, 7, 6, - 6, 7, 7, 6, 3, 4, 3, 2 - }, { - 6, 6, 5, 6, 8, 8, 9, 6, 8, 8, 9, 5, 7, - 7, 7, 6, 8, 8, 9, 7, 8, 8, 8, 8, 9, 9, 9, - 6, 7, 7, 6, 6, 8, 8, 9, 7, 9, 9, 9, 6, 8, - 8, 8, 6, 7, 7, 6, 5, 7, 7, 7, 6, 7, 7, 6, - 6, 7, 7, 6, 3, 5, 4, 2 - }, { - 6, 6, 8, 4, 9, 9, 9, 4, 9, 9, 9, 4, 8, - 8, 7, 4, 9, 9, 9, 6, 9, 9, 8, 6, 10, 10, 9, - 5, 8, 8, 8, 4, 9, 9, 9, 6, 10, 10, 9, 5, 9, - 9, 8, 5, 8, 8, 7, 4, 8, 8, 7, 5, 8, 8, 7, - 5, 8, 8, 7, 3, 5, 5, 4 - }, { - 6, 6, 5, 5, 7, 7, 7, 5, 7, 7, 7, 5, 6, - 6, 6, 5, 7, 7, 7, 6, 7, 7, 7, 7, 8, 8, 8, - 6, 7, 7, 6, 5, 7, 7, 7, 7, 8, 8, 8, 6, 7, - 7, 7, 6, 7, 7, 6, 5, 6, 6, 6, 6, 7, 7, 6, - 6, 7, 6, 6, 4, 5, 5, 3 - }, { - 6, 6, 8, 4, 8, 8, 8, 4, 8, 8, 8, 4, 8, - 8, 7, 4, 8, 8, 8, 5, 9, 9, 8, 6, 10, 10, 9, - 5, 8, 8, 8, 4, 8, 8, 8, 6, 10, 10, 9, 5, 9, - 9, 8, 5, 8, 8, 8, 4, 8, 8, 7, 5, 8, 8, 8, - 5, 8, 8, 7, 3, 6, 6, 4 - }, { - 6, 6, 9, 3, 8, 8, 9, 3, 8, 8, 9, 4, 9, - 9, 9, 3, 8, 8, 9, 5, 10, 10, 10, 6, 11, 11, 11, - 5, 10, 10, 10, 3, 8, 8, 8, 6, 11, 11, 11, 5, 10, - 10, 10, 5, 9, 9, 9, 4, 9, 9, 9, 5, 9, 9, 9, - 5, 9, 9, 9, 5, 8, 8, 9 - }, { - 6, 6, 10, 3, 7, 7, 7, 3, 7, 7, 7, 4, 8, - 8, 8, 3, 7, 7, 7, 5, 9, 9, 9, 6, 10, 10, 10, - 6, 10, 10, 10, 3, 7, 7, 7, 6, 10, 10, 10, 5, 9, - 9, 9, 6, 10, 10, 10, 4, 8, 8, 8, 6, 10, 10, 10, - 5, 9, 9, 9, 6, 9, 9, 9 + 15, 15, 14, 9, 11, 11, 13, 9, 11, 11, 12, 8, 9, 9, 9, 9, + 11, 11, 12, 9, 10, 10, 10, 10, 11, 11, 11, 8, 8, 8, 7, 9, + 11, 11, 12, 10, 11, 11, 11, 9, 10, 10, 10, 8, 8, 8, 7, 8, + 9, 9, 9, 8, 8, 8, 7, 8, 8, 8, 7, 3, 3, 3, 1 + }, + { + 7, 7, 9, 7, 8, 8, 9, 7, 8, 8, 9, 6, 7, 7, 7, 7, + 7, 7, 9, 7, 8, 8, 8, 8, 9, 9, 9, 6, 7, 7, 6, 6, + 7, 7, 8, 8, 9, 9, 9, 7, 8, 8, 8, 6, 7, 7, 6, 6, + 7, 7, 7, 6, 7, 7, 6, 6, 7, 7, 6, 3, 4, 3, 2 + }, + { + 6, 6, 5, 6, 8, 8, 9, 6, 8, 8, 9, 5, 7, 7, 7, 6, + 8, 8, 9, 7, 8, 8, 8, 8, 9, 9, 9, 6, 7, 7, 6, 6, + 8, 8, 9, 7, 9, 9, 9, 6, 8, 8, 8, 6, 7, 7, 6, 5, + 7, 7, 7, 6, 7, 7, 6, 6, 7, 7, 6, 3, 5, 4, 2 + }, + { + 6, 6, 8, 4, 9, 9, 9, 4, 9, 9, 9, 4, 8, 8, 7, 4, + 9, 9, 9, 6, 9, 9, 8, 6, 10, 10, 9, 5, 8, 8, 8, 4, + 9, 9, 9, 6, 10, 10, 9, 5, 9, 9, 8, 5, 8, 8, 7, 4, + 8, 8, 7, 5, 8, 8, 7, 5, 8, 8, 7, 3, 5, 5, 4 + }, + { + 6, 6, 5, 5, 7, 7, 7, 5, 7, 7, 7, 5, 6, 6, 6, 5, + 7, 7, 7, 6, 7, 7, 7, 7, 8, 8, 8, 6, 7, 7, 6, 5, + 7, 7, 7, 7, 8, 8, 8, 6, 7, 7, 7, 6, 7, 7, 6, 5, + 6, 6, 6, 6, 7, 7, 6, 6, 7, 6, 6, 4, 5, 5, 3 + }, + { + 6, 6, 8, 4, 8, 8, 8, 4, 8, 8, 8, 4, 8, 8, 7, 4, + 8, 8, 8, 5, 9, 9, 8, 6, 10, 10, 9, 5, 8, 8, 8, 4, + 8, 8, 8, 6, 10, 10, 9, 5, 9, 9, 8, 5, 8, 8, 8, 4, + 8, 8, 7, 5, 8, 8, 8, 5, 8, 8, 7, 3, 6, 6, 4 + }, + { + 6, 6, 9, 3, 8, 8, 9, 3, 8, 8, 9, 4, 9, 9, 9, 3, + 8, 8, 9, 5, 10, 10, 10, 6, 11, 11, 11, 5, 10, 10, 10, 3, + 8, 8, 8, 6, 11, 11, 11, 5, 10, 10, 10, 5, 9, 9, 9, 4, + 9, 9, 9, 5, 9, 9, 9, 5, 9, 9, 9, 5, 8, 8, 9 + }, + { + 6, 6, 10, 3, 7, 7, 7, 3, 7, 7, 7, 4, 8, 8, 8, 3, + 7, 7, 7, 5, 9, 9, 9, 6, 10, 10, 10, 6, 10, 10, 10, 3, + 7, 7, 7, 6, 10, 10, 10, 5, 9, 9, 9, 6, 10, 10, 10, 4, + 8, 8, 8, 6, 10, 10, 10, 5, 9, 9, 9, 6, 9, 9, 9 } }; @@ -759,26 +911,26 @@ const uint8_t ff_vc1_ttmb_bits[3][16] = { /* TTBLK (Transform Type per Block) tables */ const uint8_t ff_vc1_ttblk_codes[3][8] = { - { 0, 1, 3, 5, 16, 17, 18, 19}, - { 3, 0, 1, 2, 3, 5, 8, 9}, - { 1, 0, 1, 4, 6, 7, 10, 11} + { 0, 1, 3, 5, 16, 17, 18, 19 }, + { 3, 0, 1, 2, 3, 5, 8, 9 }, + { 1, 0, 1, 4, 6, 7, 10, 11 } }; const uint8_t ff_vc1_ttblk_bits[3][8] = { - { 2, 2, 2, 3, 5, 5, 5, 5}, - { 2, 3, 3, 3, 3, 3, 4, 4}, - { 2, 3, 3, 3, 3, 3, 4, 4} + { 2, 2, 2, 3, 5, 5, 5, 5 }, + { 2, 3, 3, 3, 3, 3, 4, 4 }, + { 2, 3, 3, 3, 3, 3, 4, 4 } }; /* SUBBLKPAT tables, p93-94, reordered */ const uint8_t ff_vc1_subblkpat_codes[3][15] = { - { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1}, - { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1}, - { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15} + { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1 }, + { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1 }, + { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15 } }; const uint8_t ff_vc1_subblkpat_bits[3][15] = { - { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1}, - { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2}, - { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4} + { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1}, + { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2}, + { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4} }; /* MV differential tables, p265 */ @@ -867,118 +1019,113 @@ const uint8_t ff_vc1_mv_diff_bits[4][73] = { /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ /* Table 232 */ -const int8_t ff_vc1_simple_progressive_4x4_zz [16] = -{ - 0, 8, 16, 1, - 9, 24, 17, 2, - 10, 18, 25, 3, - 11, 26, 19, 27 -}; - -const int8_t ff_vc1_adv_progressive_8x4_zz [32] = /* Table 233 */ -{ - 0, 8, 1, 16, 2, 9, 10, 3, - 24, 17, 4, 11, 18, 12, 5, 19, - 25, 13, 20, 26, 27, 6, 21, 28, - 14, 22, 29, 7, 30, 15, 23, 31 -}; - -const int8_t ff_vc1_adv_progressive_4x8_zz [32] = /* Table 234 */ -{ - 0, 1, 8, 2, - 9, 16, 17, 24, - 10, 32, 25, 18, - 40, 3, 33, 26, - 48, 11, 56, 41, - 34, 49, 57, 42, - 19, 50, 27, 58, - 35, 43, 51, 59 -}; - -const int8_t ff_vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */ -{ - 0, 8, 1, 16, 24, 9, 2, 32, - 40, 48, 56, 17, 10, 3, 25, 18, - 11, 4, 33, 41, 49, 57, 26, 34, - 42, 50, 58, 19, 12, 5, 27, 20, - 13, 6, 35, 28, 21, 14, 7, 15, - 22, 29, 36, 43, 51, 59, 60, 52, - 44, 37, 30, 23, 31, 38, 45, 53, - 61, 62, 54, 46, 39, 47, 55, 63 -}; - -const int8_t ff_vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */ -{ - 0, 8, 16, 24, 1, 9, 2, 17, - 25, 10, 3, 18, 26, 4, 11, 19, - 12, 5, 13, 20, 27, 6, 21, 28, - 14, 22, 29, 7, 30, 15, 23, 31 -}; - -const int8_t ff_vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */ -{ - 0, 1, 2, 8, - 16, 9, 24, 17, - 10, 3, 32, 40, - 48, 56, 25, 18, - 33, 26, 41, 34, - 49, 57, 11, 42, - 19, 50, 27, 58, - 35, 43, 51, 59 -}; - -const int8_t ff_vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */ -{ - 0, 8, 16, 24, - 1, 9, 17, 2, - 25, 10, 18, 3, - 26, 11, 19, 27 +const int8_t ff_vc1_simple_progressive_4x4_zz [16] = { + 0, 8, 16, 1, + 9, 24, 17, 2, + 10, 18, 25, 3, + 11, 26, 19, 27 +}; + +const int8_t ff_vc1_adv_progressive_8x4_zz [32] = { /* Table 233 */ + 0, 8, 1, 16, 2, 9, 10, 3, + 24, 17, 4, 11, 18, 12, 5, 19, + 25, 13, 20, 26, 27, 6, 21, 28, + 14, 22, 29, 7, 30, 15, 23, 31 +}; + +const int8_t ff_vc1_adv_progressive_4x8_zz [32] = { /* Table 234 */ + 0, 1, 8, 2, + 9, 16, 17, 24, + 10, 32, 25, 18, + 40, 3, 33, 26, + 48, 11, 56, 41, + 34, 49, 57, 42, + 19, 50, 27, 58, + 35, 43, 51, 59 +}; + +const int8_t ff_vc1_adv_interlaced_8x8_zz [64] = { /* Table 235 */ + 0, 8, 1, 16, 24, 9, 2, 32, + 40, 48, 56, 17, 10, 3, 25, 18, + 11, 4, 33, 41, 49, 57, 26, 34, + 42, 50, 58, 19, 12, 5, 27, 20, + 13, 6, 35, 28, 21, 14, 7, 15, + 22, 29, 36, 43, 51, 59, 60, 52, + 44, 37, 30, 23, 31, 38, 45, 53, + 61, 62, 54, 46, 39, 47, 55, 63 +}; + +const int8_t ff_vc1_adv_interlaced_8x4_zz [32] = { /* Table 236 */ + 0, 8, 16, 24, 1, 9, 2, 17, + 25, 10, 3, 18, 26, 4, 11, 19, + 12, 5, 13, 20, 27, 6, 21, 28, + 14, 22, 29, 7, 30, 15, 23, 31 +}; + +const int8_t ff_vc1_adv_interlaced_4x8_zz [32] = { /* Table 237 */ + 0, 1, 2, 8, + 16, 9, 24, 17, + 10, 3, 32, 40, + 48, 56, 25, 18, + 33, 26, 41, 34, + 49, 57, 11, 42, + 19, 50, 27, 58, + 35, 43, 51, 59 +}; + +const int8_t ff_vc1_adv_interlaced_4x4_zz [16] = { /* Table 238 */ + 0, 8, 16, 24, + 1, 9, 17, 2, + 25, 10, 18, 3, + 26, 11, 19, 27 }; /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */ const int32_t ff_vc1_dqscale[63] = { -0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000, - 0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000, - 0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB, - 0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000, - 0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A, - 0x18FA, 0x1862, 0x17D0, 0x1746, 0x16C1, 0x1643, 0x15CA, 0x1555, - 0x14E6, 0x147B, 0x1414, 0x13B1, 0x1352, 0x12F7, 0x129E, 0x1249, - 0x11F7, 0x11A8, 0x115B, 0x1111, 0x10C9, 0x1084, 0x1000 + 0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000, + 0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000, + 0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB, + 0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000, + 0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A, + 0x18FA, 0x1862, 0x17D0, 0x1746, 0x16C1, 0x1643, 0x15CA, 0x1555, + 0x14E6, 0x147B, 0x1414, 0x13B1, 0x1352, 0x12F7, 0x129E, 0x1249, + 0x11F7, 0x11A8, 0x115B, 0x1111, 0x10C9, 0x1084, 0x1000 }; /* P Interlaced field picture MV predictor scaling values (Table 114) */ const uint16_t vc1_field_mvpred_scales[2][7][4] = { -// Refdist 0 1 2 3 or greater +// Refdist: +// 0 1 2 3 or greater { // current field is first - { 128, 192, 213, 224}, // SCALEOPP - { 512, 341, 307, 293}, // SCALESAME1 - { 219, 236, 242, 245}, // SCALESAME2 - { 32, 48, 53, 56}, // SCALEZONE1_X - { 8, 12, 13, 14}, // SCALEZONE1_Y - { 37, 20, 14, 11}, // ZONE1OFFSET_X - { 10, 5, 4, 3} // ZONE1OFFSET_Y + { 128, 192, 213, 224 }, // SCALEOPP + { 512, 341, 307, 293 }, // SCALESAME1 + { 219, 236, 242, 245 }, // SCALESAME2 + { 32, 48, 53, 56 }, // SCALEZONE1_X + { 8, 12, 13, 14 }, // SCALEZONE1_Y + { 37, 20, 14, 11 }, // ZONE1OFFSET_X + { 10, 5, 4, 3 } // ZONE1OFFSET_Y }, { // current field is second - { 128, 64, 43, 32}, // SCALEOPP - { 512, 1024, 1536, 2048}, // SCALESAME1 - { 219, 204, 200, 198}, // SCALESAME2 - { 32, 16, 11, 8}, // SCALEZONE1_X - { 8, 4, 3, 2}, // SCALEZONE1_Y - { 37, 52, 56, 58}, // ZONE1OFFSET_X - { 10, 13, 14, 15} // ZONE1OFFSET_Y + { 128, 64, 43, 32 }, // SCALEOPP + { 512, 1024, 1536, 2048 }, // SCALESAME1 + { 219, 204, 200, 198 }, // SCALESAME2 + { 32, 16, 11, 8 }, // SCALEZONE1_X + { 8, 4, 3, 2 }, // SCALEZONE1_Y + { 37, 52, 56, 58 }, // ZONE1OFFSET_X + { 10, 13, 14, 15 } // ZONE1OFFSET_Y } }; /* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */ const uint16_t vc1_b_field_mvpred_scales[7][4] = { -// BRFD 0 1 2 3 or greater - { 171, 205, 219, 228}, // SCALESAME - { 384, 320, 299, 288}, // SCALEOPP1 - { 230, 239, 244, 246}, // SCALEOPP2 - { 43, 51, 55, 57}, // SCALEZONE1_X - { 11, 13, 14, 14}, // SCALEZONE1_Y - { 26, 17, 12, 10}, // ZONE1OFFSET_X - { 7, 4, 3, 3} // ZONE1OFFSET_Y + // BRFD: + // 0 1 2 3 or greater + { 171, 205, 219, 228 }, // SCALESAME + { 384, 320, 299, 288 }, // SCALEOPP1 + { 230, 239, 244, 246 }, // SCALEOPP2 + { 43, 51, 55, 57 }, // SCALEZONE1_X + { 11, 13, 14, 14 }, // SCALEZONE1_Y + { 26, 17, 12, 10 }, // ZONE1OFFSET_X + { 7, 4, 3, 3 } // ZONE1OFFSET_Y }; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index b56711e457..d23d04c3c8 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -24,8 +24,8 @@ /** * @file * VC-1 and WMV3 decoder - * */ + #include "internal.h" #include "dsputil.h" #include "avcodec.h" @@ -59,8 +59,8 @@ static const uint16_t vlc_offs[] = { }; // offset tables for interlaced picture MVDATA decoding -static const int offset_table1[9] = { 0, 1, 2, 4, 8, 16, 32, 64, 128}; -static const int offset_table2[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255}; +static const int offset_table1[9] = { 0, 1, 2, 4, 8, 16, 32, 64, 128 }; +static const int offset_table2[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 }; /** * Init VC-1 specific tables and VC1Context members @@ -76,121 +76,118 @@ static int vc1_init_common(VC1Context *v) v->hrd_rate = v->hrd_buffer = NULL; /* VLC tables */ - if(!done) - { + if (!done) { INIT_VLC_STATIC(&ff_vc1_bfraction_vlc, VC1_BFRACTION_VLC_BITS, 23, - ff_vc1_bfraction_bits, 1, 1, - ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS); + ff_vc1_bfraction_bits, 1, 1, + ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS); INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, - ff_vc1_norm2_bits, 1, 1, - ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); + ff_vc1_norm2_bits, 1, 1, + ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64, - ff_vc1_norm6_bits, 1, 1, - ff_vc1_norm6_codes, 2, 2, 556); + ff_vc1_norm6_bits, 1, 1, + ff_vc1_norm6_codes, 2, 2, 556); INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7, - ff_vc1_imode_bits, 1, 1, - ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS); - for (i=0; i<3; i++) - { - ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i*3+0]]; - ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i*3+1] - vlc_offs[i*3+0]; + ff_vc1_imode_bits, 1, 1, + ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS); + for (i = 0; i < 3; i++) { + ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 0]]; + ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0]; init_vlc(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16, ff_vc1_ttmb_bits[i], 1, 1, ff_vc1_ttmb_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); - ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i*3+1]]; - ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i*3+2] - vlc_offs[i*3+1]; + ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 1]]; + ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1]; init_vlc(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8, ff_vc1_ttblk_bits[i], 1, 1, ff_vc1_ttblk_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); - ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i*3+2]]; - ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i*3+3] - vlc_offs[i*3+2]; + ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 2]]; + ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i * 3 + 3] - vlc_offs[i * 3 + 2]; init_vlc(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15, ff_vc1_subblkpat_bits[i], 1, 1, ff_vc1_subblkpat_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); } - for(i=0; i<4; i++) - { - ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i*3+9]]; - ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i*3+10] - vlc_offs[i*3+9]; + for (i = 0; i < 4; i++) { + ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 9]]; + ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i * 3 + 10] - vlc_offs[i * 3 + 9]; init_vlc(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16, ff_vc1_4mv_block_pattern_bits[i], 1, 1, ff_vc1_4mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); - ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i*3+10]]; - ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i*3+11] - vlc_offs[i*3+10]; + ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 10]]; + ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i * 3 + 11] - vlc_offs[i * 3 + 10]; init_vlc(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64, ff_vc1_cbpcy_p_bits[i], 1, 1, ff_vc1_cbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); - ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i*3+11]]; - ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i*3+12] - vlc_offs[i*3+11]; + ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 11]]; + ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i * 3 + 12] - vlc_offs[i * 3 + 11]; init_vlc(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73, ff_vc1_mv_diff_bits[i], 1, 1, ff_vc1_mv_diff_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); } - for(i=0; i<8; i++){ - ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i*2+21]]; - ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i*2+22] - vlc_offs[i*2+21]; + for (i = 0; i < 8; i++) { + ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i * 2 + 21]]; + ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i * 2 + 22] - vlc_offs[i * 2 + 21]; init_vlc(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, vc1_ac_sizes[i], &vc1_ac_tables[i][0][1], 8, 4, &vc1_ac_tables[i][0][0], 8, 4, INIT_VLC_USE_NEW_STATIC); /* initialize interlaced MVDATA tables (2-Ref) */ - ff_vc1_2ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i*2+22]]; - ff_vc1_2ref_mvdata_vlc[i].table_allocated = vlc_offs[i*2+23] - vlc_offs[i*2+22]; + ff_vc1_2ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 2 + 22]]; + ff_vc1_2ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 2 + 23] - vlc_offs[i * 2 + 22]; init_vlc(&ff_vc1_2ref_mvdata_vlc[i], VC1_2REF_MVDATA_VLC_BITS, 126, ff_vc1_2ref_mvdata_bits[i], 1, 1, ff_vc1_2ref_mvdata_codes[i], 4, 4, INIT_VLC_USE_NEW_STATIC); } - for (i=0; i<4; i++) { + for (i = 0; i < 4; i++) { /* initialize 4MV MBMODE VLC tables for interlaced frame P picture */ - ff_vc1_intfr_4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i*3+37]]; - ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i*3+38] - vlc_offs[i*3+37]; + ff_vc1_intfr_4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 37]]; + ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 38] - vlc_offs[i * 3 + 37]; init_vlc(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15, ff_vc1_intfr_4mv_mbmode_bits[i], 1, 1, ff_vc1_intfr_4mv_mbmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); /* initialize NON-4MV MBMODE VLC tables for the same */ - ff_vc1_intfr_non4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i*3+38]]; - ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i*3+39] - vlc_offs[i*3+38]; + ff_vc1_intfr_non4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 38]]; + ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 39] - vlc_offs[i * 3 + 38]; init_vlc(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9, ff_vc1_intfr_non4mv_mbmode_bits[i], 1, 1, ff_vc1_intfr_non4mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); /* initialize interlaced MVDATA tables (1-Ref) */ - ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i*3+39]]; - ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i*3+40] - vlc_offs[i*3+39]; + ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 39]]; + ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 3 + 40] - vlc_offs[i * 3 + 39]; init_vlc(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72, ff_vc1_1ref_mvdata_bits[i], 1, 1, ff_vc1_1ref_mvdata_codes[i], 4, 4, INIT_VLC_USE_NEW_STATIC); } - for (i=0; i<4; i++) { + for (i = 0; i < 4; i++) { /* Initialize 2MV Block pattern VLC tables */ - ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i+49]]; - ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i+50] - vlc_offs[i+49]; + ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i + 49]]; + ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i + 50] - vlc_offs[i + 49]; init_vlc(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4, - ff_vc1_2mv_block_pattern_bits[i], 1, 1, - ff_vc1_2mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); + ff_vc1_2mv_block_pattern_bits[i], 1, 1, + ff_vc1_2mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); } - for (i=0; i<8; i++) { + for (i = 0; i < 8; i++) { /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */ - ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i*3+53]]; - ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i*3+54] - vlc_offs[i*3+53]; + ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 53]]; + ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53]; init_vlc(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63, - ff_vc1_icbpcy_p_bits[i], 1, 1, - ff_vc1_icbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); + ff_vc1_icbpcy_p_bits[i], 1, 1, + ff_vc1_icbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); /* Initialize interlaced field picture MBMODE VLC tables */ - ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i*3+54]]; - ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i*3+55] - vlc_offs[i*3+54]; + ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 54]]; + ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54]; init_vlc(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8, - ff_vc1_if_mmv_mbmode_bits[i], 1, 1, - ff_vc1_if_mmv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); - ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i*3+55]]; - ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i*3+56] - vlc_offs[i*3+55]; + ff_vc1_if_mmv_mbmode_bits[i], 1, 1, + ff_vc1_if_mmv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); + ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 55]]; + ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 56] - vlc_offs[i * 3 + 55]; init_vlc(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6, - ff_vc1_if_1mv_mbmode_bits[i], 1, 1, - ff_vc1_if_1mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); + ff_vc1_if_1mv_mbmode_bits[i], 1, 1, + ff_vc1_if_1mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); } done = 1; } /* Other defaults */ - v->pq = -1; + v->pq = -1; v->mvrange = 0; /* 7.1.1.18, p80 */ return 0; @@ -238,9 +235,9 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v) if (!s->first_slice_line) { if (s->mb_x) { topleft_mb_pos = (s->mb_y - 1) * s->mb_stride + s->mb_x - 1; - fieldtx = v->fieldtx_plane[topleft_mb_pos]; - stride_y = (s->linesize) << fieldtx; - v_dist = (16 - fieldtx) >> (fieldtx == 0); + fieldtx = v->fieldtx_plane[topleft_mb_pos]; + stride_y = (s->linesize) << fieldtx; + v_dist = (16 - fieldtx) >> (fieldtx == 0); s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][0], s->dest[0] - 16 * s->linesize - 16, stride_y); @@ -262,9 +259,9 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v) } if (s->mb_x == s->mb_width - 1) { top_mb_pos = (s->mb_y - 1) * s->mb_stride + s->mb_x; - fieldtx = v->fieldtx_plane[top_mb_pos]; - stride_y = s->linesize << fieldtx; - v_dist = fieldtx ? 15 : 8; + fieldtx = v->fieldtx_plane[top_mb_pos]; + stride_y = s->linesize << fieldtx; + v_dist = fieldtx ? 15 : 8; s->dsp.put_signed_pixels_clamped(v->block[v->top_blk_idx][0], s->dest[0] - 16 * s->linesize, stride_y); @@ -305,17 +302,17 @@ static void vc1_loop_filter_iblk(VC1Context *v, int pq) if (!s->first_slice_line) { v->vc1dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq); if (s->mb_x) - v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq); - v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq); - for(j = 0; j < 2; j++){ - v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, s->linesize, pq); + for (j = 0; j < 2; j++) { + v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1], s->uvlinesize, pq); if (s->mb_x) - v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); } } - v->vc1dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq); + v->vc1dsp.vc1_v_loop_filter16(s->dest[0] + 8 * s->linesize, s->linesize, pq); - if (s->mb_y == s->end_mb_y-1) { + if (s->mb_y == s->end_mb_y - 1) { if (s->mb_x) { v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); v->vc1dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq); @@ -340,10 +337,10 @@ static void vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) if (s->mb_x >= 2) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 16, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize - 8, s->linesize, pq); - for(j = 0; j < 2; j++) { - v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); + for (j = 0; j < 2; j++) { + v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); if (s->mb_x >= 2) { - v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 16 * s->uvlinesize - 8, s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 16 * s->uvlinesize - 8, s->uvlinesize, pq); } } } @@ -357,10 +354,10 @@ static void vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) if (s->mb_x) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 32 * s->linesize + 8, s->linesize, pq); - for(j = 0; j < 2; j++) { - v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize, s->uvlinesize, pq); + for (j = 0; j < 2; j++) { + v->vc1dsp.vc1_v_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); if (s->mb_x >= 2) { - v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 16 * s->uvlinesize, s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 16 * s->uvlinesize, s->uvlinesize, pq); } } } @@ -373,8 +370,8 @@ static void vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 16, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize - 8, s->linesize, pq); if (s->mb_x >= 2) { - for(j = 0; j < 2; j++) { - v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); + for (j = 0; j < 2; j++) { + v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize - 8, s->uvlinesize, pq); } } } @@ -384,8 +381,8 @@ static void vc1_loop_filter_iblk_delayed(VC1Context *v, int pq) v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize, s->linesize, pq); v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16 * s->linesize + 8, s->linesize, pq); if (s->mb_x) { - for(j = 0; j < 2; j++) { - v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1] - 8 * s->uvlinesize, s->uvlinesize, pq); + for (j = 0; j < 2; j++) { + v->vc1dsp.vc1_h_loop_filter8(s->dest[j + 1] - 8 * s->uvlinesize, s->uvlinesize, pq); } } } @@ -410,14 +407,14 @@ static void vc1_smooth_overlap_filter_iblk(VC1Context *v) * running the V overlap. Therefore, the V overlap makes us trail by one * MB col and the H overlap filter makes us trail by one MB row. This * is reflected in the time at which we run the put_pixels loop. */ - if(v->condover == CONDOVER_ALL || v->pq >= 9 || v->over_flags_plane[mb_pos]) { - if(s->mb_x && (v->condover == CONDOVER_ALL || v->pq >= 9 || - v->over_flags_plane[mb_pos - 1])) { + if (v->condover == CONDOVER_ALL || v->pq >= 9 || v->over_flags_plane[mb_pos]) { + if (s->mb_x && (v->condover == CONDOVER_ALL || v->pq >= 9 || + v->over_flags_plane[mb_pos - 1])) { v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][1], v->block[v->cur_blk_idx][0]); v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][3], v->block[v->cur_blk_idx][2]); - if(!(s->flags & CODEC_FLAG_GRAY)) { + if (!(s->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][4], v->block[v->cur_blk_idx][4]); v->vc1dsp.vc1_h_s_overlap(v->block[v->left_blk_idx][5], @@ -430,13 +427,13 @@ static void vc1_smooth_overlap_filter_iblk(VC1Context *v) v->block[v->cur_blk_idx][3]); if (s->mb_x == s->mb_width - 1) { - if(!s->first_slice_line && (v->condover == CONDOVER_ALL || v->pq >= 9 || - v->over_flags_plane[mb_pos - s->mb_stride])) { + if (!s->first_slice_line && (v->condover == CONDOVER_ALL || v->pq >= 9 || + v->over_flags_plane[mb_pos - s->mb_stride])) { v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][2], v->block[v->cur_blk_idx][0]); v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][3], v->block[v->cur_blk_idx][1]); - if(!(s->flags & CODEC_FLAG_GRAY)) { + if (!(s->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][4], v->block[v->cur_blk_idx][4]); v->vc1dsp.vc1_v_s_overlap(v->block[v->top_blk_idx][5], @@ -450,13 +447,13 @@ static void vc1_smooth_overlap_filter_iblk(VC1Context *v) } } if (s->mb_x && (v->condover == CONDOVER_ALL || v->over_flags_plane[mb_pos - 1])) { - if(!s->first_slice_line && (v->condover == CONDOVER_ALL || v->pq >= 9 || - v->over_flags_plane[mb_pos - s->mb_stride - 1])) { + if (!s->first_slice_line && (v->condover == CONDOVER_ALL || v->pq >= 9 || + v->over_flags_plane[mb_pos - s->mb_stride - 1])) { v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][2], v->block[v->left_blk_idx][0]); v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][3], v->block[v->left_blk_idx][1]); - if(!(s->flags & CODEC_FLAG_GRAY)) { + if (!(s->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][4], v->block[v->left_blk_idx][4]); v->vc1dsp.vc1_v_s_overlap(v->block[v->topleft_blk_idx][5], @@ -476,7 +473,7 @@ static void vc1_smooth_overlap_filter_iblk(VC1Context *v) static void vc1_mc_1mv(VC1Context *v, int dir) { MpegEncContext *s = &v->s; - DSPContext *dsp = &v->s.dsp; + DSPContext *dsp = &v->s.dsp; uint8_t *srcY, *srcU, *srcV; int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int off, off_uv; @@ -488,7 +485,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir) my = s->mv[dir][0][1]; // store motion vectors for further use in B frames - if(s->pict_type == AV_PICTURE_TYPE_P) { + if (s->pict_type == AV_PICTURE_TYPE_P) { s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = mx; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = my; } @@ -500,13 +497,13 @@ static void vc1_mc_1mv(VC1Context *v, int dir) if (v->field_mode && v->cur_field_type != v->ref_field_type[dir]) { - my = my - 2 + 4 * v->cur_field_type; + my = my - 2 + 4 * v->cur_field_type; uvmy = uvmy - 2 + 4 * v->cur_field_type; } - if(v->fastuvmc && (v->fcm != 1)) { // fastuvmc shall be ignored for interlaced frame picture - uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); - uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); + if (v->fastuvmc && (v->fcm != 1)) { // fastuvmc shall be ignored for interlaced frame picture + uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1)); + uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1)); } if (v->field_mode) { // interlaced field picture if (!dir) { @@ -525,7 +522,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir) srcV = s->next_picture.f.data[2]; } } else { - if(!dir) { + if (!dir) { srcY = s->last_picture.f.data[0]; srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; @@ -536,24 +533,24 @@ static void vc1_mc_1mv(VC1Context *v, int dir) } } - src_x = s->mb_x * 16 + (mx >> 2); - src_y = s->mb_y * 16 + (my >> 2); - uvsrc_x = s->mb_x * 8 + (uvmx >> 2); - uvsrc_y = s->mb_y * 8 + (uvmy >> 2); + src_x = s->mb_x * 16 + (mx >> 2); + src_y = s->mb_y * 16 + (my >> 2); + uvsrc_x = s->mb_x * 8 + (uvmx >> 2); + uvsrc_y = s->mb_y * 8 + (uvmy >> 2); - if(v->profile != PROFILE_ADVANCED){ + if (v->profile != PROFILE_ADVANCED) { src_x = av_clip( src_x, -16, s->mb_width * 16); src_y = av_clip( src_y, -16, s->mb_height * 16); uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); - }else{ + } else { src_x = av_clip( src_x, -17, s->avctx->coded_width); src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } - srcY += src_y * s->linesize + src_x; + srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; @@ -564,63 +561,69 @@ static void vc1_mc_1mv(VC1Context *v, int dir) } /* for grayscale we should not try to read from unknown area */ - if(s->flags & CODEC_FLAG_GRAY) { + if (s->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } - if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) - || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3 - || (unsigned)(src_y - s->mspel) > v_edge_pos - (my&3) - 16 - s->mspel*3){ - uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; + if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) + || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel * 3 + || (unsigned)(src_y - s->mspel) > v_edge_pos - (my&3) - 16 - s->mspel * 3) { + uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); - s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, - src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, + 17 + s->mspel * 2, 17 + s->mspel * 2, + src_x - s->mspel, src_y - s->mspel, + s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; - s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, - uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); - s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, - uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8 + 1, 8 + 1, + uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1, + uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; /* if we deal with range reduction we need to scale source blocks */ - if(v->rangeredfrm) { + if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; src = srcY; - for(j = 0; j < 17 + s->mspel*2; j++) { - for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; + for (j = 0; j < 17 + s->mspel * 2; j++) { + for (i = 0; i < 17 + s->mspel * 2; i++) + src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize; } - src = srcU; src2 = srcV; - for(j = 0; j < 9; j++) { - for(i = 0; i < 9; i++) { - src[i] = ((src[i] - 128) >> 1) + 128; + src = srcU; + src2 = srcV; + for (j = 0; j < 9; j++) { + for (i = 0; i < 9; i++) { + src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } - src += s->uvlinesize; + src += s->uvlinesize; src2 += s->uvlinesize; } } /* if we deal with intensity compensation we need to scale source blocks */ - if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src, *src2; src = srcY; - for(j = 0; j < 17 + s->mspel*2; j++) { - for(i = 0; i < 17 + s->mspel*2; i++) src[i] = v->luty[src[i]]; + for (j = 0; j < 17 + s->mspel * 2; j++) { + for (i = 0; i < 17 + s->mspel * 2; i++) + src[i] = v->luty[src[i]]; src += s->linesize; } - src = srcU; src2 = srcV; - for(j = 0; j < 9; j++) { - for(i = 0; i < 9; i++) { - src[i] = v->lutuv[src[i]]; + src = srcU; + src2 = srcV; + for (j = 0; j < 9; j++) { + for (i = 0; i < 9; i++) { + src[i] = v->lutuv[src[i]]; src2[i] = v->lutuv[src2[i]]; } - src += s->uvlinesize; + src += s->uvlinesize; src2 += s->uvlinesize; } } @@ -634,7 +637,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir) off = 0; off_uv = 0; } - if(s->mspel) { + if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off , srcY , s->linesize, v->rnd); v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8, srcY + 8, s->linesize, v->rnd); @@ -643,20 +646,20 @@ static void vc1_mc_1mv(VC1Context *v, int dir) v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); - if(!v->rnd) + if (!v->rnd) dsp->put_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); else dsp->put_no_rnd_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); } - if(s->flags & CODEC_FLAG_GRAY) return; + if (s->flags & CODEC_FLAG_GRAY) return; /* Chroma MC always uses qpel bilinear */ - uvmx = (uvmx&3)<<1; - uvmy = (uvmy&3)<<1; - if(!v->rnd){ + uvmx = (uvmx & 3) << 1; + uvmy = (uvmy & 3) << 1; + if (!v->rnd) { dsp->put_h264_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->put_h264_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); - }else{ + } else { v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); } @@ -664,12 +667,12 @@ static void vc1_mc_1mv(VC1Context *v, int dir) static inline int median4(int a, int b, int c, int d) { - if(a < b) { - if(c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2; - else return (FFMIN(b, c) + FFMAX(a, d)) / 2; + if (a < b) { + if (c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2; + else return (FFMIN(b, c) + FFMAX(a, d)) / 2; } else { - if(c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2; - else return (FFMIN(a, c) + FFMAX(b, d)) / 2; + if (c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2; + else return (FFMIN(a, c) + FFMAX(b, d)) / 2; } } @@ -684,7 +687,10 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) int off; int fieldmv = (v->fcm == 1) ? v->blk_mv_type[s->block_index[n]] : 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; - if(!v->field_mode && !v->s.last_picture.f.data[0])return; + + if (!v->field_mode && !v->s.last_picture.f.data[0]) + return; + mx = s->mv[dir][n][0]; my = s->mv[dir][n][1]; @@ -712,14 +718,16 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) f = v->mv_f[0][s->block_index[k] + v->blocks_off]; chosen_mv[f][f ? opp_count : same_count][0] = s->mv[0][k][0]; chosen_mv[f][f ? opp_count : same_count][1] = s->mv[0][k][1]; - opp_count += f; + opp_count += f; same_count += 1 - f; } f = opp_count > same_count; switch (f ? opp_count : same_count) { case 4: - tx = median4(chosen_mv[f][0][0], chosen_mv[f][1][0], chosen_mv[f][2][0], chosen_mv[f][3][0]); - ty = median4(chosen_mv[f][0][1], chosen_mv[f][1][1], chosen_mv[f][2][1], chosen_mv[f][3][1]); + tx = median4(chosen_mv[f][0][0], chosen_mv[f][1][0], + chosen_mv[f][2][0], chosen_mv[f][3][0]); + ty = median4(chosen_mv[f][0][1], chosen_mv[f][1][1], + chosen_mv[f][2][1], chosen_mv[f][3][1]); break; case 3: tx = mid_pred(chosen_mv[f][0][0], chosen_mv[f][1][0], chosen_mv[f][2][0]); @@ -732,12 +740,13 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) } s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; - for (k = 0; k < 4; k++) v->mv_f[1][s->block_index[k] + v->blocks_off] = f; + for (k = 0; k < 4; k++) + v->mv_f[1][s->block_index[k] + v->blocks_off] = f; } if (v->fcm == 1) { // not sure if needed for other types of picture int qx, qy; - int width = s->avctx->coded_width; + int width = s->avctx->coded_width; int height = s->avctx->coded_height >> 1; qx = (s->mb_x * 16) + (mx >> 2); qy = (s->mb_y * 8) + (my >> 3); @@ -753,30 +762,30 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) } if ((v->fcm == 1) && fieldmv) - off = ((n>1) ? s->linesize : 0) + (n&1) * 8; + off = ((n > 1) ? s->linesize : 0) + (n & 1) * 8; else - off = s->linesize * 4 * (n&2) + (n&1) * 8; + off = s->linesize * 4 * (n & 2) + (n & 1) * 8; if (v->field_mode && v->cur_field_type) off += s->current_picture_ptr->f.linesize[0]; - src_x = s->mb_x * 16 + (n&1) * 8 + (mx >> 2); + src_x = s->mb_x * 16 + (n & 1) * 8 + (mx >> 2); if (!fieldmv) - src_y = s->mb_y * 16 + (n&2) * 4 + (my >> 2); + src_y = s->mb_y * 16 + (n & 2) * 4 + (my >> 2); else src_y = s->mb_y * 16 + ((n > 1) ? 1 : 0) + (my >> 2); - if(v->profile != PROFILE_ADVANCED){ - src_x = av_clip( src_x, -16, s->mb_width * 16); - src_y = av_clip( src_y, -16, s->mb_height * 16); - }else{ - src_x = av_clip( src_x, -17, s->avctx->coded_width); + if (v->profile != PROFILE_ADVANCED) { + src_x = av_clip(src_x, -16, s->mb_width * 16); + src_y = av_clip(src_y, -16, s->mb_height * 16); + } else { + src_x = av_clip(src_x, -17, s->avctx->coded_width); if (v->fcm == 1) { if (src_y & 1) - src_y = av_clip( src_y, -17, s->avctx->coded_height + 1); + src_y = av_clip(src_y, -17, s->avctx->coded_height + 1); else - src_y = av_clip( src_y, -18, s->avctx->coded_height); + src_y = av_clip(src_y, -18, s->avctx->coded_height); } else { - src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); + src_y = av_clip(src_y, -18, s->avctx->coded_height + 1); } } @@ -788,45 +797,49 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) v_edge_pos--; if (fieldmv && (src_y & 1) && src_y < 4) src_y--; - if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) - || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2 - || (unsigned)(src_y - (s->mspel<<fieldmv)) > v_edge_pos - (my&3) - ((8 + s->mspel*2)<<fieldmv)){ + if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) + || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 8 - s->mspel * 2 + || (unsigned)(src_y - (s->mspel << fieldmv)) > v_edge_pos - (my & 3) - ((8 + s->mspel * 2) << fieldmv)) { srcY -= s->mspel * (1 + (s->linesize << fieldmv)); /* check emulate edge stride and offset */ - s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, (9+s->mspel*2) << fieldmv, src_x - s->mspel, - src_y - (s->mspel << fieldmv), s->h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, + 9 + s->mspel * 2, (9 + s->mspel * 2) << fieldmv, + src_x - s->mspel, src_y - (s->mspel << fieldmv), + s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; /* if we deal with range reduction we need to scale source blocks */ - if(v->rangeredfrm) { + if (v->rangeredfrm) { int i, j; uint8_t *src; src = srcY; - for(j = 0; j < 9 + s->mspel*2; j++) { - for(i = 0; i < 9 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; + for (j = 0; j < 9 + s->mspel * 2; j++) { + for (i = 0; i < 9 + s->mspel * 2; i++) + src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize << fieldmv; } } /* if we deal with intensity compensation we need to scale source blocks */ - if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src; src = srcY; - for(j = 0; j < 9 + s->mspel*2; j++) { - for(i = 0; i < 9 + s->mspel*2; i++) src[i] = v->luty[src[i]]; + for (j = 0; j < 9 + s->mspel * 2; j++) { + for (i = 0; i < 9 + s->mspel * 2; i++) + src[i] = v->luty[src[i]]; src += s->linesize << fieldmv; } } srcY += s->mspel * (1 + (s->linesize << fieldmv)); } - if(s->mspel) { + if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); - if(!v->rnd) + if (!v->rnd) dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); else dsp->put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); @@ -837,13 +850,17 @@ static av_always_inline int get_chroma_mv(int *mvx, int *mvy, int *a, int flag, { int idx, i; static const int count[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; - idx = ((a[3] != flag) << 3) | ((a[2] != flag) << 2) | ((a[1] != flag) << 1) | (a[0] != flag); - if(!idx) { + + idx = ((a[3] != flag) << 3) + | ((a[2] != flag) << 2) + | ((a[1] != flag) << 1) + | (a[0] != flag); + if (!idx) { *tx = median4(mvx[0], mvx[1], mvx[2], mvx[3]); *ty = median4(mvy[0], mvy[1], mvy[2], mvy[3]); return 4; - } else if(count[idx] == 1) { - switch(idx) { + } else if (count[idx] == 1) { + switch (idx) { case 0x1: *tx = mid_pred(mvx[1], mvx[2], mvx[3]); *ty = mid_pred(mvy[1], mvy[2], mvy[3]); @@ -861,7 +878,7 @@ static av_always_inline int get_chroma_mv(int *mvx, int *mvy, int *a, int flag, *ty = mid_pred(mvy[0], mvy[1], mvy[2]); return 3; } - } else if(count[idx] == 2) { + } else if (count[idx] == 2) { int t1 = 0, t2 = 0; for (i = 0; i < 3; i++) if (!a[i]) { @@ -887,7 +904,7 @@ static av_always_inline int get_chroma_mv(int *mvx, int *mvy, int *a, int flag, static void vc1_mc_4mv_chroma(VC1Context *v, int dir) { MpegEncContext *s = &v->s; - DSPContext *dsp = &v->s.dsp; + DSPContext *dsp = &v->s.dsp; uint8_t *srcU, *srcV; int uvmx, uvmy, uvsrc_x, uvsrc_y; int k, tx = 0, ty = 0; @@ -896,10 +913,12 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) int chroma_ref_type = v->cur_field_type, off = 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; - if(!v->field_mode && !v->s.last_picture.f.data[0])return; - if(s->flags & CODEC_FLAG_GRAY) return; + if (!v->field_mode && !v->s.last_picture.f.data[0]) + return; + if (s->flags & CODEC_FLAG_GRAY) + return; - for(k = 0; k < 4; k++) { + for (k = 0; k < 4; k++) { mvx[k] = s->mv[dir][k][0]; mvy[k] = s->mv[dir][k][1]; intra[k] = v->mb_type[0][s->block_index[k]]; @@ -922,15 +941,15 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) if (dominant) chroma_ref_type = !v->cur_field_type; } - uvmx = (tx + ((tx&3) == 3)) >> 1; - uvmy = (ty + ((ty&3) == 3)) >> 1; + uvmx = (tx + ((tx & 3) == 3)) >> 1; + uvmy = (ty + ((ty & 3) == 3)) >> 1; v->luma_mv[s->mb_x][0] = uvmx; v->luma_mv[s->mb_x][1] = uvmy; - if(v->fastuvmc) { - uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1)); - uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1)); + if (v->fastuvmc) { + uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1)); + uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1)); } // Field conversion bias if (v->cur_field_type != chroma_ref_type) @@ -939,12 +958,12 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) uvsrc_x = s->mb_x * 8 + (uvmx >> 2); uvsrc_y = s->mb_y * 8 + (uvmy >> 2); - if(v->profile != PROFILE_ADVANCED){ - uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); - uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); - }else{ - uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); - uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); + if (v->profile != PROFILE_ADVANCED) { + uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); + uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); + } else { + uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); + uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } if (!dir) { @@ -973,55 +992,59 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) off = v->cur_field_type ? s->current_picture_ptr->f.linesize[1] : 0; } - if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) - || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 - || (unsigned)uvsrc_y > (v_edge_pos >> 1) - 9){ - s->dsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, - uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); - s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, - uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); + if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) + || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 + || (unsigned)uvsrc_y > (v_edge_pos >> 1) - 9) { + s->dsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, + 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, + s->h_edge_pos >> 1, v_edge_pos >> 1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, + 8 + 1, 8 + 1, uvsrc_x, uvsrc_y, + s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; /* if we deal with range reduction we need to scale source blocks */ - if(v->rangeredfrm) { + if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; - src = srcU; src2 = srcV; - for(j = 0; j < 9; j++) { - for(i = 0; i < 9; i++) { - src[i] = ((src[i] - 128) >> 1) + 128; + src = srcU; + src2 = srcV; + for (j = 0; j < 9; j++) { + for (i = 0; i < 9; i++) { + src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } - src += s->uvlinesize; + src += s->uvlinesize; src2 += s->uvlinesize; } } /* if we deal with intensity compensation we need to scale source blocks */ - if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src, *src2; - src = srcU; src2 = srcV; - for(j = 0; j < 9; j++) { - for(i = 0; i < 9; i++) { - src[i] = v->lutuv[src[i]]; + src = srcU; + src2 = srcV; + for (j = 0; j < 9; j++) { + for (i = 0; i < 9; i++) { + src[i] = v->lutuv[src[i]]; src2[i] = v->lutuv[src2[i]]; } - src += s->uvlinesize; + src += s->uvlinesize; src2 += s->uvlinesize; } } } /* Chroma MC always uses qpel bilinear */ - uvmx = (uvmx&3)<<1; - uvmy = (uvmy&3)<<1; - if(!v->rnd){ + uvmx = (uvmx & 3) << 1; + uvmy = (uvmy & 3) << 1; + if (!v->rnd) { dsp->put_h264_chroma_pixels_tab[0](s->dest[1] + off, srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->put_h264_chroma_pixels_tab[0](s->dest[2] + off, srcV, s->uvlinesize, 8, uvmx, uvmy); - }else{ + } else { v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off, srcV, s->uvlinesize, 8, uvmx, uvmy); } @@ -1038,12 +1061,14 @@ static void vc1_mc_4mv_chroma4(VC1Context *v) int uvmx_field[4], uvmy_field[4]; int i, off, tx, ty; int fieldmv = v->blk_mv_type[s->block_index[0]]; - static const int s_rndtblfield[16] = {0, 0, 1, 2, 4, 4, 5, 6, 2, 2, 3, 8, 6, 6, 7, 12}; + static const int s_rndtblfield[16] = { 0, 0, 1, 2, 4, 4, 5, 6, 2, 2, 3, 8, 6, 6, 7, 12 }; int v_dist = fieldmv ? 1 : 4; // vertical offset for lower sub-blocks int v_edge_pos = s->v_edge_pos >> 1; - if (!v->s.last_picture.f.data[0]) return; - if (s->flags & CODEC_FLAG_GRAY) return; + if (!v->s.last_picture.f.data[0]) + return; + if (s->flags & CODEC_FLAG_GRAY) + return; for (i = 0; i < 4; i++) { tx = s->mv[0][i][0]; @@ -1057,11 +1082,11 @@ static void vc1_mc_4mv_chroma4(VC1Context *v) for (i = 0; i < 4; i++) { off = (i & 1) * 4 + ((i & 2) ? v_dist * s->uvlinesize : 0); - uvsrc_x = s->mb_x * 8 + (i & 1) * 4 + (uvmx_field[i] >> 2); + uvsrc_x = s->mb_x * 8 + (i & 1) * 4 + (uvmx_field[i] >> 2); uvsrc_y = s->mb_y * 8 + ((i & 2) ? v_dist : 0) + (uvmy_field[i] >> 2); // FIXME: implement proper pull-back (see vc1cropmv.c, vc1CROPMV_ChromaPullBack()) - uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); - uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); + uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); + uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); srcU = s->last_picture.f.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; srcV = s->last_picture.f.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; uvmx_field[i] = (uvmx_field[i] & 3) << 1; @@ -1071,26 +1096,31 @@ static void vc1_mc_4mv_chroma4(VC1Context *v) v_edge_pos--; if (fieldmv && (uvsrc_y & 1) && uvsrc_y < 2) uvsrc_y--; - if((v->mv_mode == MV_PMODE_INTENSITY_COMP) + if ((v->mv_mode == MV_PMODE_INTENSITY_COMP) || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 5 - || (unsigned)uvsrc_y > v_edge_pos - (5 << fieldmv)){ - s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcU, s->uvlinesize, 5, (5 << fieldmv), uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos); - s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 5, (5 << fieldmv), uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos); + || (unsigned)uvsrc_y > v_edge_pos - (5 << fieldmv)) { + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcU, s->uvlinesize, + 5, (5 << fieldmv), uvsrc_x, uvsrc_y, + s->h_edge_pos >> 1, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, + 5, (5 << fieldmv), uvsrc_x, uvsrc_y, + s->h_edge_pos >> 1, v_edge_pos); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; /* if we deal with intensity compensation we need to scale source blocks */ - if(v->mv_mode == MV_PMODE_INTENSITY_COMP) { + if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src, *src2; - src = srcU; src2 = srcV; - for(j = 0; j < 5; j++) { - for(i = 0; i < 5; i++) { - src[i] = v->lutuv[src[i]]; + src = srcU; + src2 = srcV; + for (j = 0; j < 5; j++) { + for (i = 0; i < 5; i++) { + src[i] = v->lutuv[src[i]]; src2[i] = v->lutuv[src2[i]]; } - src += s->uvlinesize << 1; + src += s->uvlinesize << 1; src2 += s->uvlinesize << 1; } } @@ -1117,37 +1147,34 @@ static void vc1_mc_4mv_chroma4(VC1Context *v) * @brief Get macroblock-level quantizer scale */ #define GET_MQUANT() \ - if (v->dquantfrm) \ - { \ - int edges = 0; \ - if (v->dqprofile == DQPROFILE_ALL_MBS) \ - { \ - if (v->dqbilevel) \ - { \ - mquant = (get_bits1(gb)) ? v->altpq : v->pq; \ - } \ - else \ - { \ - mqdiff = get_bits(gb, 3); \ - if (mqdiff != 7) mquant = v->pq + mqdiff; \ - else mquant = get_bits(gb, 5); \ - } \ - } \ - if(v->dqprofile == DQPROFILE_SINGLE_EDGE) \ - edges = 1 << v->dqsbedge; \ - else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES) \ - edges = (3 << v->dqsbedge) % 15; \ - else if(v->dqprofile == DQPROFILE_FOUR_EDGES) \ - edges = 15; \ - if((edges&1) && !s->mb_x) \ - mquant = v->altpq; \ - if((edges&2) && s->first_slice_line) \ - mquant = v->altpq; \ - if((edges&4) && s->mb_x == (s->mb_width - 1)) \ - mquant = v->altpq; \ - if((edges&8) && s->mb_y == (s->mb_height - 1)) \ - mquant = v->altpq; \ - } + if (v->dquantfrm) { \ + int edges = 0; \ + if (v->dqprofile == DQPROFILE_ALL_MBS) { \ + if (v->dqbilevel) { \ + mquant = (get_bits1(gb)) ? v->altpq : v->pq; \ + } else { \ + mqdiff = get_bits(gb, 3); \ + if (mqdiff != 7) \ + mquant = v->pq + mqdiff; \ + else \ + mquant = get_bits(gb, 5); \ + } \ + } \ + if (v->dqprofile == DQPROFILE_SINGLE_EDGE) \ + edges = 1 << v->dqsbedge; \ + else if (v->dqprofile == DQPROFILE_DOUBLE_EDGES) \ + edges = (3 << v->dqsbedge) % 15; \ + else if (v->dqprofile == DQPROFILE_FOUR_EDGES) \ + edges = 15; \ + if ((edges&1) && !s->mb_x) \ + mquant = v->altpq; \ + if ((edges&2) && s->first_slice_line) \ + mquant = v->altpq; \ + if ((edges&4) && s->mb_x == (s->mb_width - 1)) \ + mquant = v->altpq; \ + if ((edges&8) && s->mb_y == (s->mb_height - 1)) \ + mquant = v->altpq; \ + } /** * @def GET_MVDATA(_dmv_x, _dmv_y) @@ -1156,50 +1183,46 @@ static void vc1_mc_4mv_chroma4(VC1Context *v) * @param _dmv_x Horizontal differential for decoded MV * @param _dmv_y Vertical differential for decoded MV */ -#define GET_MVDATA(_dmv_x, _dmv_y) \ - index = 1 + get_vlc2(gb, ff_vc1_mv_diff_vlc[s->mv_table_index].table,\ - VC1_MV_DIFF_VLC_BITS, 2); \ - if (index > 36) \ - { \ - mb_has_coeffs = 1; \ - index -= 37; \ - } \ - else mb_has_coeffs = 0; \ - s->mb_intra = 0; \ - if (!index) { _dmv_x = _dmv_y = 0; } \ - else if (index == 35) \ - { \ - _dmv_x = get_bits(gb, v->k_x - 1 + s->quarter_sample); \ - _dmv_y = get_bits(gb, v->k_y - 1 + s->quarter_sample); \ - } \ - else if (index == 36) \ - { \ - _dmv_x = 0; \ - _dmv_y = 0; \ - s->mb_intra = 1; \ - } \ - else \ - { \ - index1 = index%6; \ - if (!s->quarter_sample && index1 == 5) val = 1; \ - else val = 0; \ - if(size_table[index1] - val > 0) \ - val = get_bits(gb, size_table[index1] - val); \ - else val = 0; \ - sign = 0 - (val&1); \ - _dmv_x = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ - \ - index1 = index/6; \ - if (!s->quarter_sample && index1 == 5) val = 1; \ - else val = 0; \ - if(size_table[index1] - val > 0) \ - val = get_bits(gb, size_table[index1] - val); \ - else val = 0; \ - sign = 0 - (val&1); \ - _dmv_y = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ - } - -static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, int *dmv_y, int *pred_flag) +#define GET_MVDATA(_dmv_x, _dmv_y) \ + index = 1 + get_vlc2(gb, ff_vc1_mv_diff_vlc[s->mv_table_index].table, \ + VC1_MV_DIFF_VLC_BITS, 2); \ + if (index > 36) { \ + mb_has_coeffs = 1; \ + index -= 37; \ + } else \ + mb_has_coeffs = 0; \ + s->mb_intra = 0; \ + if (!index) { \ + _dmv_x = _dmv_y = 0; \ + } else if (index == 35) { \ + _dmv_x = get_bits(gb, v->k_x - 1 + s->quarter_sample); \ + _dmv_y = get_bits(gb, v->k_y - 1 + s->quarter_sample); \ + } else if (index == 36) { \ + _dmv_x = 0; \ + _dmv_y = 0; \ + s->mb_intra = 1; \ + } else { \ + index1 = index % 6; \ + if (!s->quarter_sample && index1 == 5) val = 1; \ + else val = 0; \ + if (size_table[index1] - val > 0) \ + val = get_bits(gb, size_table[index1] - val); \ + else val = 0; \ + sign = 0 - (val&1); \ + _dmv_x = (sign ^ ((val>>1) + offset_table[index1])) - sign; \ + \ + index1 = index / 6; \ + if (!s->quarter_sample && index1 == 5) val = 1; \ + else val = 0; \ + if (size_table[index1] - val > 0) \ + val = get_bits(gb, size_table[index1] - val); \ + else val = 0; \ + sign = 0 - (val & 1); \ + _dmv_y = (sign ^ ((val >> 1) + offset_table[index1])) - sign; \ + } + +static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, + int *dmv_y, int *pred_flag) { int index, index1; int extend_x = 0, extend_y = 0; @@ -1210,10 +1233,10 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, in if (v->numref) { bits = VC1_2REF_MVDATA_VLC_BITS; - esc = 125; + esc = 125; } else { bits = VC1_1REF_MVDATA_VLC_BITS; - esc = 71; + esc = 71; } switch (v->dmvrange) { case 1: @@ -1232,7 +1255,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, in *dmv_y = get_bits(gb, v->k_y); if (v->numref) { *pred_flag = *dmv_y & 1; - *dmv_y = (*dmv_y + *pred_flag) >> 1; + *dmv_y = (*dmv_y + *pred_flag) >> 1; } } else { @@ -1242,8 +1265,8 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, in offs_tab = offset_table1; index1 = (index + 1) % 9; if (index1 != 0) { - val = get_bits(gb, index1 + extend_x); - sign = 0 -(val & 1); + val = get_bits(gb, index1 + extend_x); + sign = 0 -(val & 1); *dmv_x = (sign ^ ((val >> 1) + offs_tab[index1])) - sign; } else *dmv_x = 0; @@ -1253,8 +1276,8 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, in offs_tab = offset_table1; index1 = (index + 1) / 9; if (index1 > v->numref) { - val = get_bits(gb, (index1 + (extend_y << v->numref)) >> v->numref); - sign = 0 - (val & 1); + val = get_bits(gb, (index1 + (extend_y << v->numref)) >> v->numref); + sign = 0 - (val & 1); *dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign; } else *dmv_y = 0; @@ -1275,8 +1298,8 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di refdist = dir ? v->brfd : v->frfd; if (refdist > 3) refdist = 3; - scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; - scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; + scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; + scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; scalezone1_x = vc1_field_mvpred_scales[v->second_field][3][refdist]; zone1offset_x = vc1_field_mvpred_scales[v->second_field][5][refdist]; @@ -1307,8 +1330,8 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, refdist = dir ? v->brfd : v->frfd; if (refdist > 3) refdist = 3; - scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; - scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; + scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; + scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; scalezone1_y = vc1_field_mvpred_scales[v->second_field][4][refdist]; zone1offset_y = vc1_field_mvpred_scales[v->second_field][6][refdist]; @@ -1340,8 +1363,8 @@ static av_always_inline int scaleforopp_x(VC1Context *v, int n /* MV */) brfd = FFMIN(v->brfd, 3); scalezone1_x = vc1_b_field_mvpred_scales[3][brfd]; zone1offset_x = vc1_b_field_mvpred_scales[5][brfd]; - scaleopp1 = vc1_b_field_mvpred_scales[1][brfd]; - scaleopp2 = vc1_b_field_mvpred_scales[2][brfd]; + scaleopp1 = vc1_b_field_mvpred_scales[1][brfd]; + scaleopp2 = vc1_b_field_mvpred_scales[2][brfd]; if (FFABS(n) > 255) scaledvalue = n; @@ -1367,8 +1390,8 @@ static av_always_inline int scaleforopp_y(VC1Context *v, int n /* MV */, int dir brfd = FFMIN(v->brfd, 3); scalezone1_y = vc1_b_field_mvpred_scales[4][brfd]; zone1offset_y = vc1_b_field_mvpred_scales[6][brfd]; - scaleopp1 = vc1_b_field_mvpred_scales[1][brfd]; - scaleopp2 = vc1_b_field_mvpred_scales[2][brfd]; + scaleopp1 = vc1_b_field_mvpred_scales[1][brfd]; + scaleopp2 = vc1_b_field_mvpred_scales[2][brfd]; if (FFABS(n) > 63) scaledvalue = n; @@ -1389,23 +1412,28 @@ static av_always_inline int scaleforopp_y(VC1Context *v, int n /* MV */, int dir } } -static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */, int dim, int dir) +static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */, + int dim, int dir) { int brfd, scalesame; + if (v->s.pict_type != AV_PICTURE_TYPE_B || v->second_field || !dir) { if (dim) return scaleforsame_y(v, i, n, dir); else return scaleforsame_x(v, n, dir); } - brfd = FFMIN(v->brfd, 3); + brfd = FFMIN(v->brfd, 3); scalesame = vc1_b_field_mvpred_scales[0][brfd]; - return(n * scalesame >> 8); + + return n * scalesame >> 8; } -static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, int dim, int dir) +static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, + int dim, int dir) { int refdist, scaleopp; + if (v->s.pict_type == AV_PICTURE_TYPE_B && !v->second_field && dir == 1) { if (dim) return scaleforopp_y(v, n, dir); @@ -1417,12 +1445,15 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, int dim, else refdist = dir ? v->brfd : v->frfd; scaleopp = vc1_field_mvpred_scales[v->second_field][0][refdist]; - return(n * scaleopp >> 8); + + return n * scaleopp >> 8; } /** Predict and set motion vector */ -static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra, int pred_flag, int dir) +static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, + int mv1, int r_x, int r_y, uint8_t* is_intra, + int pred_flag, int dir) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; @@ -1431,7 +1462,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m int sum; int mixedmv_pic, num_samefield = 0, num_oppfield = 0; int opposit, f; - int16_t samefield_pred[2], oppfield_pred[2]; + int16_t samefield_pred[2], oppfield_pred[2]; int16_t samefield_predA[2], oppfield_predA[2]; int16_t samefield_predB[2], oppfield_predB[2]; int16_t samefield_predC[2], oppfield_predC[2]; @@ -1440,41 +1471,43 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m int hybridmv_thresh, y_bias = 0; if (v->mv_mode == MV_PMODE_MIXED_MV || - ((v->mv_mode == MV_PMODE_INTENSITY_COMP) && (v->mv_mode2 == MV_PMODE_MIXED_MV))) mixedmv_pic = 1; - else mixedmv_pic = 0; + ((v->mv_mode == MV_PMODE_INTENSITY_COMP) && (v->mv_mode2 == MV_PMODE_MIXED_MV))) + mixedmv_pic = 1; + else + mixedmv_pic = 0; /* scale MV difference to be quad-pel */ dmv_x <<= 1 - s->quarter_sample; dmv_y <<= 1 - s->quarter_sample; wrap = s->b8_stride; - xy = s->block_index[n]; + xy = s->block_index[n]; - if(s->mb_intra){ + if (s->mb_intra) { s->mv[0][n][0] = s->current_picture.f.motion_val[0][xy + v->blocks_off][0] = 0; s->mv[0][n][1] = s->current_picture.f.motion_val[0][xy + v->blocks_off][1] = 0; s->current_picture.f.motion_val[1][xy + v->blocks_off][0] = 0; s->current_picture.f.motion_val[1][xy + v->blocks_off][1] = 0; - if(mv1) { /* duplicate motion data for 1-MV block */ - s->current_picture.f.motion_val[0][xy + 1 + v->blocks_off][0] = 0; - s->current_picture.f.motion_val[0][xy + 1 + v->blocks_off][1] = 0; - s->current_picture.f.motion_val[0][xy + wrap + v->blocks_off][0] = 0; - s->current_picture.f.motion_val[0][xy + wrap + v->blocks_off][1] = 0; + if (mv1) { /* duplicate motion data for 1-MV block */ + s->current_picture.f.motion_val[0][xy + 1 + v->blocks_off][0] = 0; + s->current_picture.f.motion_val[0][xy + 1 + v->blocks_off][1] = 0; + s->current_picture.f.motion_val[0][xy + wrap + v->blocks_off][0] = 0; + s->current_picture.f.motion_val[0][xy + wrap + v->blocks_off][1] = 0; s->current_picture.f.motion_val[0][xy + wrap + 1 + v->blocks_off][0] = 0; s->current_picture.f.motion_val[0][xy + wrap + 1 + v->blocks_off][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; - s->current_picture.f.motion_val[1][xy + 1 + v->blocks_off][0] = 0; - s->current_picture.f.motion_val[1][xy + 1 + v->blocks_off][1] = 0; - s->current_picture.f.motion_val[1][xy + wrap][0] = 0; - s->current_picture.f.motion_val[1][xy + wrap + v->blocks_off][1] = 0; + s->current_picture.f.motion_val[1][xy + 1 + v->blocks_off][0] = 0; + s->current_picture.f.motion_val[1][xy + 1 + v->blocks_off][1] = 0; + s->current_picture.f.motion_val[1][xy + wrap][0] = 0; + s->current_picture.f.motion_val[1][xy + wrap + v->blocks_off][1] = 0; s->current_picture.f.motion_val[1][xy + wrap + 1 + v->blocks_off][0] = 0; s->current_picture.f.motion_val[1][xy + wrap + 1 + v->blocks_off][1] = 0; } return; } - C = s->current_picture.f.motion_val[dir][xy - 1 + v->blocks_off]; + C = s->current_picture.f.motion_val[dir][xy - 1 + v->blocks_off]; A = s->current_picture.f.motion_val[dir][xy - wrap + v->blocks_off]; - if(mv1) { + if (mv1) { if (v->field_mode && mixedmv_pic) off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; else @@ -1497,9 +1530,9 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m } B = s->current_picture.f.motion_val[dir][xy - wrap + off + v->blocks_off]; - a_valid = !s->first_slice_line || (n==2 || n==3); + a_valid = !s->first_slice_line || (n == 2 || n == 3); b_valid = a_valid && (s->mb_width > 1); - c_valid = s->mb_x || (n==1 || n==3); + c_valid = s->mb_x || (n == 1 || n == 3); if (v->field_mode) { a_valid = a_valid && !is_intra[xy - wrap]; b_valid = b_valid && !is_intra[xy - wrap + off]; @@ -1508,11 +1541,11 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m if (a_valid) { f = v->mv_f[dir][xy - wrap + v->blocks_off]; - num_oppfield += f; + num_oppfield += f; num_samefield += 1 - f; if (f) { - oppfield_predA[0] = A[0]; - oppfield_predA[1] = A[1]; + oppfield_predA[0] = A[0]; + oppfield_predA[1] = A[1]; samefield_predA[0] = scaleforsame(v, 0, A[0], 0, dir); samefield_predA[1] = scaleforsame(v, n, A[1], 1, dir); } else { @@ -1525,15 +1558,15 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m } } else { samefield_predA[0] = samefield_predA[1] = 0; - oppfield_predA[0] = oppfield_predA[1] = 0; + oppfield_predA[0] = oppfield_predA[1] = 0; } if (c_valid) { f = v->mv_f[dir][xy - 1 + v->blocks_off]; - num_oppfield += f; + num_oppfield += f; num_samefield += 1 - f; if (f) { - oppfield_predC[0] = C[0]; - oppfield_predC[1] = C[1]; + oppfield_predC[0] = C[0]; + oppfield_predC[1] = C[1]; samefield_predC[0] = scaleforsame(v, 0, C[0], 0, dir); samefield_predC[1] = scaleforsame(v, n, C[1], 1, dir); } else { @@ -1546,15 +1579,15 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m } } else { samefield_predC[0] = samefield_predC[1] = 0; - oppfield_predC[0] = oppfield_predC[1] = 0; + oppfield_predC[0] = oppfield_predC[1] = 0; } if (b_valid) { f = v->mv_f[dir][xy - wrap + off + v->blocks_off]; - num_oppfield += f; + num_oppfield += f; num_samefield += 1 - f; if (f) { - oppfield_predB[0] = B[0]; - oppfield_predB[1] = B[1]; + oppfield_predB[0] = B[0]; + oppfield_predB[1] = B[1]; samefield_predB[0] = scaleforsame(v, 0, B[0], 0, dir); samefield_predB[1] = scaleforsame(v, n, B[1], 1, dir); } else { @@ -1567,27 +1600,27 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m } } else { samefield_predB[0] = samefield_predB[1] = 0; - oppfield_predB[0] = oppfield_predB[1] = 0; + oppfield_predB[0] = oppfield_predB[1] = 0; } if (a_valid) { samefield_pred[0] = samefield_predA[0]; samefield_pred[1] = samefield_predA[1]; - oppfield_pred[0] = oppfield_predA[0]; - oppfield_pred[1] = oppfield_predA[1]; + oppfield_pred[0] = oppfield_predA[0]; + oppfield_pred[1] = oppfield_predA[1]; } else if (c_valid) { samefield_pred[0] = samefield_predC[0]; samefield_pred[1] = samefield_predC[1]; - oppfield_pred[0] = oppfield_predC[0]; - oppfield_pred[1] = oppfield_predC[1]; + oppfield_pred[0] = oppfield_predC[0]; + oppfield_pred[1] = oppfield_predC[1]; } else if (b_valid) { samefield_pred[0] = samefield_predB[0]; samefield_pred[1] = samefield_predB[1]; - oppfield_pred[0] = oppfield_predB[0]; - oppfield_pred[1] = oppfield_predB[1]; + oppfield_pred[0] = oppfield_predB[0]; + oppfield_pred[1] = oppfield_predB[1]; } else { samefield_pred[0] = samefield_pred[1] = 0; - oppfield_pred[0] = oppfield_pred[1] = 0; + oppfield_pred[0] = oppfield_pred[1] = 0; } if (num_samefield + num_oppfield > 1) { @@ -1607,15 +1640,15 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m } else opposit = 0; if (opposit) { - px = oppfield_pred[0]; - py = oppfield_pred[1]; + px = oppfield_pred[0]; + py = oppfield_pred[1]; predA = oppfield_predA; predC = oppfield_predC; v->mv_f[dir][xy + v->blocks_off] = f = 1; v->ref_field_type[dir] = !v->cur_field_type; } else { - px = samefield_pred[0]; - py = samefield_pred[1]; + px = samefield_pred[0]; + py = samefield_pred[1]; predA = samefield_predA; predC = samefield_predC; v->mv_f[dir][xy + v->blocks_off] = f = 0; @@ -1625,19 +1658,19 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m /* Pullback MV as specified in 8.3.5.3.4 */ if (!v->field_mode) { int qx, qy, X, Y; - qx = (s->mb_x << 6) + ((n==1 || n==3) ? 32 : 0); - qy = (s->mb_y << 6) + ((n==2 || n==3) ? 32 : 0); - X = (s->mb_width << 6) - 4; - Y = (s->mb_height << 6) - 4; - if(mv1) { - if(qx + px < -60) px = -60 - qx; - if(qy + py < -60) py = -60 - qy; + qx = (s->mb_x << 6) + ((n == 1 || n == 3) ? 32 : 0); + qy = (s->mb_y << 6) + ((n == 2 || n == 3) ? 32 : 0); + X = (s->mb_width << 6) - 4; + Y = (s->mb_height << 6) - 4; + if (mv1) { + if (qx + px < -60) px = -60 - qx; + if (qy + py < -60) py = -60 - qy; } else { - if(qx + px < -28) px = -28 - qx; - if(qy + py < -28) py = -28 - qy; + if (qx + px < -28) px = -28 - qx; + if (qy + py < -28) py = -28 - qy; } - if(qx + px > X) px = X - qx; - if(qy + py > Y) py = Y - qy; + if (qx + px > X) px = X - qx; + if (qy + py > Y) py = Y - qy; } if (!v->field_mode || s->pict_type != AV_PICTURE_TYPE_B) { @@ -1665,7 +1698,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m else sum = FFABS(px - predC[0]) + FFABS(py - predC[1]); if (sum > hybridmv_thresh) { - if(get_bits1(&s->gb)) { + if (get_bits1(&s->gb)) { px = predA[0]; py = predA[1]; } else { @@ -1688,21 +1721,22 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y, int m /* store MV using signed modulus of MV range defined in 4.11 */ s->mv[dir][n][0] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[dir][n][1] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][1] = ((py + dmv_y + r_y - y_bias) & ((r_y << 1) - 1)) - r_y + y_bias; - if(mv1) { /* duplicate motion data for 1-MV block */ - s->current_picture.f.motion_val[dir][xy + 1 + v->blocks_off][0] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][0]; - s->current_picture.f.motion_val[dir][xy + 1 + v->blocks_off][1] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][1]; - s->current_picture.f.motion_val[dir][xy + wrap + v->blocks_off][0] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][0]; - s->current_picture.f.motion_val[dir][xy + wrap + v->blocks_off][1] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][1]; + if (mv1) { /* duplicate motion data for 1-MV block */ + s->current_picture.f.motion_val[dir][xy + 1 + v->blocks_off][0] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][0]; + s->current_picture.f.motion_val[dir][xy + 1 + v->blocks_off][1] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][1]; + s->current_picture.f.motion_val[dir][xy + wrap + v->blocks_off][0] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][0]; + s->current_picture.f.motion_val[dir][xy + wrap + v->blocks_off][1] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][1]; s->current_picture.f.motion_val[dir][xy + wrap + 1 + v->blocks_off][0] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][0]; s->current_picture.f.motion_val[dir][xy + wrap + 1 + v->blocks_off][1] = s->current_picture.f.motion_val[dir][xy + v->blocks_off][1]; - v->mv_f[dir][xy + 1 + v->blocks_off] = v->mv_f[dir][xy + v->blocks_off]; + v->mv_f[dir][xy + 1 + v->blocks_off] = v->mv_f[dir][xy + v->blocks_off]; v->mv_f[dir][xy + wrap + v->blocks_off] = v->mv_f[dir][xy + wrap + 1 + v->blocks_off] = v->mv_f[dir][xy + v->blocks_off]; } } /** Predict and set motion vector for interlaced frame picture MBs */ -static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, int mvn, int r_x, int r_y, uint8_t* is_intra) +static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, + int mvn, int r_x, int r_y, uint8_t* is_intra) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; @@ -1716,23 +1750,23 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, wrap = s->b8_stride; xy = s->block_index[n]; - if(s->mb_intra){ + if (s->mb_intra) { s->mv[0][n][0] = s->current_picture.f.motion_val[0][xy][0] = 0; s->mv[0][n][1] = s->current_picture.f.motion_val[0][xy][1] = 0; s->current_picture.f.motion_val[1][xy][0] = 0; s->current_picture.f.motion_val[1][xy][1] = 0; - if(mvn == 1) { /* duplicate motion data for 1-MV block */ - s->current_picture.f.motion_val[0][xy + 1][0] = 0; - s->current_picture.f.motion_val[0][xy + 1][1] = 0; - s->current_picture.f.motion_val[0][xy + wrap][0] = 0; - s->current_picture.f.motion_val[0][xy + wrap][1] = 0; + if (mvn == 1) { /* duplicate motion data for 1-MV block */ + s->current_picture.f.motion_val[0][xy + 1][0] = 0; + s->current_picture.f.motion_val[0][xy + 1][1] = 0; + s->current_picture.f.motion_val[0][xy + wrap][0] = 0; + s->current_picture.f.motion_val[0][xy + wrap][1] = 0; s->current_picture.f.motion_val[0][xy + wrap + 1][0] = 0; s->current_picture.f.motion_val[0][xy + wrap + 1][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; - s->current_picture.f.motion_val[1][xy + 1][0] = 0; - s->current_picture.f.motion_val[1][xy + 1][1] = 0; - s->current_picture.f.motion_val[1][xy + wrap][0] = 0; - s->current_picture.f.motion_val[1][xy + wrap][1] = 0; + s->current_picture.f.motion_val[1][xy + 1][0] = 0; + s->current_picture.f.motion_val[1][xy + 1][1] = 0; + s->current_picture.f.motion_val[1][xy + wrap][0] = 0; + s->current_picture.f.motion_val[1][xy + wrap][1] = 0; s->current_picture.f.motion_val[1][xy + wrap + 1][0] = 0; s->current_picture.f.motion_val[1][xy + wrap + 1][1] = 0; } @@ -1743,50 +1777,51 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, /* predict A */ if (s->mb_x || (n == 1) || (n == 3)) { if ((v->blk_mv_type[xy]) // current block (MB) has a field MV - || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV + || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV A[0] = s->current_picture.f.motion_val[0][xy - 1][0]; A[1] = s->current_picture.f.motion_val[0][xy - 1][1]; a_valid = 1; } else { // current block has frame mv and cand. has field MV (so average) A[0] = (s->current_picture.f.motion_val[0][xy - 1][0] - + s->current_picture.f.motion_val[0][xy - 1 + off*wrap][0] + 1) >> 1; + + s->current_picture.f.motion_val[0][xy - 1 + off * wrap][0] + 1) >> 1; A[1] = (s->current_picture.f.motion_val[0][xy - 1][1] - + s->current_picture.f.motion_val[0][xy - 1 + off*wrap][1] + 1) >> 1; + + s->current_picture.f.motion_val[0][xy - 1 + off * wrap][1] + 1) >> 1; a_valid = 1; } if (!(n & 1) && v->is_intra[s->mb_x - 1]) { a_valid = 0; A[0] = A[1] = 0; } - } else A[0] = A[1] = 0; + } else + A[0] = A[1] = 0; /* Predict B and C */ B[0] = B[1] = C[0] = C[1] = 0; if (n == 0 || n == 1 || v->blk_mv_type[xy]) { if (!s->first_slice_line) { if (!v->is_intra[s->mb_x - s->mb_stride]) { b_valid = 1; - n_adj = n | 2; - pos_b = s->block_index[n_adj] - 2 * wrap; + n_adj = n | 2; + pos_b = s->block_index[n_adj] - 2 * wrap; if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { n_adj = (n & 2) | (n & 1); } B[0] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2 * wrap][0]; B[1] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2 * wrap][1]; if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { - B[0] = (1 + B[0] + s->current_picture.f.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap][0]) >> 1; - B[1] = (1 + B[1] + s->current_picture.f.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap][1]) >> 1; + B[0] = (B[0] + s->current_picture.f.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; + B[1] = (B[1] + s->current_picture.f.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; } } if (s->mb_width > 1) { if (!v->is_intra[s->mb_x - s->mb_stride + 1]) { c_valid = 1; - n_adj = 2; - pos_c = s->block_index[2] - 2*wrap + 2; + n_adj = 2; + pos_c = s->block_index[2] - 2 * wrap + 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n & 2; } - C[0] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2*wrap + 2][0]; - C[1] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2*wrap + 2][1]; + C[0] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2 * wrap + 2][0]; + C[1] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2 * wrap + 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + (s->current_picture.f.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; C[1] = (1 + C[1] + (s->current_picture.f.motion_val[0][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; @@ -1794,36 +1829,37 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, if (s->mb_x == s->mb_width - 1) { if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { c_valid = 1; - n_adj = 3; - pos_c = s->block_index[3] - 2*wrap - 2; + n_adj = 3; + pos_c = s->block_index[3] - 2 * wrap - 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n | 1; } - C[0] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2*wrap - 2][0]; - C[1] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2*wrap - 2][1]; + C[0] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2 * wrap - 2][0]; + C[1] = s->current_picture.f.motion_val[0][s->block_index[n_adj] - 2 * wrap - 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { - C[0] = (1 + C[0] + s->current_picture.f.motion_val[0][s->block_index[1] - 2*wrap - 2][0]) >> 1; - C[1] = (1 + C[1] + s->current_picture.f.motion_val[0][s->block_index[1] - 2*wrap - 2][1]) >> 1; + C[0] = (1 + C[0] + s->current_picture.f.motion_val[0][s->block_index[1] - 2 * wrap - 2][0]) >> 1; + C[1] = (1 + C[1] + s->current_picture.f.motion_val[0][s->block_index[1] - 2 * wrap - 2][1]) >> 1; } - } else c_valid = 0; + } else + c_valid = 0; } } } } } else { - pos_b = s->block_index[1]; + pos_b = s->block_index[1]; b_valid = 1; - B[0] = s->current_picture.f.motion_val[0][pos_b][0]; - B[1] = s->current_picture.f.motion_val[0][pos_b][1]; - pos_c = s->block_index[0]; + B[0] = s->current_picture.f.motion_val[0][pos_b][0]; + B[1] = s->current_picture.f.motion_val[0][pos_b][1]; + pos_c = s->block_index[0]; c_valid = 1; - C[0] = s->current_picture.f.motion_val[0][pos_c][0]; - C[1] = s->current_picture.f.motion_val[0][pos_c][1]; + C[0] = s->current_picture.f.motion_val[0][pos_c][0]; + C[1] = s->current_picture.f.motion_val[0][pos_c][1]; } total_valid = a_valid + b_valid + c_valid; // check if predictor A is out of bounds - if (!s->mb_x && !(n==1 || n==3)) { + if (!s->mb_x && !(n == 1 || n == 3)) { A[0] = A[1] = 0; } // check if predictor B is out of bounds @@ -1831,7 +1867,7 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, B[0] = B[1] = C[0] = C[1] = 0; } if (!v->blk_mv_type[xy]) { - if(s->mb_width == 1) { + if (s->mb_width == 1) { px = B[0]; py = B[1]; } else { @@ -1842,7 +1878,8 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, if (a_valid) { px = A[0]; py = A[1]; } if (b_valid) { px = B[0]; py = B[1]; } if (c_valid) { px = C[0]; py = C[1]; } - } else px = py = 0; + } else + px = py = 0; } } else { if (a_valid) @@ -1858,7 +1895,7 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, else field_c = 0; - num_oppfield = field_a + field_b + field_c; + num_oppfield = field_a + field_b + field_c; num_samefield = total_valid - num_oppfield; if (total_valid == 3) { if ((num_samefield == 3) || (num_oppfield == 3)) { @@ -1867,11 +1904,11 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, } else if (num_samefield >= num_oppfield) { /* take one MV from same field set depending on priority the check for B may not be necessary */ - px = (!field_a) ? A[0] : B[0]; - py = (!field_a) ? A[1] : B[1]; + px = !field_a ? A[0] : B[0]; + py = !field_a ? A[1] : B[1]; } else { - px = (field_a) ? A[0] : B[0]; - py = (field_a) ? A[1] : B[1]; + px = field_a ? A[0] : B[0]; + py = field_a ? A[1] : B[1]; } } else if (total_valid == 2) { if (num_samefield >= num_oppfield) { @@ -1900,17 +1937,18 @@ static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, } else if (total_valid == 1) { px = (a_valid) ? A[0] : ((b_valid) ? B[0] : C[0]); py = (a_valid) ? A[1] : ((b_valid) ? B[1] : C[1]); - } else px = py = 0; + } else + px = py = 0; } /* store MV using signed modulus of MV range defined in 4.11 */ s->mv[0][n][0] = s->current_picture.f.motion_val[0][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[0][n][1] = s->current_picture.f.motion_val[0][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; - if(mvn == 1) { /* duplicate motion data for 1-MV block */ - s->current_picture.f.motion_val[0][xy + 1][0] = s->current_picture.f.motion_val[0][xy][0]; - s->current_picture.f.motion_val[0][xy + 1][1] = s->current_picture.f.motion_val[0][xy][1]; - s->current_picture.f.motion_val[0][xy + wrap][0] = s->current_picture.f.motion_val[0][xy][0]; - s->current_picture.f.motion_val[0][xy + wrap][1] = s->current_picture.f.motion_val[0][xy][1]; + if (mvn == 1) { /* duplicate motion data for 1-MV block */ + s->current_picture.f.motion_val[0][xy + 1 ][0] = s->current_picture.f.motion_val[0][xy][0]; + s->current_picture.f.motion_val[0][xy + 1 ][1] = s->current_picture.f.motion_val[0][xy][1]; + s->current_picture.f.motion_val[0][xy + wrap ][0] = s->current_picture.f.motion_val[0][xy][0]; + s->current_picture.f.motion_val[0][xy + wrap ][1] = s->current_picture.f.motion_val[0][xy][1]; s->current_picture.f.motion_val[0][xy + wrap + 1][0] = s->current_picture.f.motion_val[0][xy][0]; s->current_picture.f.motion_val[0][xy + wrap + 1][1] = s->current_picture.f.motion_val[0][xy][1]; } else if (mvn == 2) { /* duplicate motion data for 2-Field MV block */ @@ -1935,41 +1973,41 @@ static void vc1_interp_mc(VC1Context *v) if (!v->field_mode && !v->s.next_picture.f.data[0]) return; - mx = s->mv[1][0][0]; - my = s->mv[1][0][1]; + mx = s->mv[1][0][0]; + my = s->mv[1][0][1]; uvmx = (mx + ((mx & 3) == 3)) >> 1; uvmy = (my + ((my & 3) == 3)) >> 1; if (v->field_mode) { if (v->cur_field_type != v->ref_field_type[1]) - my = my - 2 + 4 * v->cur_field_type; + my = my - 2 + 4 * v->cur_field_type; uvmy = uvmy - 2 + 4 * v->cur_field_type; } - if(v->fastuvmc) { - uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1)); - uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1)); + if (v->fastuvmc) { + uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); + uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1)); } srcY = s->next_picture.f.data[0]; srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; - src_x = s->mb_x * 16 + (mx >> 2); - src_y = s->mb_y * 16 + (my >> 2); - uvsrc_x = s->mb_x * 8 + (uvmx >> 2); - uvsrc_y = s->mb_y * 8 + (uvmy >> 2); + src_x = s->mb_x * 16 + (mx >> 2); + src_y = s->mb_y * 16 + (my >> 2); + uvsrc_x = s->mb_x * 8 + (uvmx >> 2); + uvsrc_y = s->mb_y * 8 + (uvmy >> 2); - if(v->profile != PROFILE_ADVANCED){ + if (v->profile != PROFILE_ADVANCED) { src_x = av_clip( src_x, -16, s->mb_width * 16); src_y = av_clip( src_y, -16, s->mb_height * 16); uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8); uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8); - }else{ + } else { src_x = av_clip( src_x, -17, s->avctx->coded_width); src_y = av_clip( src_y, -18, s->avctx->coded_height + 1); uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1); uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); } - srcY += src_y * s->linesize + src_x; + srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; @@ -1980,43 +2018,47 @@ static void vc1_interp_mc(VC1Context *v) } /* for grayscale we should not try to read from unknown area */ - if(s->flags & CODEC_FLAG_GRAY) { + if (s->flags & CODEC_FLAG_GRAY) { srcU = s->edge_emu_buffer + 18 * s->linesize; srcV = s->edge_emu_buffer + 18 * s->linesize; } - if(v->rangeredfrm - || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3 - || (unsigned)(src_y - s->mspel) > v_edge_pos - (my&3) - 16 - s->mspel*3){ - uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; + if (v->rangeredfrm + || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 16 - s->mspel * 3 + || (unsigned)(src_y - s->mspel) > v_edge_pos - (my & 3) - 16 - s->mspel * 3) { + uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); - s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, - src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, + 17 + s->mspel * 2, 17 + s->mspel * 2, + src_x - s->mspel, src_y - s->mspel, + s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; - s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, - uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); - s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, - uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8 + 1, 8 + 1, + uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8 + 1, 8 + 1, + uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; /* if we deal with range reduction we need to scale source blocks */ - if(v->rangeredfrm) { + if (v->rangeredfrm) { int i, j; uint8_t *src, *src2; src = srcY; - for(j = 0; j < 17 + s->mspel*2; j++) { - for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; + for (j = 0; j < 17 + s->mspel * 2; j++) { + for (i = 0; i < 17 + s->mspel * 2; i++) + src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize; } - src = srcU; src2 = srcV; - for(j = 0; j < 9; j++) { - for(i = 0; i < 9; i++) { - src[i] = ((src[i] - 128) >> 1) + 128; + src = srcU; + src2 = srcV; + for (j = 0; j < 9; j++) { + for (i = 0; i < 9; i++) { + src[i] = ((src[i] - 128) >> 1) + 128; src2[i] = ((src2[i] - 128) >> 1) + 128; } - src += s->uvlinesize; + src += s->uvlinesize; src2 += s->uvlinesize; } } @@ -2024,14 +2066,14 @@ static void vc1_interp_mc(VC1Context *v) } if (v->field_mode && v->cur_field_type) { - off = s->current_picture_ptr->f.linesize[0]; + off = s->current_picture_ptr->f.linesize[0]; off_uv = s->current_picture_ptr->f.linesize[1]; } else { - off = 0; + off = 0; off_uv = 0; } - if(s->mspel) { + if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off , srcY , s->linesize, v->rnd); v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8, srcY + 8, s->linesize, v->rnd); @@ -2041,20 +2083,20 @@ static void vc1_interp_mc(VC1Context *v) } else { // hpel mc dxy = (my & 2) | ((mx & 2) >> 1); - if(!v->rnd) + if (!v->rnd) dsp->avg_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); else dsp->avg_no_rnd_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); } - if(s->flags & CODEC_FLAG_GRAY) return; + if (s->flags & CODEC_FLAG_GRAY) return; /* Chroma MC always uses qpel blilinear */ - uvmx = (uvmx&3)<<1; - uvmy = (uvmy&3)<<1; - if(!v->rnd){ + uvmx = (uvmx & 3) << 1; + uvmy = (uvmy & 3) << 1; + if (!v->rnd) { dsp->avg_h264_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->avg_h264_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); - }else{ + } else { v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy); v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy); } @@ -2065,21 +2107,22 @@ static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs) int n = bfrac; #if B_FRACTION_DEN==256 - if(inv) + if (inv) n -= 256; - if(!qs) + if (!qs) return 2 * ((value * n + 255) >> 9); return (value * n + 128) >> 8; #else - if(inv) + if (inv) n -= B_FRACTION_DEN; - if(!qs) + if (!qs) return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN)); return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN; #endif } -static av_always_inline int scale_mv_intfi(int value, int bfrac, int inv, int qs, int qs_last) +static av_always_inline int scale_mv_intfi(int value, int bfrac, int inv, + int qs, int qs_last) { int n = bfrac; @@ -2094,31 +2137,37 @@ static av_always_inline int scale_mv_intfi(int value, int bfrac, int inv, int qs /** Reconstruct motion vector for B-frame and do motion compensation */ -static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mode) +static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2], + int direct, int mode) { - if(v->use_ic) { + if (v->use_ic) { v->mv_mode2 = v->mv_mode; - v->mv_mode = MV_PMODE_INTENSITY_COMP; + v->mv_mode = MV_PMODE_INTENSITY_COMP; } - if(direct) { + if (direct) { vc1_mc_1mv(v, 0); vc1_interp_mc(v); - if(v->use_ic) v->mv_mode = v->mv_mode2; + if (v->use_ic) + v->mv_mode = v->mv_mode2; return; } - if(mode == BMV_TYPE_INTERPOLATED) { + if (mode == BMV_TYPE_INTERPOLATED) { vc1_mc_1mv(v, 0); vc1_interp_mc(v); - if(v->use_ic) v->mv_mode = v->mv_mode2; + if (v->use_ic) + v->mv_mode = v->mv_mode2; return; } - if(v->use_ic && (mode == BMV_TYPE_BACKWARD)) v->mv_mode = v->mv_mode2; + if (v->use_ic && (mode == BMV_TYPE_BACKWARD)) + v->mv_mode = v->mv_mode2; vc1_mc_1mv(v, (mode == BMV_TYPE_BACKWARD)); - if(v->use_ic) v->mv_mode = v->mv_mode2; + if (v->use_ic) + v->mv_mode = v->mv_mode2; } -static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype) +static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], + int direct, int mvtype) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; @@ -2139,7 +2188,7 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int wrap = s->b8_stride; xy = s->block_index[0]; - if(s->mb_intra) { + if (s->mb_intra) { s->current_picture.f.motion_val[0][xy + v->blocks_off][0] = s->current_picture.f.motion_val[0][xy + v->blocks_off][1] = s->current_picture.f.motion_val[1][xy + v->blocks_off][0] = @@ -2158,7 +2207,7 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width << 6) - 4 - (s->mb_x << 6)); s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6)); } - if(direct) { + if (direct) { s->current_picture.f.motion_val[0][xy + v->blocks_off][0] = s->mv[0][0][0]; s->current_picture.f.motion_val[0][xy + v->blocks_off][1] = s->mv[0][0][1]; s->current_picture.f.motion_val[1][xy + v->blocks_off][0] = s->mv[1][0][0]; @@ -2166,22 +2215,22 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int return; } - if((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { - C = s->current_picture.f.motion_val[0][xy - 2]; - A = s->current_picture.f.motion_val[0][xy - wrap*2]; + if ((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { + C = s->current_picture.f.motion_val[0][xy - 2]; + A = s->current_picture.f.motion_val[0][xy - wrap * 2]; off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; - B = s->current_picture.f.motion_val[0][xy - wrap*2 + off]; + B = s->current_picture.f.motion_val[0][xy - wrap * 2 + off]; - if(!s->mb_x) C[0] = C[1] = 0; - if(!s->first_slice_line) { // predictor A is not out of bounds - if(s->mb_width == 1) { + if (!s->mb_x) C[0] = C[1] = 0; + if (!s->first_slice_line) { // predictor A is not out of bounds + if (s->mb_width == 1) { px = A[0]; py = A[1]; } else { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } - } else if(s->mb_x) { // predictor C is not out of bounds + } else if (s->mb_x) { // predictor C is not out of bounds px = C[0]; py = C[1]; } else { @@ -2190,34 +2239,34 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int /* Pullback MV as specified in 8.3.5.3.4 */ { int qx, qy, X, Y; - if(v->profile < PROFILE_ADVANCED) { + if (v->profile < PROFILE_ADVANCED) { qx = (s->mb_x << 5); qy = (s->mb_y << 5); - X = (s->mb_width << 5) - 4; - Y = (s->mb_height << 5) - 4; - if(qx + px < -28) px = -28 - qx; - if(qy + py < -28) py = -28 - qy; - if(qx + px > X) px = X - qx; - if(qy + py > Y) py = Y - qy; + X = (s->mb_width << 5) - 4; + Y = (s->mb_height << 5) - 4; + if (qx + px < -28) px = -28 - qx; + if (qy + py < -28) py = -28 - qy; + if (qx + px > X) px = X - qx; + if (qy + py > Y) py = Y - qy; } else { qx = (s->mb_x << 6); qy = (s->mb_y << 6); - X = (s->mb_width << 6) - 4; - Y = (s->mb_height << 6) - 4; - if(qx + px < -60) px = -60 - qx; - if(qy + py < -60) py = -60 - qy; - if(qx + px > X) px = X - qx; - if(qy + py > Y) py = Y - qy; + X = (s->mb_width << 6) - 4; + Y = (s->mb_height << 6) - 4; + if (qx + px < -60) px = -60 - qx; + if (qy + py < -60) py = -60 - qy; + if (qx + px > X) px = X - qx; + if (qy + py > Y) py = Y - qy; } } /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ - if(0 && !s->first_slice_line && s->mb_x) { - if(is_intra[xy - wrap]) + if (0 && !s->first_slice_line && s->mb_x) { + if (is_intra[xy - wrap]) sum = FFABS(px) + FFABS(py); else sum = FFABS(px - A[0]) + FFABS(py - A[1]); - if(sum > 32) { - if(get_bits1(&s->gb)) { + if (sum > 32) { + if (get_bits1(&s->gb)) { px = A[0]; py = A[1]; } else { @@ -2225,12 +2274,12 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int py = C[1]; } } else { - if(is_intra[xy - 2]) + if (is_intra[xy - 2]) sum = FFABS(px) + FFABS(py); else sum = FFABS(px - C[0]) + FFABS(py - C[1]); - if(sum > 32) { - if(get_bits1(&s->gb)) { + if (sum > 32) { + if (get_bits1(&s->gb)) { px = A[0]; py = A[1]; } else { @@ -2244,22 +2293,23 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int s->mv[0][0][0] = ((px + dmv_x[0] + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y; } - if((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { - C = s->current_picture.f.motion_val[1][xy - 2]; - A = s->current_picture.f.motion_val[1][xy - wrap*2]; + if ((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) { + C = s->current_picture.f.motion_val[1][xy - 2]; + A = s->current_picture.f.motion_val[1][xy - wrap * 2]; off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2; - B = s->current_picture.f.motion_val[1][xy - wrap*2 + off]; + B = s->current_picture.f.motion_val[1][xy - wrap * 2 + off]; - if(!s->mb_x) C[0] = C[1] = 0; - if(!s->first_slice_line) { // predictor A is not out of bounds - if(s->mb_width == 1) { + if (!s->mb_x) + C[0] = C[1] = 0; + if (!s->first_slice_line) { // predictor A is not out of bounds + if (s->mb_width == 1) { px = A[0]; py = A[1]; } else { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } - } else if(s->mb_x) { // predictor C is not out of bounds + } else if (s->mb_x) { // predictor C is not out of bounds px = C[0]; py = C[1]; } else { @@ -2268,34 +2318,34 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int /* Pullback MV as specified in 8.3.5.3.4 */ { int qx, qy, X, Y; - if(v->profile < PROFILE_ADVANCED) { + if (v->profile < PROFILE_ADVANCED) { qx = (s->mb_x << 5); qy = (s->mb_y << 5); - X = (s->mb_width << 5) - 4; - Y = (s->mb_height << 5) - 4; - if(qx + px < -28) px = -28 - qx; - if(qy + py < -28) py = -28 - qy; - if(qx + px > X) px = X - qx; - if(qy + py > Y) py = Y - qy; + X = (s->mb_width << 5) - 4; + Y = (s->mb_height << 5) - 4; + if (qx + px < -28) px = -28 - qx; + if (qy + py < -28) py = -28 - qy; + if (qx + px > X) px = X - qx; + if (qy + py > Y) py = Y - qy; } else { qx = (s->mb_x << 6); qy = (s->mb_y << 6); - X = (s->mb_width << 6) - 4; - Y = (s->mb_height << 6) - 4; - if(qx + px < -60) px = -60 - qx; - if(qy + py < -60) py = -60 - qy; - if(qx + px > X) px = X - qx; - if(qy + py > Y) py = Y - qy; + X = (s->mb_width << 6) - 4; + Y = (s->mb_height << 6) - 4; + if (qx + px < -60) px = -60 - qx; + if (qy + py < -60) py = -60 - qy; + if (qx + px > X) px = X - qx; + if (qy + py > Y) py = Y - qy; } } /* Calculate hybrid prediction as specified in 8.3.5.3.5 */ - if(0 && !s->first_slice_line && s->mb_x) { - if(is_intra[xy - wrap]) + if (0 && !s->first_slice_line && s->mb_x) { + if (is_intra[xy - wrap]) sum = FFABS(px) + FFABS(py); else sum = FFABS(px - A[0]) + FFABS(py - A[1]); - if(sum > 32) { - if(get_bits1(&s->gb)) { + if (sum > 32) { + if (get_bits1(&s->gb)) { px = A[0]; py = A[1]; } else { @@ -2303,12 +2353,12 @@ static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int py = C[1]; } } else { - if(is_intra[xy - 2]) + if (is_intra[xy - 2]) sum = FFABS(px) + FFABS(py); else sum = FFABS(px - C[0]) + FFABS(py - C[1]); - if(sum > 32) { - if(get_bits1(&s->gb)) { + if (sum > 32) { + if (get_bits1(&s->gb)) { px = A[0]; py = A[1]; } else { @@ -2338,10 +2388,14 @@ static inline void vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dm if (v->bmvtype == BMV_TYPE_DIRECT) { int total_opp, k, f; if (s->next_picture.f.mb_type[mb_pos + v->mb_off] != MB_TYPE_INTRA) { - s->mv[0][0][0] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0], v->bfraction, 0, s->quarter_sample, v->qs_last); - s->mv[0][0][1] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1], v->bfraction, 0, s->quarter_sample, v->qs_last); - s->mv[1][0][0] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0], v->bfraction, 1, s->quarter_sample, v->qs_last); - s->mv[1][0][1] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1], v->bfraction, 1, s->quarter_sample, v->qs_last); + s->mv[0][0][0] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0], + v->bfraction, 0, s->quarter_sample, v->qs_last); + s->mv[0][0][1] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1], + v->bfraction, 0, s->quarter_sample, v->qs_last); + s->mv[1][0][0] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0], + v->bfraction, 1, s->quarter_sample, v->qs_last); + s->mv[1][0][1] = scale_mv_intfi(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1], + v->bfraction, 1, s->quarter_sample, v->qs_last); total_opp = v->mv_f_next[0][s->block_index[0] + v->blocks_off] + v->mv_f_next[0][s->block_index[1] + v->blocks_off] @@ -2372,12 +2426,12 @@ static inline void vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dm if (dir) { // backward vc1_pred_mv(v, n, dmv_x[1], dmv_y[1], mv1, v->range_x, v->range_y, v->mb_type[0], pred_flag[1], 1); if (n == 3 || mv1) { - vc1_pred_mv(v, 0, dmv_x[0], dmv_y[0], 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); + vc1_pred_mv(v, 0, dmv_x[0], dmv_y[0], 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); } } else { // forward vc1_pred_mv(v, n, dmv_x[0], dmv_y[0], mv1, v->range_x, v->range_y, v->mb_type[0], pred_flag[0], 0); if (n == 3 || mv1) { - vc1_pred_mv(v, 0, dmv_x[1], dmv_y[1], 1, v->range_x, v->range_y, v->mb_type[0], 0, 1); + vc1_pred_mv(v, 0, dmv_x[1], dmv_y[1], 1, v->range_x, v->range_y, v->mb_type[0], 0, 1); } } } @@ -2392,23 +2446,23 @@ static inline void vc1_pred_b_mv_intfi(VC1Context *v, int n, int *dmv_x, int *dm * @param dir_ptr Prediction direction for use in AC prediction */ static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n, - int16_t **dc_val_ptr, int *dir_ptr) + int16_t **dc_val_ptr, int *dir_ptr) { int a, b, c, wrap, pred, scale; int16_t *dc_val; static const uint16_t dcpred[32] = { - -1, 1024, 512, 341, 256, 205, 171, 146, 128, - 114, 102, 93, 85, 79, 73, 68, 64, - 60, 57, 54, 51, 49, 47, 45, 43, - 41, 39, 38, 37, 35, 34, 33 + -1, 1024, 512, 341, 256, 205, 171, 146, 128, + 114, 102, 93, 85, 79, 73, 68, 64, + 60, 57, 54, 51, 49, 47, 45, 43, + 41, 39, 38, 37, 35, 34, 33 }; /* find prediction - wmv3_dc_scale always used here in fact */ - if (n < 4) scale = s->y_dc_scale; - else scale = s->c_dc_scale; + if (n < 4) scale = s->y_dc_scale; + else scale = s->c_dc_scale; - wrap = s->block_wrap[n]; - dc_val= s->dc_val[0] + s->block_index[n]; + wrap = s->block_wrap[n]; + dc_val = s->dc_val[0] + s->block_index[n]; /* B A * C X @@ -2417,25 +2471,26 @@ static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n, b = dc_val[ - 1 - wrap]; a = dc_val[ - wrap]; - if (pq < 9 || !overlap) - { + if (pq < 9 || !overlap) { /* Set outer values */ - if (s->first_slice_line && (n!=2 && n!=3)) b=a=dcpred[scale]; - if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=dcpred[scale]; - } - else - { + if (s->first_slice_line && (n != 2 && n != 3)) + b = a = dcpred[scale]; + if (s->mb_x == 0 && (n != 1 && n != 3)) + b = c = dcpred[scale]; + } else { /* Set outer values */ - if (s->first_slice_line && (n!=2 && n!=3)) b=a=0; - if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=0; + if (s->first_slice_line && (n != 2 && n != 3)) + b = a = 0; + if (s->mb_x == 0 && (n != 1 && n != 3)) + b = c = 0; } if (abs(a - b) <= abs(b - c)) { - pred = c; - *dir_ptr = 1;//left + pred = c; + *dir_ptr = 1; // left } else { - pred = a; - *dir_ptr = 0;//top + pred = a; + *dir_ptr = 0; // top } /* update predictor */ @@ -2465,7 +2520,7 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, int q1, q2 = 0; wrap = s->block_wrap[n]; - dc_val= s->dc_val[0] + s->block_index[n]; + dc_val = s->dc_val[0] + s->block_index[n]; /* B A * C X @@ -2475,42 +2530,44 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, a = dc_val[ - wrap]; /* scale predictors if needed */ q1 = s->current_picture.f.qscale_table[mb_pos]; - if(c_avail && (n!= 1 && n!=3)) { + if (c_avail && (n != 1 && n != 3)) { q2 = s->current_picture.f.qscale_table[mb_pos - 1]; - if(q2 && q2 != q1) + if (q2 && q2 != q1) c = (c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18; } - if(a_avail && (n!= 2 && n!=3)) { + if (a_avail && (n != 2 && n != 3)) { q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; - if(q2 && q2 != q1) + if (q2 && q2 != q1) a = (a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18; } - if(a_avail && c_avail && (n!=3)) { + if (a_avail && c_avail && (n != 3)) { int off = mb_pos; - if(n != 1) off--; - if(n != 2) off -= s->mb_stride; + if (n != 1) + off--; + if (n != 2) + off -= s->mb_stride; q2 = s->current_picture.f.qscale_table[off]; - if(q2 && q2 != q1) + if (q2 && q2 != q1) b = (b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18; } - if(a_avail && c_avail) { - if(abs(a - b) <= abs(b - c)) { - pred = c; - *dir_ptr = 1;//left + if (a_avail && c_avail) { + if (abs(a - b) <= abs(b - c)) { + pred = c; + *dir_ptr = 1; // left } else { - pred = a; - *dir_ptr = 0;//top - } - } else if(a_avail) { - pred = a; - *dir_ptr = 0;//top - } else if(c_avail) { - pred = c; - *dir_ptr = 1;//left + pred = a; + *dir_ptr = 0; // top + } + } else if (a_avail) { + pred = a; + *dir_ptr = 0; // top + } else if (c_avail) { + pred = c; + *dir_ptr = 1; // left } else { - pred = 0; - *dir_ptr = 1;//left + pred = 0; + *dir_ptr = 1; // left } /* update predictor */ @@ -2526,11 +2583,12 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n, * @{ */ -static inline int vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) +static inline int vc1_coded_block_pred(MpegEncContext * s, int n, + uint8_t **coded_block_ptr) { int xy, wrap, pred, a, b, c; - xy = s->block_index[n]; + xy = s->block_index[n]; wrap = s->b8_stride; /* B C @@ -2561,61 +2619,62 @@ static inline int vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **code * @param codingset set of VLC to decode data * @see 8.1.3.4 */ -static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, int codingset) +static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, + int *value, int codingset) { GetBitContext *gb = &v->s.gb; int index, escape, run = 0, level = 0, lst = 0; index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3); if (index != vc1_ac_sizes[codingset] - 1) { - run = vc1_index_decode_table[codingset][index][0]; + run = vc1_index_decode_table[codingset][index][0]; level = vc1_index_decode_table[codingset][index][1]; - lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0; - if(get_bits1(gb)) + lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0; + if (get_bits1(gb)) level = -level; } else { escape = decode210(gb); if (escape != 2) { index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3); - run = vc1_index_decode_table[codingset][index][0]; + run = vc1_index_decode_table[codingset][index][0]; level = vc1_index_decode_table[codingset][index][1]; - lst = index >= vc1_last_decode_table[codingset]; - if(escape == 0) { - if(lst) + lst = index >= vc1_last_decode_table[codingset]; + if (escape == 0) { + if (lst) level += vc1_last_delta_level_table[codingset][run]; else level += vc1_delta_level_table[codingset][run]; } else { - if(lst) + if (lst) run += vc1_last_delta_run_table[codingset][level] + 1; else run += vc1_delta_run_table[codingset][level] + 1; } - if(get_bits1(gb)) + if (get_bits1(gb)) level = -level; } else { int sign; lst = get_bits1(gb); - if(v->s.esc3_level_length == 0) { - if(v->pq < 8 || v->dquantfrm) { // table 59 + if (v->s.esc3_level_length == 0) { + if (v->pq < 8 || v->dquantfrm) { // table 59 v->s.esc3_level_length = get_bits(gb, 3); - if(!v->s.esc3_level_length) + if (!v->s.esc3_level_length) v->s.esc3_level_length = get_bits(gb, 2) + 8; - } else { //table 60 + } else { // table 60 v->s.esc3_level_length = get_unary(gb, 1, 6) + 2; } v->s.esc3_run_length = 3 + get_bits(gb, 2); } - run = get_bits(gb, v->s.esc3_run_length); - sign = get_bits1(gb); + run = get_bits(gb, v->s.esc3_run_length); + sign = get_bits1(gb); level = get_bits(gb, v->s.esc3_level_length); - if(sign) + if (sign) level = -level; } } - *last = lst; - *skip = run; + *last = lst; + *skip = run; *value = level; } @@ -2626,7 +2685,8 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, * @param coded are AC coeffs present or not * @param codingset set of VLC to decode data */ -static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset) +static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, + int coded, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; @@ -2642,25 +2702,21 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } - if (dcdiff < 0){ + if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } - if (dcdiff) - { - if (dcdiff == 119 /* ESC index value */) - { + if (dcdiff) { + if (dcdiff == 119 /* ESC index value */) { /* TODO: Optimize */ - if (v->pq == 1) dcdiff = get_bits(gb, 10); + if (v->pq == 1) dcdiff = get_bits(gb, 10); else if (v->pq == 2) dcdiff = get_bits(gb, 9); - else dcdiff = get_bits(gb, 8); - } - else - { + else dcdiff = get_bits(gb, 8); + } else { if (v->pq == 1) - dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; + dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3; else if (v->pq == 2) - dcdiff = (dcdiff<<1) + get_bits1(gb) - 1; + dcdiff = (dcdiff << 1) + get_bits1(gb) - 1; } if (get_bits1(gb)) dcdiff = -dcdiff; @@ -2681,7 +2737,7 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded goto not_coded; } - //AC Decoding + // AC Decoding i = 1; { @@ -2692,87 +2748,87 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded scale = v->pq * 2 + v->halfpq; - if(v->s.ac_pred) { - if(!dc_pred_dir) + if (v->s.ac_pred) { + if (!dc_pred_dir) zz_table = v->zz_8x8[2]; else zz_table = v->zz_8x8[3]; } else zz_table = v->zz_8x8[1]; - ac_val = s->ac_val[0][0] + s->block_index[n] * 16; + ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; - if(dc_pred_dir) //left + if (dc_pred_dir) // left ac_val -= 16; - else //top + else // top ac_val -= 16 * s->block_wrap[n]; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; - if(i > 63) + if (i > 63) break; block[zz_table[i++]] = value; } /* apply AC prediction if needed */ - if(s->ac_pred) { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) + if (s->ac_pred) { + if (dc_pred_dir) { // left + for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += ac_val[k]; - } else { //top - for(k = 1; k < 8; k++) + } else { // top + for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += ac_val[k + 8]; } } /* save AC coeffs for further prediction */ - for(k = 1; k < 8; k++) { + for (k = 1; k < 8; k++) { ac_val2[k] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ - for(k = 1; k < 64; k++) - if(block[k]) { + for (k = 1; k < 64; k++) + if (block[k]) { block[k] *= scale; - if(!v->pquantizer) + if (!v->pquantizer) block[k] += (block[k] < 0) ? -v->pq : v->pq; } - if(s->ac_pred) i = 63; + if (s->ac_pred) i = 63; } not_coded: - if(!coded) { + if (!coded) { int k, scale; - ac_val = s->ac_val[0][0] + s->block_index[n] * 16; + ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; i = 0; scale = v->pq * 2 + v->halfpq; memset(ac_val2, 0, 16 * 2); - if(dc_pred_dir) {//left + if (dc_pred_dir) { // left ac_val -= 16; - if(s->ac_pred) + if (s->ac_pred) memcpy(ac_val2, ac_val, 8 * 2); - } else {//top + } else { // top ac_val -= 16 * s->block_wrap[n]; - if(s->ac_pred) + if (s->ac_pred) memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); } /* apply AC prediction if needed */ - if(s->ac_pred) { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) { + if (s->ac_pred) { + if (dc_pred_dir) { //left + for (k = 1; k < 8; k++) { block[k << v->left_blk_sh] = ac_val[k] * scale; - if(!v->pquantizer && block[k << v->left_blk_sh]) + if (!v->pquantizer && block[k << v->left_blk_sh]) block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -v->pq : v->pq; } - } else { //top - for(k = 1; k < 8; k++) { + } else { // top + for (k = 1; k < 8; k++) { block[k << v->top_blk_sh] = ac_val[k + 8] * scale; - if(!v->pquantizer && block[k << v->top_blk_sh]) + if (!v->pquantizer && block[k << v->top_blk_sh]) block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -v->pq : v->pq; } } @@ -2792,7 +2848,8 @@ not_coded: * @param codingset set of VLC to decode data * @param mquant quantizer value for this macroblock */ -static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant) +static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, + int coded, int codingset, int mquant) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; @@ -2813,25 +2870,21 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } - if (dcdiff < 0){ + if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } - if (dcdiff) - { - if (dcdiff == 119 /* ESC index value */) - { + if (dcdiff) { + if (dcdiff == 119 /* ESC index value */) { /* TODO: Optimize */ - if (mquant == 1) dcdiff = get_bits(gb, 10); + if (mquant == 1) dcdiff = get_bits(gb, 10); else if (mquant == 2) dcdiff = get_bits(gb, 9); - else dcdiff = get_bits(gb, 8); - } - else - { + else dcdiff = get_bits(gb, 8); + } else { if (mquant == 1) - dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; + dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3; else if (mquant == 2) - dcdiff = (dcdiff<<1) + get_bits1(gb) - 1; + dcdiff = (dcdiff << 1) + get_bits1(gb) - 1; } if (get_bits1(gb)) dcdiff = -dcdiff; @@ -2852,36 +2905,42 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c i = 1; /* check if AC is needed at all */ - if(!a_avail && !c_avail) use_pred = 0; - ac_val = s->ac_val[0][0] + s->block_index[n] * 16; + if (!a_avail && !c_avail) + use_pred = 0; + ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; scale = mquant * 2 + ((mquant == v->pq) ? v->halfpq : 0); - if(dc_pred_dir) //left + if (dc_pred_dir) // left ac_val -= 16; - else //top + else // top ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.f.qscale_table[mb_pos]; - if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.f.qscale_table[mb_pos - 1]; - if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; - if(dc_pred_dir && n==1) q2 = q1; - if(!dc_pred_dir && n==2) q2 = q1; - if(n==3) q2 = q1; - - if(coded) { + if ( dc_pred_dir && c_avail && mb_pos) + q2 = s->current_picture.f.qscale_table[mb_pos - 1]; + if (!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) + q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; + if ( dc_pred_dir && n == 1) + q2 = q1; + if (!dc_pred_dir && n == 2) + q2 = q1; + if (n == 3) + q2 = q1; + + if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; - if(v->s.ac_pred) { + if (v->s.ac_pred) { if (!use_pred && v->fcm == 1) { zz_table = v->zzi_8x8; } else { - if(!dc_pred_dir) //top + if (!dc_pred_dir) // top zz_table = v->zz_8x8[2]; - else //left + else // left zz_table = v->zz_8x8[3]; } } else { @@ -2894,88 +2953,88 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; - if(i > 63) + if (i > 63) break; block[zz_table[i++]] = value; } /* apply AC prediction if needed */ - if(use_pred) { + if (use_pred) { /* scale predictors if needed*/ - if(q2 && q1!=q2) { + if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) + if (dc_pred_dir) { // left + for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; - } else { //top - for(k = 1; k < 8; k++) + } else { // top + for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) + if (dc_pred_dir) { //left + for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += ac_val[k]; } else { //top - for(k = 1; k < 8; k++) + for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ - for(k = 1; k < 8; k++) { + for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ - for(k = 1; k < 64; k++) - if(block[k]) { + for (k = 1; k < 64; k++) + if (block[k]) { block[k] *= scale; - if(!v->pquantizer) + if (!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } - if(use_pred) i = 63; + if (use_pred) i = 63; } else { // no AC coeffs int k; memset(ac_val2, 0, 16 * 2); - if(dc_pred_dir) {//left - if(use_pred) { + if (dc_pred_dir) { // left + if (use_pred) { memcpy(ac_val2, ac_val, 8 * 2); - if(q2 && q1!=q2) { + if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; - for(k = 1; k < 8; k++) + for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } - } else {//top - if(use_pred) { + } else { // top + if (use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); - if(q2 && q1!=q2) { + if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; - for(k = 1; k < 8; k++) + for (k = 1; k < 8; k++) ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } /* apply AC prediction if needed */ - if(use_pred) { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) { + if (use_pred) { + if (dc_pred_dir) { // left + for (k = 1; k < 8; k++) { block[k << v->left_blk_sh] = ac_val2[k] * scale; - if(!v->pquantizer && block[k << v->left_blk_sh]) + if (!v->pquantizer && block[k << v->left_blk_sh]) block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; } - } else { //top - for(k = 1; k < 8; k++) { + } else { // top + for (k = 1; k < 8; k++) { block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k << v->top_blk_sh]) + if (!v->pquantizer && block[k << v->top_blk_sh]) block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; } } @@ -2995,7 +3054,8 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c * @param mquant block quantizer * @param codingset set of VLC to decode data */ -static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset) +static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, + int coded, int mquant, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; @@ -3013,7 +3073,7 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c s->dsp.clear_block(block); /* XXX: Guard against dumb values of mquant */ - mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant ); + mquant = (mquant < 1) ? 0 : ((mquant > 31) ? 31 : mquant); /* Set DC scale - y and c use the same */ s->y_dc_scale = s->y_dc_scale_table[mquant]; @@ -3025,25 +3085,21 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } - if (dcdiff < 0){ + if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } - if (dcdiff) - { - if (dcdiff == 119 /* ESC index value */) - { + if (dcdiff) { + if (dcdiff == 119 /* ESC index value */) { /* TODO: Optimize */ - if (mquant == 1) dcdiff = get_bits(gb, 10); + if (mquant == 1) dcdiff = get_bits(gb, 10); else if (mquant == 2) dcdiff = get_bits(gb, 9); - else dcdiff = get_bits(gb, 8); - } - else - { + else dcdiff = get_bits(gb, 8); + } else { if (mquant == 1) - dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; + dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3; else if (mquant == 2) - dcdiff = (dcdiff<<1) + get_bits1(gb) - 1; + dcdiff = (dcdiff << 1) + get_bits1(gb) - 1; } if (get_bits1(gb)) dcdiff = -dcdiff; @@ -3065,42 +3121,46 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c i = 1; /* check if AC is needed at all and adjust direction if needed */ - if(!a_avail) dc_pred_dir = 1; - if(!c_avail) dc_pred_dir = 0; - if(!a_avail && !c_avail) use_pred = 0; + if (!a_avail) dc_pred_dir = 1; + if (!c_avail) dc_pred_dir = 0; + if (!a_avail && !c_avail) use_pred = 0; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; scale = mquant * 2 + v->halfpq; - if(dc_pred_dir) //left + if (dc_pred_dir) //left ac_val -= 16; else //top ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.f.qscale_table[mb_pos]; - if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.f.qscale_table[mb_pos - 1]; - if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; - if(dc_pred_dir && n==1) q2 = q1; - if(!dc_pred_dir && n==2) q2 = q1; - if(n==3) q2 = q1; + if (dc_pred_dir && c_avail && mb_pos) + q2 = s->current_picture.f.qscale_table[mb_pos - 1]; + if (!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) + q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; + if ( dc_pred_dir && n == 1) + q2 = q1; + if (!dc_pred_dir && n == 2) + q2 = q1; + if (n == 3) q2 = q1; - if(coded) { + if (coded) { int last = 0, skip, value; int k; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; - if(i > 63) + if (i > 63) break; if (v->fcm == 0) block[v->zz_8x8[0][i++]] = value; else { - if(use_pred && (v->fcm == 1)) { - if(!dc_pred_dir) //top + if (use_pred && (v->fcm == 1)) { + if (!dc_pred_dir) // top block[v->zz_8x8[2][i++]] = value; - else //left + else // left block[v->zz_8x8[3][i++]] = value; } else { block[v->zzi_8x8[i++]] = value; @@ -3109,82 +3169,82 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c } /* apply AC prediction if needed */ - if(use_pred) { + if (use_pred) { /* scale predictors if needed*/ - if(q2 && q1!=q2) { + if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) + if (dc_pred_dir) { // left + for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top - for(k = 1; k < 8; k++) + for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) + if (dc_pred_dir) { // left + for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += ac_val[k]; - } else { //top - for(k = 1; k < 8; k++) + } else { // top + for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ - for(k = 1; k < 8; k++) { + for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ - for(k = 1; k < 64; k++) - if(block[k]) { + for (k = 1; k < 64; k++) + if (block[k]) { block[k] *= scale; - if(!v->pquantizer) + if (!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } - if(use_pred) i = 63; + if (use_pred) i = 63; } else { // no AC coeffs int k; memset(ac_val2, 0, 16 * 2); - if(dc_pred_dir) {//left - if(use_pred) { + if (dc_pred_dir) { // left + if (use_pred) { memcpy(ac_val2, ac_val, 8 * 2); - if(q2 && q1!=q2) { + if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; - for(k = 1; k < 8; k++) + for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } - } else {//top - if(use_pred) { + } else { // top + if (use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); - if(q2 && q1!=q2) { + if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; - for(k = 1; k < 8; k++) + for (k = 1; k < 8; k++) ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } /* apply AC prediction if needed */ - if(use_pred) { - if(dc_pred_dir) { //left - for(k = 1; k < 8; k++) { + if (use_pred) { + if (dc_pred_dir) { // left + for (k = 1; k < 8; k++) { block[k << v->left_blk_sh] = ac_val2[k] * scale; - if(!v->pquantizer && block[k << v->left_blk_sh]) + if (!v->pquantizer && block[k << v->left_blk_sh]) block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; } - } else { //top - for(k = 1; k < 8; k++) { + } else { // top + for (k = 1; k < 8; k++) { block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k << v->top_blk_sh]) + if (!v->pquantizer && block[k << v->top_blk_sh]) block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; } } @@ -3198,8 +3258,10 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c /** Decode P block */ -static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquant, int ttmb, int first_block, - uint8_t *dst, int linesize, int skip_block, int *ttmb_out) +static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, + int mquant, int ttmb, int first_block, + uint8_t *dst, int linesize, int skip_block, + int *ttmb_out) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; @@ -3211,53 +3273,56 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan s->dsp.clear_block(block); - if(ttmb == -1) { + if (ttmb == -1) { ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)]; } - if(ttblk == TT_4X4) { + if (ttblk == TT_4X4) { subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1); } - if((ttblk != TT_8X8 && ttblk != TT_4X4) + if ((ttblk != TT_8X8 && ttblk != TT_4X4) && ((v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block)) || (!v->res_rtm_flag && !first_block))) { subblkpat = decode012(gb); - if(subblkpat) subblkpat ^= 3; //swap decoded pattern bits - if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4; - if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) ttblk = TT_4X8; + if (subblkpat) + subblkpat ^= 3; // swap decoded pattern bits + if (ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) + ttblk = TT_8X4; + if (ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) + ttblk = TT_4X8; } scale = 2 * mquant + ((v->pq == mquant) ? v->halfpq : 0); // convert transforms like 8X4_TOP to generic TT and SUBBLKPAT - if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) { + if (ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) { subblkpat = 2 - (ttblk == TT_8X4_TOP); - ttblk = TT_8X4; + ttblk = TT_8X4; } - if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) { + if (ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) { subblkpat = 2 - (ttblk == TT_4X8_LEFT); - ttblk = TT_4X8; + ttblk = TT_4X8; } - switch(ttblk) { + switch (ttblk) { case TT_8X8: - pat = 0xF; - i = 0; + pat = 0xF; + i = 0; last = 0; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; - if(i > 63) + if (i > 63) break; if (!v->interlace) idx = v->zz_8x8[0][i++]; else idx = v->zzi_8x8[i++]; block[idx] = value * scale; - if(!v->pquantizer) + if (!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } - if(!skip_block){ - if(i==1) + if (!skip_block) { + if (i == 1) v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); - else{ + else { v->vc1dsp.vc1_inv_trans_8x8(block); s->dsp.add_pixels_clamped(block, dst, linesize); } @@ -3265,80 +3330,80 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan break; case TT_4X4: pat = ~subblkpat & 0xF; - for(j = 0; j < 4; j++) { + for (j = 0; j < 4; j++) { last = subblkpat & (1 << (3 - j)); - i = 0; - off = (j & 1) * 4 + (j & 2) * 16; + i = 0; + off = (j & 1) * 4 + (j & 2) * 16; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; - if(i > 15) + if (i > 15) break; if (!v->interlace) idx = ff_vc1_simple_progressive_4x4_zz[i++]; else idx = ff_vc1_adv_interlaced_4x4_zz[i++]; block[idx + off] = value * scale; - if(!v->pquantizer) + if (!v->pquantizer) block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant; } - if(!(subblkpat & (1 << (3 - j))) && !skip_block){ - if(i==1) - v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); + if (!(subblkpat & (1 << (3 - j))) && !skip_block) { + if (i == 1) + v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off); else - v->vc1dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x4(dst + (j & 1) * 4 + (j & 2) * 2 * linesize, linesize, block + off); } } break; case TT_8X4: - pat = ~((subblkpat & 2)*6 + (subblkpat & 1)*3) & 0xF; - for(j = 0; j < 2; j++) { + pat = ~((subblkpat & 2) * 6 + (subblkpat & 1) * 3) & 0xF; + for (j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); - i = 0; - off = j * 32; + i = 0; + off = j * 32; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; - if(i > 31) + if (i > 31) break; if (!v->interlace) idx = v->zz_8x4[i++] + off; else idx = ff_vc1_adv_interlaced_8x4_zz[i++] + off; block[idx] = value * scale; - if(!v->pquantizer) + if (!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } - if(!(subblkpat & (1 << (1 - j))) && !skip_block){ - if(i==1) - v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off); + if (!(subblkpat & (1 << (1 - j))) && !skip_block) { + if (i == 1) + v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j * 4 * linesize, linesize, block + off); else - v->vc1dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_8x4(dst + j * 4 * linesize, linesize, block + off); } } break; case TT_4X8: - pat = ~(subblkpat*5) & 0xF; - for(j = 0; j < 2; j++) { + pat = ~(subblkpat * 5) & 0xF; + for (j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); - i = 0; - off = j * 4; + i = 0; + off = j * 4; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; - if(i > 31) + if (i > 31) break; if (!v->interlace) idx = v->zz_4x8[i++] + off; else idx = ff_vc1_adv_interlaced_4x8_zz[i++] + off; block[idx] = value * scale; - if(!v->pquantizer) + if (!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } - if(!(subblkpat & (1 << (1 - j))) && !skip_block){ - if(i==1) - v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off); + if (!(subblkpat & (1 << (1 - j))) && !skip_block) { + if (i == 1) + v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j * 4, linesize, block + off); else v->vc1dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); } @@ -3357,15 +3422,15 @@ static const int offset_table[6] = { 0, 1, 3, 7, 15, 31 }; static av_always_inline void vc1_apply_p_v_loop_filter(VC1Context *v, int block_num) { - MpegEncContext *s = &v->s; + MpegEncContext *s = &v->s; int mb_cbp = v->cbp[s->mb_x - s->mb_stride], block_cbp = mb_cbp >> (block_num * 4), bottom_cbp, mb_is_intra = v->is_intra[s->mb_x - s->mb_stride], block_is_intra = mb_is_intra >> (block_num * 4), bottom_is_intra; - int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize, ttblk; + int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize, ttblk; uint8_t *dst; - if(block_num > 3) { + if (block_num > 3) { dst = s->dest[block_num - 3]; } else { dst = s->dest[0] + (block_num & 1) * 8 + ((block_num & 2) * 4 - 8) * linesize; @@ -3374,16 +3439,16 @@ static av_always_inline void vc1_apply_p_v_loop_filter(VC1Context *v, int block_ int16_t (*mv)[2]; int mv_stride; - if(block_num > 3) { + if (block_num > 3) { bottom_cbp = v->cbp[s->mb_x] >> (block_num * 4); bottom_is_intra = v->is_intra[s->mb_x] >> (block_num * 4); mv = &v->luma_mv[s->mb_x - s->mb_stride]; mv_stride = s->mb_stride; } else { - bottom_cbp = (block_num < 2) ? (mb_cbp >> ((block_num + 2) * 4)) : - (v->cbp[s->mb_x] >> ((block_num - 2) * 4)); - bottom_is_intra = (block_num < 2) ? (mb_is_intra >> ((block_num + 2) * 4)) : - (v->is_intra[s->mb_x] >> ((block_num - 2) * 4)); + bottom_cbp = (block_num < 2) ? (mb_cbp >> ((block_num + 2) * 4)) + : (v->cbp[s->mb_x] >> ((block_num - 2) * 4)); + bottom_is_intra = (block_num < 2) ? (mb_is_intra >> ((block_num + 2) * 4)) + : (v->is_intra[s->mb_x] >> ((block_num - 2) * 4)); mv_stride = s->b8_stride; mv = &s->current_picture.f.motion_val[0][s->block_index[block_num] - 2 * mv_stride]; } @@ -3393,7 +3458,7 @@ static av_always_inline void vc1_apply_p_v_loop_filter(VC1Context *v, int block_ v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq); } else { idx = ((bottom_cbp >> 2) | block_cbp) & 3; - if(idx == 3) { + if (idx == 3) { v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq); } else if (idx) { if (idx == 1) @@ -3405,7 +3470,7 @@ static av_always_inline void vc1_apply_p_v_loop_filter(VC1Context *v, int block_ } dst -= 4 * linesize; - ttblk = (v->ttblk[s->mb_x - s->mb_stride] >> (block_num * 4)) & 0xf; + ttblk = (v->ttblk[s->mb_x - s->mb_stride] >> (block_num * 4)) & 0xF; if (ttblk == TT_4X4 || ttblk == TT_8X4) { idx = (block_cbp | (block_cbp >> 2)) & 3; if (idx == 3) { @@ -3421,12 +3486,12 @@ static av_always_inline void vc1_apply_p_v_loop_filter(VC1Context *v, int block_ static av_always_inline void vc1_apply_p_h_loop_filter(VC1Context *v, int block_num) { - MpegEncContext *s = &v->s; + MpegEncContext *s = &v->s; int mb_cbp = v->cbp[s->mb_x - 1 - s->mb_stride], block_cbp = mb_cbp >> (block_num * 4), right_cbp, mb_is_intra = v->is_intra[s->mb_x - 1 - s->mb_stride], block_is_intra = mb_is_intra >> (block_num * 4), right_is_intra; - int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize, ttblk; + int idx, linesize = block_num > 3 ? s->uvlinesize : s->linesize, ttblk; uint8_t *dst; if (block_num > 3) { @@ -3438,15 +3503,15 @@ static av_always_inline void vc1_apply_p_h_loop_filter(VC1Context *v, int block_ if (s->mb_x != s->mb_width || !(block_num & 5)) { int16_t (*mv)[2]; - if(block_num > 3) { + if (block_num > 3) { right_cbp = v->cbp[s->mb_x - s->mb_stride] >> (block_num * 4); right_is_intra = v->is_intra[s->mb_x - s->mb_stride] >> (block_num * 4); mv = &v->luma_mv[s->mb_x - s->mb_stride - 1]; - }else{ - right_cbp = (block_num & 1) ? (v->cbp[s->mb_x - s->mb_stride] >> ((block_num - 1) * 4)) : - (mb_cbp >> ((block_num + 1) * 4)); - right_is_intra = (block_num & 1) ? (v->is_intra[s->mb_x - s->mb_stride] >> ((block_num - 1) * 4)) : - (mb_is_intra >> ((block_num + 1) * 4)); + } else { + right_cbp = (block_num & 1) ? (v->cbp[s->mb_x - s->mb_stride] >> ((block_num - 1) * 4)) + : (mb_cbp >> ((block_num + 1) * 4)); + right_is_intra = (block_num & 1) ? (v->is_intra[s->mb_x - s->mb_stride] >> ((block_num - 1) * 4)) + : (mb_is_intra >> ((block_num + 1) * 4)); mv = &s->current_picture.f.motion_val[0][s->block_index[block_num] - s->b8_stride * 2 - 2]; } if (block_is_intra & 1 || right_is_intra & 1 || mv[0][0] != mv[1][0] || mv[0][1] != mv[1][1]) { @@ -3457,9 +3522,9 @@ static av_always_inline void vc1_apply_p_h_loop_filter(VC1Context *v, int block_ v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq); } else if (idx) { if (idx == 1) - v->vc1dsp.vc1_h_loop_filter4(dst+4*linesize, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst + 4 * linesize, linesize, v->pq); else - v->vc1dsp.vc1_h_loop_filter4(dst, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst, linesize, v->pq); } } } @@ -3472,9 +3537,9 @@ static av_always_inline void vc1_apply_p_h_loop_filter(VC1Context *v, int block_ v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq); } else if (idx) { if (idx == 1) - v->vc1dsp.vc1_h_loop_filter4(dst + linesize*4, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst + linesize * 4, linesize, v->pq); else - v->vc1dsp.vc1_h_loop_filter4(dst, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst, linesize, v->pq); } } } @@ -3536,10 +3601,8 @@ static int vc1_decode_p_mb(VC1Context *v) else skipped = v->s.mbskip_table[mb_pos]; - if (!fourmv) /* 1MV mode */ - { - if (!skipped) - { + if (!fourmv) { /* 1MV mode */ + if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { @@ -3550,180 +3613,186 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); /* FIXME Set DC val for inter block ? */ - if (s->mb_intra && !mb_has_coeffs) - { + if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); - cbp = 0; - } - else if (mb_has_coeffs) - { + cbp = 0; + } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); - } - else - { + } else { mquant = v->pq; - cbp = 0; + cbp = 0; } s->current_picture.f.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); - if(!s->mb_intra) vc1_mc_1mv(v, 0); + if (!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; - for (i=0; i<6; i++) - { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; - if(s->mb_intra) { + if (s->mb_intra) { /* check if prediction blocks A and C are available */ v->a_avail = v->c_avail = 0; - if(i == 2 || i == 3 || !s->first_slice_line) + if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; - if(i == 1 || i == 3 || s->mb_x) + if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; - vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); - if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + vc1_decode_intra_block(v, s->block[i], i, val, mquant, + (i & 4) ? v->codingset2 : v->codingset); + if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; + if (v->rangeredfrm) + for (j = 0; j < 64; j++) + s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); - if(v->pq >= 9 && v->overlap) { - if(v->c_avail) + if (v->pq >= 9 && v->overlap) { + if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); - if(v->a_avail) + if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } - block_cbp |= 0xF << (i << 2); + block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; - } else if(val) { - pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + } else if (val) { + pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, + s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, + (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); - if(!v->ttmbf && ttmb < 8) ttmb = -1; + if (!v->ttmbf && ttmb < 8) + ttmb = -1; first_block = 0; } } - } - else //Skipped - { + } else { // skipped s->mb_intra = 0; - for(i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; - s->dc_val[0][s->block_index[i]] = 0; + s->dc_val[0][s->block_index[i]] = 0; } - s->current_picture.f.mb_type[mb_pos] = MB_TYPE_SKIP; + s->current_picture.f.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.f.qscale_table[mb_pos] = 0; vc1_pred_mv(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_1mv(v, 0); } - } //1MV mode - else //4MV mode - { - if (!skipped /* unskipped MB */) - { + } else { // 4MV mode + if (!skipped /* unskipped MB */) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; /* Get CBPCY */ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); - for (i=0; i<6; i++) - { + for (i = 0; i < 6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; - s->mb_intra = 0; - if(i < 4) { + s->mb_intra = 0; + if (i < 4) { dmv_x = dmv_y = 0; - s->mb_intra = 0; + s->mb_intra = 0; mb_has_coeffs = 0; - if(val) { + if (val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); - if(!s->mb_intra) vc1_mc_4mv_luma(v, i, 0); + if (!s->mb_intra) + vc1_mc_4mv_luma(v, i, 0); intra_count += s->mb_intra; - is_intra[i] = s->mb_intra; - is_coded[i] = mb_has_coeffs; + is_intra[i] = s->mb_intra; + is_coded[i] = mb_has_coeffs; } - if(i&4){ + if (i & 4) { is_intra[i] = (intra_count >= 3); is_coded[i] = val; } - if(i == 4) vc1_mc_4mv_chroma(v, 0); + if (i == 4) + vc1_mc_4mv_chroma(v, 0); v->mb_type[0][s->block_index[i]] = is_intra[i]; - if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; + if (!coded_inter) + coded_inter = !is_intra[i] & is_coded[i]; } // if there are no coded blocks then don't do anything more dst_idx = 0; - if(!intra_count && !coded_inter) + if (!intra_count && !coded_inter) goto end; GET_MQUANT(); s->current_picture.f.qscale_table[mb_pos] = mquant; /* test if block is intra and has pred */ { int intrapred = 0; - for(i=0; i<6; i++) - if(is_intra[i]) { - if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) - || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) { + for (i = 0; i < 6; i++) + if (is_intra[i]) { + if (((!s->first_slice_line || (i == 2 || i == 3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) + || ((s->mb_x || (i == 1 || i == 3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } - if(intrapred)s->ac_pred = get_bits1(gb); - else s->ac_pred = 0; + if (intrapred) + s->ac_pred = get_bits1(gb); + else + s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); - for (i=0; i<6; i++) - { - dst_idx += i >> 2; - off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); + for (i = 0; i < 6; i++) { + dst_idx += i >> 2; + off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { /* check if prediction blocks A and C are available */ v->a_avail = v->c_avail = 0; - if(i == 2 || i == 3 || !s->first_slice_line) + if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; - if(i == 1 || i == 3 || s->mb_x) + if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; - vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); - if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, + (i & 4) ? v->codingset2 : v->codingset); + if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); - if(v->pq >= 9 && v->overlap) { - if(v->c_avail) + if (v->rangeredfrm) + for (j = 0; j < 64; j++) + s->block[i][j] <<= 1; + s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, + (i & 4) ? s->uvlinesize : s->linesize); + if (v->pq >= 9 && v->overlap) { + if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); - if(v->a_avail) + if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } - block_cbp |= 0xF << (i << 2); + block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; - } else if(is_coded[i]) { - pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + } else if (is_coded[i]) { + pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, + first_block, s->dest[dst_idx] + off, + (i & 4) ? s->uvlinesize : s->linesize, + (i & 4) && (s->flags & CODEC_FLAG_GRAY), + &block_tt); block_cbp |= pat << (i << 2); - if(!v->ttmbf && ttmb < 8) ttmb = -1; + if (!v->ttmbf && ttmb < 8) + ttmb = -1; first_block = 0; } } - } - else //Skipped MB - { - s->mb_intra = 0; + } else { // skipped MB + s->mb_intra = 0; s->current_picture.f.qscale_table[mb_pos] = 0; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; - s->dc_val[0][s->block_index[i]] = 0; + s->dc_val[0][s->block_index[i]] = 0; } - for (i=0; i<4; i++) - { + for (i = 0; i < 4; i++) { vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_4mv_luma(v, i, 0); } @@ -3732,8 +3801,8 @@ static int vc1_decode_p_mb(VC1Context *v) } } end: - v->cbp[s->mb_x] = block_cbp; - v->ttblk[s->mb_x] = block_tt; + v->cbp[s->mb_x] = block_cbp; + v->ttblk[s->mb_x] = block_tt; v->is_intra[s->mb_x] = block_intra; return 0; @@ -3771,7 +3840,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) if (v->fourmvswitch) idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_4MV_MBMODE_VLC_BITS, 2); // try getting this done else - idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); // in a single line + idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); // in a single line switch (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0]) { /* store the motion vector type in a flag (useful later) */ case MV_PMODE_INTFR_4MV: @@ -3805,9 +3874,10 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; - s->current_picture.f.mb_type[mb_pos] = MB_TYPE_INTRA; + s->current_picture.f.mb_type[mb_pos] = MB_TYPE_INTRA; s->mb_intra = v->is_intra[s->mb_x] = 1; - for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 1; + for (i = 0; i < 6; i++) + v->mb_type[0][s->block_index[i]] = 1; fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = get_bits1(gb); if (mb_has_coeffs) @@ -3819,19 +3889,20 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; dst_idx = 0; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->mb_type[0][s->block_index[i]] = s->mb_intra; v->a_avail = v->c_avail = 0; - if(i == 2 || i == 3 || !s->first_slice_line) + if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; - if(i == 1 || i == 3 || s->mb_x) + if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; - vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); - if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + vc1_decode_intra_block(v, s->block[i], i, val, mquant, + (i & 4) ? v->codingset2 : v->codingset); + if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (i < 4) { stride_y = s->linesize << fieldtx; @@ -3844,7 +3915,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) //TODO: loop filter } - } else { //inter MB + } else { // inter MB mb_has_coeffs = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][3]; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); @@ -3852,22 +3923,23 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1); } else { if ((ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV) - || (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV_FIELD)) { + || (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV_FIELD)) { v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); } } s->mb_intra = v->is_intra[s->mb_x] = 0; - for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; + for (i = 0; i < 6; i++) + v->mb_type[0][s->block_index[i]] = 0; fieldtx = v->fieldtx_plane[mb_pos] = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][1]; /* for all motion vector read MVDATA and motion compensate each block */ dst_idx = 0; if (fourmv) { mvbp = v->fourmvbp; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { if (i < 4) { dmv_x = dmv_y = 0; - val = ((mvbp >> (3 - i)) & 1); - if(val) { + val = ((mvbp >> (3 - i)) & 1); + if (val) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); } vc1_pred_mv_intfr(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); @@ -3877,7 +3949,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) } } } else if (twomv) { - mvbp = v->twomvbp; + mvbp = v->twomvbp; dmv_x = dmv_y = 0; if (mvbp & 2) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); @@ -3906,7 +3978,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) s->current_picture.f.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); @@ -3915,7 +3987,10 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) else off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize)); if (val) { - pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:(s->linesize << fieldtx), (i&4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, + first_block, s->dest[dst_idx] + off, + (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), + (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; @@ -3925,11 +4000,11 @@ static int vc1_decode_p_mb_intfr(VC1Context *v) } } else { // skipped s->mb_intra = v->is_intra[s->mb_x] = 0; - for(i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } - s->current_picture.f.mb_type[mb_pos] = MB_TYPE_SKIP; + s->current_picture.f.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.f.qscale_table[mb_pos] = 0; v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; @@ -3975,29 +4050,31 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; - v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); + v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; - for (i=0; i<6; i++) { - s->dc_val[0][s->block_index[i]] = 0; + for (i = 0; i < 6; i++) { + s->dc_val[0][s->block_index[i]] = 0; v->mb_type[0][s->block_index[i]] = 1; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->a_avail = v->c_avail = 0; - if(i == 2 || i == 3 || !s->first_slice_line) + if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; - if(i == 1 || i == 3 || s->mb_x) + if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; - vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); - if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + vc1_decode_intra_block(v, s->block[i], i, val, mquant, + (i & 4) ? v->codingset2 : v->codingset); + if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); + off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); off += v->cur_field_type ? ((i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]) : 0; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); - //TODO: loop filter + // TODO: loop filter } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; @@ -4013,11 +4090,11 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) mb_has_coeffs = !(idx_mbmode & 2); } else { // 4-MV v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { if (i < 4) { dmv_x = dmv_y = pred_flag = 0; - val = ((v->fourmvbp >> (3 - i)) & 1); - if(val) { + val = ((v->fourmvbp >> (3 - i)) & 1); + if (val) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag); } vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], pred_flag, 0); @@ -4037,23 +4114,27 @@ static int vc1_decode_p_mb_intfi(VC1Context *v) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (v->cur_field_type) off += (i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]; - if(val) { - pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); + if (val) { + pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, + first_block, s->dest[dst_idx] + off, + (i & 4) ? s->uvlinesize : s->linesize, + (i & 4) && (s->flags & CODEC_FLAG_GRAY), + &block_tt); block_cbp |= pat << (i << 2); - if(!v->ttmbf && ttmb < 8) ttmb = -1; + if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } if (s->mb_x == s->mb_width - 1) - memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); + memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); return 0; } @@ -4077,7 +4158,7 @@ static void vc1_decode_b_mb(VC1Context *v) int dmv_x[2], dmv_y[2]; int bmvtype = BMV_TYPE_BACKWARD; - mquant = v->pq; /* Loosy initialization */ + mquant = v->pq; /* Loosy initialization */ s->mb_intra = 0; if (v->dmb_is_raw) @@ -4090,9 +4171,9 @@ static void vc1_decode_b_mb(VC1Context *v) skipped = v->s.mbskip_table[mb_pos]; dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; - for(i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; - s->dc_val[0][s->block_index[i]] = 0; + s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.f.qscale_table[mb_pos] = 0; @@ -4102,9 +4183,9 @@ static void vc1_decode_b_mb(VC1Context *v) dmv_x[1] = dmv_x[0]; dmv_y[1] = dmv_y[0]; } - if(skipped || !s->mb_intra) { + if (skipped || !s->mb_intra) { bmvtype = decode012(gb); - switch(bmvtype) { + switch (bmvtype) { case 0: bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; break; @@ -4112,16 +4193,17 @@ static void vc1_decode_b_mb(VC1Context *v) bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD; break; case 2: - bmvtype = BMV_TYPE_INTERPOLATED; + bmvtype = BMV_TYPE_INTERPOLATED; dmv_x[0] = dmv_y[0] = 0; } } } - for(i = 0; i < 6; i++) + for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = s->mb_intra; if (skipped) { - if(direct) bmvtype = BMV_TYPE_INTERPOLATED; + if (direct) + bmvtype = BMV_TYPE_INTERPOLATED; vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; @@ -4131,28 +4213,28 @@ static void vc1_decode_b_mb(VC1Context *v) GET_MQUANT(); s->mb_intra = 0; s->current_picture.f.qscale_table[mb_pos] = mquant; - if(!v->ttmbf) + if (!v->ttmbf) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); } else { - if(!mb_has_coeffs && !s->mb_intra) { + if (!mb_has_coeffs && !s->mb_intra) { /* no coded blocks - effectively skipped */ vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } - if(s->mb_intra && !mb_has_coeffs) { + if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->current_picture.f.qscale_table[mb_pos] = mquant; s->ac_pred = get_bits1(gb); cbp = 0; vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); } else { - if(bmvtype == BMV_TYPE_INTERPOLATED) { + if (bmvtype == BMV_TYPE_INTERPOLATED) { GET_MVDATA(dmv_x[0], dmv_y[0]); - if(!mb_has_coeffs) { + if (!mb_has_coeffs) { /* interpolated skipped block */ vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); @@ -4160,42 +4242,49 @@ static void vc1_decode_b_mb(VC1Context *v) } } vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); - if(!s->mb_intra) { + if (!s->mb_intra) { vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); } - if(s->mb_intra) + if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); s->current_picture.f.qscale_table[mb_pos] = mquant; - if(!v->ttmbf && !s->mb_intra && mb_has_coeffs) + if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } } dst_idx = 0; - for (i=0; i<6; i++) - { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; - if(s->mb_intra) { + if (s->mb_intra) { /* check if prediction blocks A and C are available */ v->a_avail = v->c_avail = 0; - if(i == 2 || i == 3 || !s->first_slice_line) + if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; - if(i == 1 || i == 3 || s->mb_x) + if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; - vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); - if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + vc1_decode_intra_block(v, s->block[i], i, val, mquant, + (i & 4) ? v->codingset2 : v->codingset); + if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; + if (v->rangeredfrm) + for (j = 0; j < 64; j++) + s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); - } else if(val) { - vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), NULL); - if(!v->ttmbf && ttmb < 8) ttmb = -1; + } else if (val) { + vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, + first_block, s->dest[dst_idx] + off, + (i & 4) ? s->uvlinesize : s->linesize, + (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); + if (!v->ttmbf && ttmb < 8) + ttmb = -1; first_block = 0; } } @@ -4221,7 +4310,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) int bmvtype = BMV_TYPE_BACKWARD; int idx_mbmode, interpmvp; - mquant = v->pq; /* Loosy initialization */ + mquant = v->pq; /* Loosy initialization */ s->mb_intra = 0; idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); @@ -4229,36 +4318,40 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) s->mb_intra = v->is_intra[s->mb_x] = 1; s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; - s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; + s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.f.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; - v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); + v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->mb_type[0][s->block_index[i]] = s->mb_intra; - v->a_avail = v->c_avail = 0; - if(i == 2 || i == 3 || !s->first_slice_line) + v->a_avail = v->c_avail = 0; + if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; - if(i == 1 || i == 3 || s->mb_x) + if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; - vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); - if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; + vc1_decode_intra_block(v, s->block[i], i, val, mquant, + (i & 4) ? v->codingset2 : v->codingset); + if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); + if (v->rangeredfrm) + for (j = 0; j < 64; j++) + s->block[i][j] <<= 1; + off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); off += v->cur_field_type ? ((i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]) : 0; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); - //TODO: yet to perform loop filter + // TODO: yet to perform loop filter } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; @@ -4269,13 +4362,13 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) else fwd = v->forward_mb_plane[mb_pos]; if (idx_mbmode <= 5) { // 1-MV - dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; + dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; pred_flag[0] = pred_flag[1] = 0; if (fwd) bmvtype = BMV_TYPE_FORWARD; else { bmvtype = decode012(gb); - switch(bmvtype) { + switch (bmvtype) { case 0: bmvtype = BMV_TYPE_BACKWARD; break; @@ -4283,7 +4376,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) bmvtype = BMV_TYPE_DIRECT; break; case 2: - bmvtype = BMV_TYPE_INTERPOLATED; + bmvtype = BMV_TYPE_INTERPOLATED; interpmvp = get_bits1(gb); } } @@ -4304,15 +4397,17 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) } else { // 4-MV if (fwd) bmvtype = BMV_TYPE_FORWARD; - v->bmvtype = bmvtype; + v->bmvtype = bmvtype; v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { if (i < 4) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[1] = 0; val = ((v->fourmvbp >> (3 - i)) & 1); - if(val) { - get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); + if (val) { + get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], + &dmv_y[bmvtype == BMV_TYPE_BACKWARD], + &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag); vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD); @@ -4331,16 +4426,19 @@ static void vc1_decode_b_mb_intfi(VC1Context *v) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; - for (i=0; i<6; i++) { + for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (v->cur_field_type) off += (i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]; - if(val) { - vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), NULL); - if(!v->ttmbf && ttmb < 8) + if (val) { + vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, + first_block, s->dest[dst_idx] + off, + (i & 4) ? s->uvlinesize : s->linesize, + (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); + if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } @@ -4359,7 +4457,7 @@ static void vc1_decode_i_blocks(VC1Context *v) int mb_pos; /* select codingmode used for VLC tables selection */ - switch(v->y_ac_table_index){ + switch (v->y_ac_table_index) { case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; @@ -4371,7 +4469,7 @@ static void vc1_decode_i_blocks(VC1Context *v) break; } - switch(v->c_ac_table_index){ + switch (v->c_ac_table_index) { case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; @@ -4389,12 +4487,12 @@ static void vc1_decode_i_blocks(VC1Context *v) //do frame decode s->mb_x = s->mb_y = 0; - s->mb_intra = 1; + s->mb_intra = 1; s->first_slice_line = 1; - for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { + for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); - for(; s->mb_x < s->mb_width; s->mb_x++) { + for (; s->mb_x < s->mb_width; s->mb_x++) { uint8_t *dst[6]; ff_update_block_index(s); dst[0] = s->dest[0]; @@ -4405,8 +4503,8 @@ static void vc1_decode_i_blocks(VC1Context *v) dst[5] = s->dest[2]; s->dsp.clear_blocks(s->block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_width; - s->current_picture.f.mb_type[mb_pos] = MB_TYPE_INTRA; - s->current_picture.f.qscale_table[mb_pos] = v->pq; + s->current_picture.f.mb_type[mb_pos] = MB_TYPE_INTRA; + s->current_picture.f.qscale_table[mb_pos] = v->pq; s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; @@ -4414,44 +4512,49 @@ static void vc1_decode_i_blocks(VC1Context *v) cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); v->s.ac_pred = get_bits1(&v->s.gb); - for(k = 0; k < 6; k++) { + for (k = 0; k < 6; k++) { val = ((cbp >> (5 - k)) & 1); if (k < 4) { - int pred = vc1_coded_block_pred(&v->s, k, &coded_val); - val = val ^ pred; + int pred = vc1_coded_block_pred(&v->s, k, &coded_val); + val = val ^ pred; *coded_val = val; } cbp |= val << (5 - k); - vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); + vc1_decode_i_block(v, s->block[k], k, val, (k < 4) ? v->codingset : v->codingset2); - if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); - if(v->pq >= 9 && v->overlap) { - if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] <<= 1; + if (v->pq >= 9 && v->overlap) { + if (v->rangeredfrm) + for (j = 0; j < 64; j++) + s->block[k][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); } else { - if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] = (s->block[k][j] - 64) << 1; + if (v->rangeredfrm) + for (j = 0; j < 64; j++) + s->block[k][j] = (s->block[k][j] - 64) << 1; s->dsp.put_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); } } - if(v->pq >= 9 && v->overlap) { - if(s->mb_x) { + if (v->pq >= 9 && v->overlap) { + if (s->mb_x) { v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); - if(!(s->flags & CODEC_FLAG_GRAY)) { + if (!(s->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); - if(!s->first_slice_line) { + if (!s->first_slice_line) { v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); - if(!(s->flags & CODEC_FLAG_GRAY)) { + if (!(s->flags & CODEC_FLAG_GRAY)) { v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } @@ -4459,23 +4562,24 @@ static void vc1_decode_i_blocks(VC1Context *v) v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } - if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); + if (v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); - if(get_bits_count(&s->gb) > v->bits) { + if (get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); - av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); + av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", + get_bits_count(&s->gb), v->bits); return; } } if (!v->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); else if (s->mb_y) - ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); + ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16); s->first_slice_line = 0; } if (v->s.loop_filter) - ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); + ff_draw_horiz_band(s, (s->mb_height - 1) * 16, 16); ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END)); } @@ -4493,7 +4597,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) GetBitContext *gb = &s->gb; /* select codingmode used for VLC tables selection */ - switch(v->y_ac_table_index){ + switch (v->y_ac_table_index) { case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; @@ -4505,7 +4609,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) break; } - switch(v->c_ac_table_index){ + switch (v->c_ac_table_index) { case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; @@ -4517,26 +4621,26 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) break; } - //do frame decode - s->mb_x = s->mb_y = 0; - s->mb_intra = 1; + // do frame decode + s->mb_x = s->mb_y = 0; + s->mb_intra = 1; s->first_slice_line = 1; - s->mb_y = s->start_mb_y; + s->mb_y = s->start_mb_y; if (s->start_mb_y) { s->mb_x = 0; ff_init_block_index(s); - memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, + memset(&s->coded_block[s->block_index[0] - s->b8_stride], 0, (1 + s->b8_stride) * sizeof(*s->coded_block)); } - for(; s->mb_y < s->end_mb_y; s->mb_y++) { + for (; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); - for(;s->mb_x < s->mb_width; s->mb_x++) { + for (;s->mb_x < s->mb_width; s->mb_x++) { DCTELEM (*block)[64] = v->block[v->cur_blk_idx]; ff_update_block_index(s); s->dsp.clear_blocks(block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_stride; - s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; + s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0; @@ -4544,7 +4648,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) if (v->fieldtx_is_raw) v->fieldtx_plane[mb_pos] = get_bits1(&v->s.gb); cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); - if( v->acpred_is_raw) + if ( v->acpred_is_raw) v->s.ac_pred = get_bits1(&v->s.gb); else v->s.ac_pred = v->acpred_plane[mb_pos]; @@ -4559,33 +4663,36 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; - for(k = 0; k < 6; k++) { + for (k = 0; k < 6; k++) { val = ((cbp >> (5 - k)) & 1); if (k < 4) { - int pred = vc1_coded_block_pred(&v->s, k, &coded_val); - val = val ^ pred; + int pred = vc1_coded_block_pred(&v->s, k, &coded_val); + val = val ^ pred; *coded_val = val; } cbp |= val << (5 - k); - v->a_avail = !s->first_slice_line || (k==2 || k==3); - v->c_avail = !!s->mb_x || (k==1 || k==3); + v->a_avail = !s->first_slice_line || (k == 2 || k == 3); + v->c_avail = !!s->mb_x || (k == 1 || k == 3); - vc1_decode_i_block_adv(v, block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); + vc1_decode_i_block_adv(v, block[k], k, val, + (k < 4) ? v->codingset : v->codingset2, mquant); - if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) + continue; v->vc1dsp.vc1_inv_trans_8x8(block[k]); } vc1_smooth_overlap_filter_iblk(v); vc1_put_signed_blocks_clamped(v); - if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); + if (v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); - if(get_bits_count(&s->gb) > v->bits) { + if (get_bits_count(&s->gb) > v->bits) { // TODO: may need modification to handle slice coding ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); - av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); + av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", + get_bits_count(&s->gb), v->bits); return; } } @@ -4599,14 +4706,16 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) /* raw bottom MB row */ s->mb_x = 0; ff_init_block_index(s); - for(;s->mb_x < s->mb_width; s->mb_x++) { + for (;s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_put_signed_blocks_clamped(v); - if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); + if (v->s.loop_filter) + vc1_loop_filter_iblk_delayed(v, v->pq); } if (v->s.loop_filter) ff_draw_horiz_band(s, (s->end_mb_y-1)*16, 16); - ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END)); + ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, + (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END)); } static void vc1_decode_p_blocks(VC1Context *v) @@ -4615,7 +4724,7 @@ static void vc1_decode_p_blocks(VC1Context *v) int apply_loop_filter; /* select codingmode used for VLC tables selection */ - switch(v->c_ac_table_index){ + switch (v->c_ac_table_index) { case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; @@ -4627,7 +4736,7 @@ static void vc1_decode_p_blocks(VC1Context *v) break; } - switch(v->c_ac_table_index){ + switch (v->c_ac_table_index) { case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; @@ -4639,13 +4748,13 @@ static void vc1_decode_p_blocks(VC1Context *v) break; } - apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); + apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); s->first_slice_line = 1; memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride); - for(s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { + for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); - for(; s->mb_x < s->mb_width; s->mb_x++) { + for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); if (v->fcm == 2) @@ -4655,18 +4764,19 @@ static void vc1_decode_p_blocks(VC1Context *v) else vc1_decode_p_mb(v); if (s->mb_y != s->start_mb_y && apply_loop_filter && v->fcm == 0) vc1_apply_p_loop_filter(v); - if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { + if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { // TODO: may need modification to handle slice coding ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); - av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); + av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", + get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); return; } } - memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0])*s->mb_stride); - memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0])*s->mb_stride); - memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); - memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0])*s->mb_stride); - if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); + memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0]) * s->mb_stride); + memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0]) * s->mb_stride); + memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); + memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0]) * s->mb_stride); + if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16); s->first_slice_line = 0; } if (apply_loop_filter) { @@ -4678,8 +4788,9 @@ static void vc1_decode_p_blocks(VC1Context *v) } } if (s->end_mb_y >= s->start_mb_y) - ff_draw_horiz_band(s, (s->end_mb_y-1) * 16, 16); - ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END)); + ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); + ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, + (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END)); } static void vc1_decode_b_blocks(VC1Context *v) @@ -4687,7 +4798,7 @@ static void vc1_decode_b_blocks(VC1Context *v) MpegEncContext *s = &v->s; /* select codingmode used for VLC tables selection */ - switch(v->c_ac_table_index){ + switch (v->c_ac_table_index) { case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; @@ -4699,7 +4810,7 @@ static void vc1_decode_b_blocks(VC1Context *v) break; } - switch(v->c_ac_table_index){ + switch (v->c_ac_table_index) { case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; @@ -4712,33 +4823,35 @@ static void vc1_decode_b_blocks(VC1Context *v) } s->first_slice_line = 1; - for(s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { + for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); - for(; s->mb_x < s->mb_width; s->mb_x++) { + for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); if (v->fcm == 2) vc1_decode_b_mb_intfi(v); else vc1_decode_b_mb(v); - if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { + if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { // TODO: may need modification to handle slice coding ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); - av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); + av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", + get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); return; } - if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); + if (v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); } if (!v->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); else if (s->mb_y) - ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); + ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16); s->first_slice_line = 0; } if (v->s.loop_filter) - ff_draw_horiz_band(s, (s->end_mb_y-1)*16, 16); - ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END)); + ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); + ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, + (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END)); } static void vc1_decode_skip_blocks(VC1Context *v) @@ -4747,7 +4860,7 @@ static void vc1_decode_skip_blocks(VC1Context *v) ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); s->first_slice_line = 1; - for(s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { + for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); ff_update_block_index(s); @@ -4764,33 +4877,33 @@ static void vc1_decode_blocks(VC1Context *v) { v->s.esc3_level_length = 0; - if(v->x8_type){ - ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) ); - }else{ - v->cur_blk_idx = 0; - v->left_blk_idx = -1; - v->topleft_blk_idx = 1; - v->top_blk_idx = 2; - switch(v->s.pict_type) { + if (v->x8_type) { + ff_intrax8_decode_picture(&v->x8, 2*v->pq + v->halfpq, v->pq * !v->pquantizer); + } else { + v->cur_blk_idx = 0; + v->left_blk_idx = -1; + v->topleft_blk_idx = 1; + v->top_blk_idx = 2; + switch (v->s.pict_type) { case AV_PICTURE_TYPE_I: - if(v->profile == PROFILE_ADVANCED) + if (v->profile == PROFILE_ADVANCED) vc1_decode_i_blocks_adv(v); else vc1_decode_i_blocks(v); break; case AV_PICTURE_TYPE_P: - if(v->p_frame_skipped) + if (v->p_frame_skipped) vc1_decode_skip_blocks(v); else vc1_decode_p_blocks(v); break; case AV_PICTURE_TYPE_B: - if(v->bi_type){ - if(v->profile == PROFILE_ADVANCED) + if (v->bi_type) { + if (v->profile == PROFILE_ADVANCED) vc1_decode_i_blocks_adv(v); else vc1_decode_i_blocks(v); - }else + } else vc1_decode_b_blocks(v); break; } @@ -4820,7 +4933,7 @@ typedef struct { static inline int get_fp_val(GetBitContext* gb) { - return (get_bits_long(gb, 30) - (1<<29)) << 1; + return (get_bits_long(gb, 30) - (1 << 29)) << 1; } static void vc1_sprite_parse_transform(GetBitContext* gb, int c[7]) @@ -4829,9 +4942,9 @@ static void vc1_sprite_parse_transform(GetBitContext* gb, int c[7]) switch (get_bits(gb, 2)) { case 0: - c[0] = 1<<16; + c[0] = 1 << 16; c[2] = get_fp_val(gb); - c[4] = 1<<16; + c[4] = 1 << 16; break; case 1: c[0] = c[4] = get_fp_val(gb); @@ -4854,7 +4967,7 @@ static void vc1_sprite_parse_transform(GetBitContext* gb, int c[7]) if (get_bits1(gb)) c[6] = get_fp_val(gb); else - c[6] = 1<<16; + c[6] = 1 << 16; } static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd) @@ -4870,7 +4983,7 @@ static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd) for (i = 0; i < 7; i++) av_log(avctx, AV_LOG_DEBUG, " %d.%.3d", sd->coefs[sprite][i] / (1<<16), - (abs(sd->coefs[sprite][i]) & 0xFFFF) * 1000 / (1<<16)); + (abs(sd->coefs[sprite][i]) & 0xFFFF) * 1000 / (1 << 16)); av_log(avctx, AV_LOG_DEBUG, "\n"); } @@ -4893,8 +5006,8 @@ static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd) av_log(avctx, AV_LOG_DEBUG, "Effect: %d; params: ", sd->effect_type); for (i = 0; i < sd->effect_pcount1; i++) av_log(avctx, AV_LOG_DEBUG, " %d.%.2d", - sd->effect_params1[i] / (1<<16), - (abs(sd->effect_params1[i]) & 0xFFFF) * 1000 / (1<<16)); + sd->effect_params1[i] / (1 << 16), + (abs(sd->effect_params1[i]) & 0xFFFF) * 1000 / (1 << 16)); av_log(avctx, AV_LOG_DEBUG, "\n"); } @@ -4905,11 +5018,11 @@ static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd) } else if (sd->effect_pcount2) { i = -1; av_log(avctx, AV_LOG_DEBUG, "Effect params 2: "); - while (++i < sd->effect_pcount2){ + while (++i < sd->effect_pcount2) { sd->effect_params2[i] = get_fp_val(gb); av_log(avctx, AV_LOG_DEBUG, " %d.%.2d", - sd->effect_params2[i] / (1<<16), - (abs(sd->effect_params2[i]) & 0xFFFF) * 1000 / (1<<16)); + sd->effect_params2[i] / (1 << 16), + (abs(sd->effect_params2[i]) & 0xFFFF) * 1000 / (1 << 16)); } av_log(avctx, AV_LOG_DEBUG, "\n"); } @@ -4936,11 +5049,11 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) for (i = 0; i < 2; i++) { xoff[i] = av_clip(sd->coefs[i][2], 0, v->sprite_width-1 << 16); xadv[i] = sd->coefs[i][0]; - if (xadv[i] != 1<<16 || (v->sprite_width<<16) - (v->output_width<<16) - xoff[i]) + if (xadv[i] != 1<<16 || (v->sprite_width << 16) - (v->output_width << 16) - xoff[i]) xadv[i] = av_clip(xadv[i], 0, ((v->sprite_width<<16) - xoff[i] - 1) / v->output_width); yoff[i] = av_clip(sd->coefs[i][5], 0, v->sprite_height-1 << 16); - yadv[i] = av_clip(sd->coefs[i][4], 0, ((v->sprite_height<<16) - yoff[i]) / v->output_height); + yadv[i] = av_clip(sd->coefs[i][4], 0, ((v->sprite_height << 16) - yoff[i]) / v->output_height); } alpha = av_clip(sd->coefs[1][6], 0, (1<<16) - 1); @@ -4954,29 +5067,29 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) for (sprite = 0; sprite <= v->two_sprites; sprite++) { uint8_t *iplane = s->current_picture.f.data[plane]; int iline = s->current_picture.f.linesize[plane]; - int ycoord = yoff[sprite] + yadv[sprite]*row; - int yline = ycoord>>16; - ysub[sprite] = ycoord&0xFFFF; + int ycoord = yoff[sprite] + yadv[sprite] * row; + int yline = ycoord >> 16; + ysub[sprite] = ycoord & 0xFFFF; if (sprite) { iplane = s->last_picture.f.data[plane]; iline = s->last_picture.f.linesize[plane]; } - if (!(xoff[sprite]&0xFFFF) && xadv[sprite] == 1<<16) { - src_h[sprite][0] = iplane+(xoff[sprite]>>16)+ yline *iline; + if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) { + src_h[sprite][0] = iplane + (xoff[sprite] >> 16) + yline * iline; if (ysub[sprite]) - src_h[sprite][1] = iplane+(xoff[sprite]>>16)+(yline+1)*iline; + src_h[sprite][1] = iplane + (xoff[sprite] >> 16) + (yline + 1) * iline; } else { if (sr_cache[sprite][0] != yline) { if (sr_cache[sprite][1] == yline) { FFSWAP(uint8_t*, v->sr_rows[sprite][0], v->sr_rows[sprite][1]); FFSWAP(int, sr_cache[sprite][0], sr_cache[sprite][1]); } else { - v->vc1dsp.sprite_h(v->sr_rows[sprite][0], iplane+yline*iline, xoff[sprite], xadv[sprite], width); + v->vc1dsp.sprite_h(v->sr_rows[sprite][0], iplane + yline * iline, xoff[sprite], xadv[sprite], width); sr_cache[sprite][0] = yline; } } if (ysub[sprite] && sr_cache[sprite][1] != yline + 1) { - v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane+(yline+1)*iline, xoff[sprite], xadv[sprite], width); + v->vc1dsp.sprite_h(v->sr_rows[sprite][1], iplane + (yline + 1) * iline, xoff[sprite], xadv[sprite], width); sr_cache[sprite][1] = yline + 1; } src_h[sprite][0] = v->sr_rows[sprite][0]; @@ -5019,7 +5132,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) { - MpegEncContext *s = &v->s; + MpegEncContext *s = &v->s; AVCodecContext *avctx = s->avctx; SpriteData sd; @@ -5052,7 +5165,7 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) static void vc1_sprite_flush(AVCodecContext *avctx) { - VC1Context *v = avctx->priv_data; + VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *f = &s->current_picture.f; int plane, i; @@ -5064,7 +5177,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx) if (f->data[0]) for (plane = 0; plane < (s->flags&CODEC_FLAG_GRAY ? 1 : 3); plane++) for (i = 0; i < v->sprite_height>>!!plane; i++) - memset(f->data[plane]+i*f->linesize[plane], + memset(f->data[plane] + i * f->linesize[plane], plane ? 128 : 0, f->linesize[plane]); } @@ -5076,46 +5189,45 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v) int i; /* Allocate mb bitplanes */ - v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height); - v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height); - v->forward_mb_plane = av_malloc(s->mb_stride * s->mb_height); - v->fieldtx_plane = av_mallocz(s->mb_stride * s->mb_height); - v->acpred_plane = av_malloc(s->mb_stride * s->mb_height); - v->over_flags_plane = av_malloc(s->mb_stride * s->mb_height); + v->mv_type_mb_plane = av_malloc (s->mb_stride * s->mb_height); + v->direct_mb_plane = av_malloc (s->mb_stride * s->mb_height); + v->forward_mb_plane = av_malloc (s->mb_stride * s->mb_height); + v->fieldtx_plane = av_mallocz(s->mb_stride * s->mb_height); + v->acpred_plane = av_malloc (s->mb_stride * s->mb_height); + v->over_flags_plane = av_malloc (s->mb_stride * s->mb_height); v->n_allocated_blks = s->mb_width + 2; - v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); - v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); - v->cbp = v->cbp_base + s->mb_stride; - v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); - v->ttblk = v->ttblk_base + s->mb_stride; - v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride); - v->is_intra = v->is_intra_base + s->mb_stride; - v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride); - v->luma_mv = v->luma_mv_base + s->mb_stride; + v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); + v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); + v->cbp = v->cbp_base + s->mb_stride; + v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); + v->ttblk = v->ttblk_base + s->mb_stride; + v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride); + v->is_intra = v->is_intra_base + s->mb_stride; + v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride); + v->luma_mv = v->luma_mv_base + s->mb_stride; /* allocate block type info in that way so it could be used with s->block_index[] */ v->mb_type_base = av_malloc(s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); - v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; - v->mb_type[1] = v->mb_type_base + s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride + 1; - v->mb_type[2] = v->mb_type[1] + s->mb_stride * (s->mb_height + 1); + v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; + v->mb_type[1] = v->mb_type_base + s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride + 1; + v->mb_type[2] = v->mb_type[1] + s->mb_stride * (s->mb_height + 1); /* allocate memory to store block level MV info */ - v->blk_mv_type_base = av_mallocz(s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); - v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1; - v->mv_f_base = av_mallocz(2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); - v->mv_f[0] = v->mv_f_base + s->b8_stride + 1; - v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); - v->mv_f_last_base = av_mallocz(2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); - v->mv_f_last[0] = v->mv_f_last_base + s->b8_stride + 1; - v->mv_f_last[1] = v->mv_f_last[0] + (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); - v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); - v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1; - v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); + v->blk_mv_type_base = av_mallocz( s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); + v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1; + v->mv_f_base = av_mallocz(2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); + v->mv_f[0] = v->mv_f_base + s->b8_stride + 1; + v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); + v->mv_f_last_base = av_mallocz(2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); + v->mv_f_last[0] = v->mv_f_last_base + s->b8_stride + 1; + v->mv_f_last[1] = v->mv_f_last[0] + (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); + v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); + v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1; + v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2); /* Init coded blocks info */ - if (v->profile == PROFILE_ADVANCED) - { + if (v->profile == PROFILE_ADVANCED) { // if (alloc_bitplane(&v->over_flags_plane, s->mb_width, s->mb_height) < 0) // return -1; // if (alloc_bitplane(&v->ac_pred_plane, s->mb_width, s->mb_height) < 0) @@ -5126,7 +5238,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v) if (s->avctx->codec_id == CODEC_ID_WMV3IMAGE || s->avctx->codec_id == CODEC_ID_VC1IMAGE) { for (i = 0; i < 4; i++) - if (!(v->sr_rows[i>>1][i%2] = av_malloc(v->output_width))) return -1; + if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) return -1; } if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane || @@ -5152,7 +5264,8 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) v->output_width = avctx->width; v->output_height = avctx->height; - if (!avctx->extradata_size || !avctx->extradata) return -1; + if (!avctx->extradata_size || !avctx->extradata) + return -1; if (!(avctx->flags & CODEC_FLAG_GRAY)) avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts); else @@ -5160,17 +5273,17 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); v->s.avctx = avctx; avctx->flags |= CODEC_FLAG_EMU_EDGE; - v->s.flags |= CODEC_FLAG_EMU_EDGE; + v->s.flags |= CODEC_FLAG_EMU_EDGE; - if(avctx->idct_algo==FF_IDCT_AUTO){ - avctx->idct_algo=FF_IDCT_WMV2; + if (avctx->idct_algo == FF_IDCT_AUTO) { + avctx->idct_algo = FF_IDCT_WMV2; } - if (vc1_init_common(v) < 0) return -1; + if (vc1_init_common(v) < 0) + return -1; ff_vc1dsp_init(&v->vc1dsp); - if (avctx->codec_id == CODEC_ID_WMV3 || avctx->codec_id == CODEC_ID_WMV3IMAGE) - { + if (avctx->codec_id == CODEC_ID_WMV3 || avctx->codec_id == CODEC_ID_WMV3IMAGE) { int count = 0; // looks like WMV3 has a sequence header stored in the extradata @@ -5184,13 +5297,10 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) return -1; count = avctx->extradata_size*8 - get_bits_count(&gb); - if (count>0) - { + if (count > 0) { av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n", count, get_bits(&gb, count)); - } - else if (count < 0) - { + } else if (count < 0) { av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count); } } else { // VC1/WVC1/WVP2 @@ -5201,30 +5311,31 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) uint8_t *buf2 = NULL; int seq_initialized = 0, ep_initialized = 0; - if(avctx->extradata_size < 16) { + if (avctx->extradata_size < 16) { av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size); return -1; } - buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv - next = start; - for(; next < end; start = next){ + next = start; + for (; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; - if(size <= 0) continue; + if (size <= 0) + continue; buf2_size = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&gb, buf2, buf2_size * 8); - switch(AV_RB32(start)){ + switch (AV_RB32(start)) { case VC1_CODE_SEQHDR: - if(vc1_decode_sequence_header(avctx, v, &gb) < 0){ + if (vc1_decode_sequence_header(avctx, v, &gb) < 0) { av_free(buf2); return -1; } seq_initialized = 1; break; case VC1_CODE_ENTRYPOINT: - if(vc1_decode_entry_point(avctx, v, &gb) < 0){ + if (vc1_decode_entry_point(avctx, v, &gb) < 0) { av_free(buf2); return -1; } @@ -5233,7 +5344,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) } } av_free(buf2); - if(!seq_initialized || !ep_initialized){ + if (!seq_initialized || !ep_initialized) { av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n"); return -1; } @@ -5244,14 +5355,14 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) if (v->profile == PROFILE_ADVANCED) avctx->level = v->level; - avctx->has_b_frames= !!(avctx->max_b_frames); + avctx->has_b_frames = !!(avctx->max_b_frames); - s->mb_width = (avctx->coded_width+15)>>4; - s->mb_height = (avctx->coded_height+15)>>4; + s->mb_width = (avctx->coded_width + 15) >> 4; + s->mb_height = (avctx->coded_height + 15) >> 4; if (v->profile == PROFILE_ADVANCED || v->res_fasttx) { - for (i = 0; i < 64; i++) { -#define transpose(x) ((x>>3) | ((x&7)<<3)) + for (i = 0; i < 64; i++) { +#define transpose(x) ((x >> 3) | ((x & 7) << 3)) v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); @@ -5274,10 +5385,10 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) avctx->coded_height = avctx->height = v->output_height; // prevent 16.16 overflows - if (v->sprite_width > 1<<14 || - v->sprite_height > 1<<14 || - v->output_width > 1<<14 || - v->output_height > 1<<14) return -1; + if (v->sprite_width > 1 << 14 || + v->sprite_height > 1 << 14 || + v->output_width > 1 << 14 || + v->output_height > 1 << 14) return -1; } return 0; } @@ -5294,7 +5405,7 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx) && v->sprite_output_frame.data[0]) avctx->release_buffer(avctx, &v->sprite_output_frame); for (i = 0; i < 4; i++) - av_freep(&v->sr_rows[i>>1][i%2]); + av_freep(&v->sr_rows[i >> 1][i & 1]); av_freep(&v->hrd_rate); av_freep(&v->hrd_buffer); MPV_common_end(&v->s); @@ -5322,9 +5433,8 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx) /** Decode a VC1/WMV3 frame * @todo TODO: Handle VC-1 IDUs (Transport level?) */ -static int vc1_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, - AVPacket *avpkt) +static int vc1_decode_frame(AVCodecContext *avctx, void *data, + int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i; @@ -5344,9 +5454,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, /* no supplementary picture */ if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { /* special case for last picture */ - if (s->low_delay==0 && s->next_picture_ptr) { - *pict= *(AVFrame*)s->next_picture_ptr; - s->next_picture_ptr= NULL; + if (s->low_delay == 0 && s->next_picture_ptr) { + *pict = *(AVFrame*)s->next_picture_ptr; + s->next_picture_ptr = NULL; *data_size = sizeof(AVFrame); } @@ -5354,7 +5464,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, return 0; } - if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){ + if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { if (v->profile < PROFILE_ADVANCED) avctx->pix_fmt = PIX_FMT_VDPAU_WMV3; else @@ -5366,16 +5476,16 @@ static int vc1_decode_frame(AVCodecContext *avctx, int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); - if(IS_MARKER(AV_RB32(buf))){ /* frame starts with marker and needs to be parsed */ + if (IS_MARKER(AV_RB32(buf))) { /* frame starts with marker and needs to be parsed */ const uint8_t *start, *end, *next; int size; next = buf; - for(start = buf, end = buf + buf_size; next < end; start = next){ + for (start = buf, end = buf + buf_size; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; - if(size <= 0) continue; - switch(AV_RB32(start)){ + if (size <= 0) continue; + switch (AV_RB32(start)) { case VC1_CODE_FRAME: if (avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) @@ -5385,9 +5495,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, case VC1_CODE_FIELD: { int buf_size3; slices = av_realloc(slices, sizeof(*slices) * (n_slices+1)); - if (!slices) goto err; + if (!slices) + goto err; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!slices[n_slices].buf) goto err; + if (!slices[n_slices].buf) + goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, @@ -5404,15 +5516,17 @@ static int vc1_decode_frame(AVCodecContext *avctx, } case VC1_CODE_ENTRYPOINT: /* it should be before frame data */ buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); - init_get_bits(&s->gb, buf2, buf_size2*8); + init_get_bits(&s->gb, buf2, buf_size2 * 8); vc1_decode_entry_point(avctx, v, &s->gb); break; case VC1_CODE_SLICE: { int buf_size3; slices = av_realloc(slices, sizeof(*slices) * (n_slices+1)); - if (!slices) goto err; + if (!slices) + goto err; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!slices[n_slices].buf) goto err; + if (!slices[n_slices].buf) + goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, @@ -5423,11 +5537,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, } } } - }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */ + } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { /* WVC1 interlaced stores both fields divided by marker */ const uint8_t *divider; divider = find_next_marker(buf, buf + buf_size); - if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){ + if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) { av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); goto err; } else { // found field marker, unescape second field @@ -5435,7 +5549,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, buf_field2); } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); - }else{ + } else { buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); @@ -5443,8 +5557,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, init_get_bits(&s->gb, buf, buf_size*8); if (v->res_sprite) { - v->new_sprite = !get_bits1(&s->gb); - v->two_sprites = get_bits1(&s->gb); + v->new_sprite = !get_bits1(&s->gb); + v->two_sprites = get_bits1(&s->gb); /* res_sprite means a Windows Media Image stream, CODEC_ID_*IMAGE means we're using the sprite compositor. These are intentionally kept separate so you can get the raw sprites by using the wmv3 decoder for WMVP or @@ -5481,24 +5595,24 @@ static int vc1_decode_frame(AVCodecContext *avctx, /* We need to set current_picture_ptr before reading the header, * otherwise we cannot store anything in there. */ if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) { - int i= ff_find_unused_picture(s, 0); - s->current_picture_ptr= &s->picture[i]; + int i = ff_find_unused_picture(s, 0); + s->current_picture_ptr = &s->picture[i]; } // do parse frame header v->pic_header_flag = 0; - if(v->profile < PROFILE_ADVANCED) { - if(vc1_parse_frame_header(v, &s->gb) == -1) { + if (v->profile < PROFILE_ADVANCED) { + if (vc1_parse_frame_header(v, &s->gb) == -1) { goto err; } } else { - if(vc1_parse_frame_header_adv(v, &s->gb) == -1) { + if (vc1_parse_frame_header_adv(v, &s->gb) == -1) { goto err; } } if ((avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) - && s->pict_type!=AV_PICTURE_TYPE_I) { + && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); goto err; } @@ -5507,10 +5621,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->current_picture_ptr->f.repeat_pict = 0; // Pulldown flags are only valid when 'broadcast' has been set. // So ticks_per_frame will be 2 - if (v->rff){ + if (v->rff) { // repeat field s->current_picture_ptr->f.repeat_pict = 1; - }else if (v->rptfrm){ + } else if (v->rptfrm) { // repeat frames s->current_picture_ptr->f.repeat_pict = v->rptfrm * 2; } @@ -5520,28 +5634,28 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ - if(s->last_picture_ptr==NULL && (s->pict_type==AV_PICTURE_TYPE_B || s->dropable)){ + if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->dropable)) { goto err; } - if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==AV_PICTURE_TYPE_B) - || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=AV_PICTURE_TYPE_I) - || avctx->skip_frame >= AVDISCARD_ALL) { + if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || + (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || + avctx->skip_frame >= AVDISCARD_ALL) { goto end; } - if(s->next_p_frame_damaged){ - if(s->pict_type==AV_PICTURE_TYPE_B) + if (s->next_p_frame_damaged) { + if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else - s->next_p_frame_damaged=0; + s->next_p_frame_damaged = 0; } - if(MPV_frame_start(s, avctx) < 0) { + if (MPV_frame_start(s, avctx) < 0) { goto err; } - s->me.qpel_put= s->dsp.put_qpel_pixels_tab; - s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; + s->me.qpel_put = s->dsp.put_qpel_pixels_tab; + s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; if ((CONFIG_VC1_VDPAU_DECODER) &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) @@ -5562,10 +5676,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->current_picture.f.linesize[0] <<= 1; s->current_picture.f.linesize[1] <<= 1; s->current_picture.f.linesize[2] <<= 1; - s->linesize <<= 1; - s->uvlinesize <<= 1; - tmp[0] = v->mv_f_last[0]; - tmp[1] = v->mv_f_last[1]; + s->linesize <<= 1; + s->uvlinesize <<= 1; + tmp[0] = v->mv_f_last[0]; + tmp[1] = v->mv_f_last[1]; v->mv_f_last[0] = v->mv_f_next[0]; v->mv_f_last[1] = v->mv_f_next[1]; v->mv_f_next[0] = v->mv_f[0]; @@ -5577,7 +5691,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, for (i = 0; i <= n_slices; i++) { if (i > 0 && slices[i - 1].mby_start >= mb_height) { v->second_field = 1; - v->blocks_off = s->mb_width * s->mb_height << 1; + v->blocks_off = s->mb_width * s->mb_height << 1; v->mb_off = s->mb_stride * s->mb_height >> 1; } else { v->second_field = 0; @@ -5606,7 +5720,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, av_free(buf_field2); v->second_field = 0; } - if(v->field_mode){ + if (v->field_mode) { if (s->pict_type == AV_PICTURE_TYPE_B) { memcpy(v->mv_f_base, v->mv_f_next_base, 2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); @@ -5614,11 +5728,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->current_picture.f.linesize[0] >>= 1; s->current_picture.f.linesize[1] >>= 1; s->current_picture.f.linesize[2] >>= 1; - s->linesize >>= 1; - s->uvlinesize >>= 1; + s->linesize >>= 1; + s->uvlinesize >>= 1; } //av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); -// if(get_bits_count(&s->gb) > buf_size * 8) +// if (get_bits_count(&s->gb) > buf_size * 8) // return -1; ff_er_frame_end(s); } @@ -5629,25 +5743,24 @@ static int vc1_decode_frame(AVCodecContext *avctx, image: avctx->width = avctx->coded_width = v->output_width; avctx->height = avctx->coded_height = v->output_height; - if (avctx->skip_frame >= AVDISCARD_NONREF) goto end; + if (avctx->skip_frame >= AVDISCARD_NONREF) + goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER - if (vc1_decode_sprites(v, &s->gb)) goto err; + if (vc1_decode_sprites(v, &s->gb)) + goto err; #endif - *pict = v->sprite_output_frame; + *pict = v->sprite_output_frame; *data_size = sizeof(AVFrame); } else { - - if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { - *pict= *(AVFrame*)s->current_picture_ptr; - } else if (s->last_picture_ptr != NULL) { - *pict= *(AVFrame*)s->last_picture_ptr; - } - - if(s->last_picture_ptr || s->low_delay){ - *data_size = sizeof(AVFrame); - ff_print_debug_info(s, pict); - } - + if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { + *pict = *(AVFrame*)s->current_picture_ptr; + } else if (s->last_picture_ptr != NULL) { + *pict = *(AVFrame*)s->last_picture_ptr; + } + if (s->last_picture_ptr || s->low_delay) { + *data_size = sizeof(AVFrame); + ff_print_debug_info(s, pict); + } } end: @@ -5684,9 +5797,9 @@ AVCodec ff_vc1_decoder = { .close = vc1_decode_end, .decode = vc1_decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY, - .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), - .pix_fmts = ff_hwaccel_pixfmt_list_420, - .profiles = NULL_IF_CONFIG_SMALL(profiles) + .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), + .pix_fmts = ff_hwaccel_pixfmt_list_420, + .profiles = NULL_IF_CONFIG_SMALL(profiles) }; #if CONFIG_WMV3_DECODER @@ -5699,9 +5812,9 @@ AVCodec ff_wmv3_decoder = { .close = vc1_decode_end, .decode = vc1_decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY, - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), - .pix_fmts = ff_hwaccel_pixfmt_list_420, - .profiles = NULL_IF_CONFIG_SMALL(profiles) + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), + .pix_fmts = ff_hwaccel_pixfmt_list_420, + .profiles = NULL_IF_CONFIG_SMALL(profiles) }; #endif @@ -5715,9 +5828,9 @@ AVCodec ff_wmv3_vdpau_decoder = { .close = vc1_decode_end, .decode = vc1_decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU, - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"), - .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE}, - .profiles = NULL_IF_CONFIG_SMALL(profiles) + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"), + .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE}, + .profiles = NULL_IF_CONFIG_SMALL(profiles) }; #endif @@ -5731,9 +5844,9 @@ AVCodec ff_vc1_vdpau_decoder = { .close = vc1_decode_end, .decode = vc1_decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU, - .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"), - .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE}, - .profiles = NULL_IF_CONFIG_SMALL(profiles) + .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"), + .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE}, + .profiles = NULL_IF_CONFIG_SMALL(profiles) }; #endif diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index ac3840acbc..8fe82d9398 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -132,8 +132,8 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) } static const AVOption options[] = { - { "sample_rate", "", offsetof(AlsaData, sample_rate), FF_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "channels", "", offsetof(AlsaData, channels), FF_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "", offsetof(AlsaData, channels), AV_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index 3de3c8b653..b16adc9f6e 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -325,15 +325,15 @@ static int grab_read_close(AVFormatContext *s1) #define OFFSET(x) offsetof(VideoData, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "standard", "", offsetof(VideoData, standard), FF_OPT_TYPE_INT, {.dbl = VIDEO_FORMAT}, PAL, NTSCJ, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "PAL", "", 0, FF_OPT_TYPE_CONST, {.dbl = PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "NTSC", "", 0, FF_OPT_TYPE_CONST, {.dbl = NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "SECAM", "", 0, FF_OPT_TYPE_CONST, {.dbl = SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "PALN", "", 0, FF_OPT_TYPE_CONST, {.dbl = PALN}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "PALM", "", 0, FF_OPT_TYPE_CONST, {.dbl = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "NTSCJ", "", 0, FF_OPT_TYPE_CONST, {.dbl = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "standard", "", offsetof(VideoData, standard), AV_OPT_TYPE_INT, {.dbl = VIDEO_FORMAT}, PAL, NTSCJ, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "PAL", "", 0, AV_OPT_TYPE_CONST, {.dbl = PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "NTSC", "", 0, AV_OPT_TYPE_CONST, {.dbl = NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "SECAM", "", 0, AV_OPT_TYPE_CONST, {.dbl = SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "PALN", "", 0, AV_OPT_TYPE_CONST, {.dbl = PALN}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "PALM", "", 0, AV_OPT_TYPE_CONST, {.dbl = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "NTSCJ", "", 0, AV_OPT_TYPE_CONST, {.dbl = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, { NULL }, }; diff --git a/libavdevice/dv1394.c b/libavdevice/dv1394.c index 779117aee3..951445f813 100644 --- a/libavdevice/dv1394.c +++ b/libavdevice/dv1394.c @@ -214,10 +214,10 @@ static int dv1394_close(AVFormatContext * context) } static const AVOption options[] = { - { "standard", "", offsetof(struct dv1394_data, format), FF_OPT_TYPE_INT, {.dbl = DV1394_NTSC}, DV1394_PAL, DV1394_NTSC, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "PAL", "", 0, FF_OPT_TYPE_CONST, {.dbl = DV1394_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "NTSC", "", 0, FF_OPT_TYPE_CONST, {.dbl = DV1394_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "channel", "", offsetof(struct dv1394_data, channel), FF_OPT_TYPE_INT, {.dbl = DV1394_DEFAULT_CHANNEL}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "standard", "", offsetof(struct dv1394_data, format), AV_OPT_TYPE_INT, {.dbl = DV1394_NTSC}, DV1394_PAL, DV1394_NTSC, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "PAL", "", 0, AV_OPT_TYPE_CONST, {.dbl = DV1394_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "NTSC", "", 0, AV_OPT_TYPE_CONST, {.dbl = DV1394_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "channel", "", offsetof(struct dv1394_data, channel), AV_OPT_TYPE_INT, {.dbl = DV1394_DEFAULT_CHANNEL}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c index 0b720056a6..20c2ab8019 100644 --- a/libavdevice/fbdev.c +++ b/libavdevice/fbdev.c @@ -247,7 +247,7 @@ av_cold static int fbdev_read_close(AVFormatContext *avctx) #define OFFSET(x) offsetof(FBDevContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "framerate","", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, + { "framerate","", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, { NULL }, }; diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index 9a6b4865bd..ac84786b7a 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -314,7 +314,7 @@ static int audio_read_close(AVFormatContext *context) #define OFFSET(x) offsetof(JackData, x) static const AVOption options[] = { - { "channels", "Number of audio channels.", OFFSET(nports), FF_OPT_TYPE_INT, { 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "Number of audio channels.", OFFSET(nports), AV_OPT_TYPE_INT, { 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c index 7218788320..385e295d3b 100644 --- a/libavdevice/libcdio.c +++ b/libavdevice/libcdio.c @@ -160,11 +160,11 @@ static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, #define OFFSET(x) offsetof(CDIOContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "speed", "Drive reading speed.", OFFSET(speed), FF_OPT_TYPE_INT, { 0 }, 0, INT_MAX, DEC }, - { "paranoia_mode", "Error recovery mode.", OFFSET(paranoia_mode), FF_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" }, - { "verify", "Verify data integrity in overlap area", 0, FF_OPT_TYPE_CONST, { PARANOIA_MODE_VERIFY }, 0, 0, DEC, "paranoia_mode" }, - { "overlap", "Perform overlapped reads.", 0, FF_OPT_TYPE_CONST, { PARANOIA_MODE_OVERLAP }, 0, 0, DEC, "paranoia_mode" }, - { "neverskip", "Do not skip failed reads.", 0, FF_OPT_TYPE_CONST, { PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" }, + { "speed", "Drive reading speed.", OFFSET(speed), AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, DEC }, + { "paranoia_mode", "Error recovery mode.", OFFSET(paranoia_mode), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" }, + { "verify", "Verify data integrity in overlap area", 0, AV_OPT_TYPE_CONST, { PARANOIA_MODE_VERIFY }, 0, 0, DEC, "paranoia_mode" }, + { "overlap", "Perform overlapped reads.", 0, AV_OPT_TYPE_CONST, { PARANOIA_MODE_OVERLAP }, 0, 0, DEC, "paranoia_mode" }, + { "neverskip", "Do not skip failed reads.", 0, AV_OPT_TYPE_CONST, { PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" }, { NULL }, }; diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index dffb06ca1a..684047e0cb 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -85,9 +85,9 @@ struct dc1394_frame_rate { #define OFFSET(x) offsetof(dc1394_data, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC }, - { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "uyvy422"}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC }, + { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = "uyvy422"}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC }, { NULL }, }; @@ -154,7 +154,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap) goto out; } } - + /* Choose the best mode. */ rate = (ap->time_base.num ? av_rescale(1000, ap->time_base.den, ap->time_base.num) : -1); max_score = -1; diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index ab666e8703..56b85e1384 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -282,8 +282,8 @@ static int audio_read_close(AVFormatContext *s1) #if CONFIG_OSS_INDEV static const AVOption options[] = { - { "sample_rate", "", offsetof(AudioData, sample_rate), FF_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "channels", "", offsetof(AudioData, channels), FF_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "sample_rate", "", offsetof(AudioData, sample_rate), AV_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "", offsetof(AudioData, channels), AV_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c index 6e386c6d99..f6417f2535 100644 --- a/libavdevice/sndio_dec.c +++ b/libavdevice/sndio_dec.c @@ -93,8 +93,8 @@ static av_cold int audio_read_close(AVFormatContext *s1) } static const AVOption options[] = { - { "sample_rate", "", offsetof(SndioData, sample_rate), FF_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "channels", "", offsetof(SndioData, channels), FF_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "sample_rate", "", offsetof(SndioData, sample_rate), AV_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "", offsetof(SndioData, channels), AV_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index f110f4439e..ec0029afcb 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -339,10 +339,10 @@ static int grab_read_close(AVFormatContext *s1) } static const AVOption options[] = { - { "standard", "", offsetof(VideoData, standard), FF_OPT_TYPE_INT, {.dbl = VIDEO_MODE_NTSC}, VIDEO_MODE_PAL, VIDEO_MODE_NTSC, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "PAL", "", 0, FF_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "SECAM", "", 0, FF_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, - { "NTSC", "", 0, FF_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "standard", "", offsetof(VideoData, standard), AV_OPT_TYPE_INT, {.dbl = VIDEO_MODE_NTSC}, VIDEO_MODE_PAL, VIDEO_MODE_NTSC, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "PAL", "", 0, AV_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "SECAM", "", 0, AV_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, + { "NTSC", "", 0, AV_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" }, { NULL }, }; diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index fef02b3ed7..e14e56c0f3 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -689,11 +689,11 @@ static int v4l2_read_close(AVFormatContext *s1) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "standard", "", OFFSET(standard), FF_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, - { "channel", "", OFFSET(channel), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "standard", "", OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, + { "channel", "", OFFSET(channel), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, { NULL }, }; diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 53e11f306f..480282ad8f 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -458,8 +458,8 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt) #define OFFSET(x) offsetof(struct vfw_ctx, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC }, { NULL }, }; diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index 75d307543d..9125180ac0 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -581,13 +581,13 @@ x11grab_read_close(AVFormatContext *s1) #define OFFSET(x) offsetof(struct x11_grab, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC }, - { "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), FF_OPT_TYPE_INT, { 1 }, 0, 1, DEC }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC }, + { "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), AV_OPT_TYPE_INT, { 1 }, 0, 1, DEC }, { "follow_mouse", "Move the grabbing region when the mouse pointer reaches within specified amount of pixels to the edge of region.", - OFFSET(follow_mouse), FF_OPT_TYPE_INT, { 0 }, -1, INT_MAX, DEC, "follow_mouse" }, - { "centered", "Keep the mouse pointer at the center of grabbing region when following.", 0, FF_OPT_TYPE_CONST, { -1 }, INT_MIN, INT_MAX, DEC, "follow_mouse" }, - { "show_region", "Show the grabbing region.", OFFSET(show_region), FF_OPT_TYPE_INT, { 0 }, 0, 1, DEC }, + OFFSET(follow_mouse), AV_OPT_TYPE_INT, { 0 }, -1, INT_MAX, DEC, "follow_mouse" }, + { "centered", "Keep the mouse pointer at the center of grabbing region when following.", 0, AV_OPT_TYPE_CONST, { -1 }, INT_MIN, INT_MAX, DEC, "follow_mouse" }, + { "show_region", "Show the grabbing region.", OFFSET(show_region), AV_OPT_TYPE_INT, { 0 }, 0, 1, DEC }, { NULL }, }; diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index a90e738a7d..a96f3c6a75 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -67,12 +67,12 @@ typedef struct { #define OFFSET(x) offsetof(MovieContext, x) static const AVOption movie_options[]= { -{"format_name", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX }, -{"f", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX }, -{"stream_index", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX }, -{"si", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX }, -{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 }, -{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 }, +{"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX }, +{"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX }, +{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX }, +{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX }, +{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 }, +{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 }, {NULL}, }; diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 156dbbd961..a8d3517b99 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -143,39 +143,39 @@ typedef struct { #define OFFSET(x) offsetof(DrawTextContext, x) static const AVOption drawtext_options[]= { -{"fontfile", "set font file", OFFSET(fontfile), FF_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX }, -{"text", "set text", OFFSET(text), FF_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX }, -{"textfile", "set text file", OFFSET(textfile), FF_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX }, -{"fontcolor", "set foreground color", OFFSET(fontcolor_string), FF_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX }, -{"boxcolor", "set box color", OFFSET(boxcolor_string), FF_OPT_TYPE_STRING, {.str="white"}, CHAR_MIN, CHAR_MAX }, -{"shadowcolor", "set shadow color", OFFSET(shadowcolor_string), FF_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX }, -{"box", "set box", OFFSET(draw_box), FF_OPT_TYPE_INT, {.dbl=0}, 0, 1 }, -{"fontsize", "set font size", OFFSET(fontsize), FF_OPT_TYPE_INT, {.dbl=16}, 1, INT_MAX }, -{"x", "set x expression", OFFSET(x_expr), FF_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX }, -{"y", "set y expression", OFFSET(y_expr), FF_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX }, -{"shadowx", "set x", OFFSET(shadowx), FF_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, -{"shadowy", "set y", OFFSET(shadowy), FF_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, -{"tabsize", "set tab size", OFFSET(tabsize), FF_OPT_TYPE_INT, {.dbl=4}, 0, INT_MAX }, -{"basetime", "set base time", OFFSET(basetime), FF_OPT_TYPE_INT64, {.dbl=AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX }, +{"fontfile", "set font file", OFFSET(fontfile), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX }, +{"text", "set text", OFFSET(text), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX }, +{"textfile", "set text file", OFFSET(textfile), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX }, +{"fontcolor", "set foreground color", OFFSET(fontcolor_string), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX }, +{"boxcolor", "set box color", OFFSET(boxcolor_string), AV_OPT_TYPE_STRING, {.str="white"}, CHAR_MIN, CHAR_MAX }, +{"shadowcolor", "set shadow color", OFFSET(shadowcolor_string), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX }, +{"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 }, +{"fontsize", "set font size", OFFSET(fontsize), AV_OPT_TYPE_INT, {.dbl=16}, 1, INT_MAX }, +{"x", "set x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX }, +{"y", "set y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX }, +{"shadowx", "set x", OFFSET(shadowx), AV_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, +{"shadowy", "set y", OFFSET(shadowy), AV_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, +{"tabsize", "set tab size", OFFSET(tabsize), AV_OPT_TYPE_INT, {.dbl=4}, 0, INT_MAX }, +{"basetime", "set base time", OFFSET(basetime), AV_OPT_TYPE_INT64, {.dbl=AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX }, /* FT_LOAD_* flags */ -{"ft_load_flags", "set font loading flags for libfreetype", OFFSET(ft_load_flags), FF_OPT_TYPE_FLAGS, {.dbl=FT_LOAD_DEFAULT|FT_LOAD_RENDER}, 0, INT_MAX, 0, "ft_load_flags" }, -{"default", "set default", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_DEFAULT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"no_scale", "set no_scale", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_SCALE}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"no_hinting", "set no_hinting", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_HINTING}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"render", "set render", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_RENDER}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"no_bitmap", "set no_bitmap", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"vertical_layout", "set vertical_layout", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_VERTICAL_LAYOUT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"force_autohint", "set force_autohint", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_FORCE_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"crop_bitmap", "set crop_bitmap", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_CROP_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"pedantic", "set pedantic", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_PEDANTIC}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"ignore_global_advance_width", "set ignore_global_advance_width", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"no_recurse", "set no_recurse", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_RECURSE}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"ignore_transform", "set ignore_transform", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_IGNORE_TRANSFORM}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"monochrome", "set monochrome", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_MONOCHROME}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"linear_design", "set linear_design", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_LINEAR_DESIGN}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, -{"no_autohint", "set no_autohint", 0, FF_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"ft_load_flags", "set font loading flags for libfreetype", OFFSET(ft_load_flags), AV_OPT_TYPE_FLAGS, {.dbl=FT_LOAD_DEFAULT|FT_LOAD_RENDER}, 0, INT_MAX, 0, "ft_load_flags" }, +{"default", "set default", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_DEFAULT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"no_scale", "set no_scale", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_SCALE}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"no_hinting", "set no_hinting", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_HINTING}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"render", "set render", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_RENDER}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"no_bitmap", "set no_bitmap", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"vertical_layout", "set vertical_layout", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_VERTICAL_LAYOUT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"force_autohint", "set force_autohint", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_FORCE_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"crop_bitmap", "set crop_bitmap", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_CROP_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"pedantic", "set pedantic", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_PEDANTIC}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"ignore_global_advance_width", "set ignore_global_advance_width", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"no_recurse", "set no_recurse", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_RECURSE}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"ignore_transform", "set ignore_transform", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_IGNORE_TRANSFORM}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"monochrome", "set monochrome", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_MONOCHROME}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"linear_design", "set linear_design", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_LINEAR_DESIGN}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, +{"no_autohint", "set no_autohint", 0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_NO_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" }, {NULL}, }; diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index d4026daae2..eccef6a303 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -350,8 +350,8 @@ static int open_input(struct variant *var) snprintf(url, sizeof(url), "crypto:%s", seg->url); if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ)) < 0) return ret; - av_set_string3(var->input->priv_data, "key", key, 0, NULL); - av_set_string3(var->input->priv_data, "iv", iv, 0, NULL); + av_opt_set(var->input->priv_data, "key", key, 0); + av_opt_set(var->input->priv_data, "iv", iv, 0); if ((ret = ffurl_connect(var->input)) < 0) { ffurl_close(var->input); var->input = NULL; diff --git a/libavformat/crypto.c b/libavformat/crypto.c index 5e7ee1eba3..b9d3e0326f 100644 --- a/libavformat/crypto.c +++ b/libavformat/crypto.c @@ -46,8 +46,8 @@ typedef struct { #define OFFSET(x) offsetof(CryptoContext, x) static const AVOption options[] = { - {"key", "AES decryption key", OFFSET(key), FF_OPT_TYPE_BINARY }, - {"iv", "AES decryption initialization vector", OFFSET(iv), FF_OPT_TYPE_BINARY }, + {"key", "AES decryption key", OFFSET(key), AV_OPT_TYPE_BINARY }, + {"iv", "AES decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY }, { NULL } }; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 828d25fda3..7efe156666 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -276,17 +276,35 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst acodec = astream ? astream->codec : NULL; vcodec = vstream ? vstream->codec : NULL; + if (amf_type == AMF_DATA_TYPE_NUMBER) { + if (!strcmp(key, "duration")) + s->duration = num_val * AV_TIME_BASE; + else if (!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0)) + vcodec->bit_rate = num_val * 1024.0; + else if (!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0)) + acodec->bit_rate = num_val * 1024.0; + } + + if (!strcmp(key, "duration") || + !strcmp(key, "filesize") || + !strcmp(key, "width") || + !strcmp(key, "height") || + !strcmp(key, "videodatarate") || + !strcmp(key, "framerate") || + !strcmp(key, "videocodecid") || + !strcmp(key, "audiodatarate") || + !strcmp(key, "audiosamplerate") || + !strcmp(key, "audiosamplesize") || + !strcmp(key, "stereo") || + !strcmp(key, "audiocodecid")) + return 0; + if(amf_type == AMF_DATA_TYPE_BOOL) { av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val)); av_dict_set(&s->metadata, key, str_val, 0); } else if(amf_type == AMF_DATA_TYPE_NUMBER) { snprintf(str_val, sizeof(str_val), "%.f", num_val); av_dict_set(&s->metadata, key, str_val, 0); - if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; - else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0)) - vcodec->bit_rate = num_val * 1024.0; - else if(!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0)) - acodec->bit_rate = num_val * 1024.0; } else if(amf_type == AMF_DATA_TYPE_OBJECT){ if(s->nb_streams==1 && ((!acodec && !strcmp(key, "audiocodecid")) || (!vcodec && !strcmp(key, "videocodecid")))){ s->ctx_flags &= ~AVFMTCTX_NOHEADER; //If there is either audio/video missing, codecid will be an empty object diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index fe866f10c8..143c58ca50 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -180,9 +180,9 @@ static int flv_write_header(AVFormatContext *s) AVIOContext *pb = s->pb; FLVContext *flv = s->priv_data; AVCodecContext *audio_enc = NULL, *video_enc = NULL; - int i; + int i, metadata_count = 0; double framerate = 0.0; - int64_t metadata_size_pos, data_size; + int64_t metadata_size_pos, data_size, metadata_count_pos; AVDictionaryEntry *tag = NULL; for(i=0; i<s->nb_streams; i++){ @@ -240,7 +240,9 @@ static int flv_write_header(AVFormatContext *s) /* mixed array (hash) with size and string/type/data tuples */ avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); - avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size + metadata_count_pos = avio_tell(pb); + metadata_count = 5*!!video_enc + 5*!!audio_enc + 2; // +2 for duration and file size + avio_wb32(pb, metadata_count); put_amf_string(pb, "duration"); flv->duration_offset= avio_tell(pb); @@ -300,6 +302,7 @@ static int flv_write_header(AVFormatContext *s) put_amf_string(pb, tag->key); avio_w8(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, tag->value); + metadata_count++; } put_amf_string(pb, "filesize"); @@ -311,6 +314,10 @@ static int flv_write_header(AVFormatContext *s) /* write total size of tag */ data_size= avio_tell(pb) - metadata_size_pos - 10; + + avio_seek(pb, metadata_count_pos, SEEK_SET); + avio_wb32(pb, metadata_count); + avio_seek(pb, metadata_size_pos, SEEK_SET); avio_wb24(pb, data_size); avio_skip(pb, data_size + 10 - 3); diff --git a/libavformat/gif.c b/libavformat/gif.c index 280a663690..200bc70573 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -351,7 +351,7 @@ static int gif_write_trailer(AVFormatContext *s) #define OFFSET(x) offsetof(GIFContext, x) #define ENC AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "loop", "Number of times to loop the output.", OFFSET(loop), FF_OPT_TYPE_INT, {0}, 0, 65535, ENC }, + { "loop", "Number of times to loop the output.", OFFSET(loop), AV_OPT_TYPE_INT, {0}, 0, 65535, ENC }, { NULL }, }; diff --git a/libavformat/http.c b/libavformat/http.c index 751a2029cd..265aff27e0 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -54,7 +54,7 @@ typedef struct { #define OFFSET(x) offsetof(HTTPContext, x) static const AVOption options[] = { -{"chunksize", "use chunked transfer-encoding for posts, -1 disables it, 0 enables it", OFFSET(chunksize), FF_OPT_TYPE_INT64, {.dbl = 0}, -1, 0 }, /* Default to 0, for chunked POSTs */ +{"chunksize", "use chunked transfer-encoding for posts, -1 disables it, 0 enables it", OFFSET(chunksize), AV_OPT_TYPE_INT64, {.dbl = 0}, -1, 0 }, /* Default to 0, for chunked POSTs */ {NULL} }; static const AVClass httpcontext_class = { diff --git a/libavformat/img2.c b/libavformat/img2.c index 5ac57e5c32..1e6fb966c6 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -462,10 +462,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) #define OFFSET(x) offsetof(VideoData, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "video_size", "", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, - { "loop", "", OFFSET(loop), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, DEC }, + { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "video_size", "", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, + { "loop", "", OFFSET(loop), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, DEC }, { NULL }, }; diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index c461ac39dc..9ff2f4f86f 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -38,7 +38,7 @@ typedef struct { static const AVOption options[] = { {"smc-interval", "StreamMuxConfig interval.", - offsetof(LATMContext, mod), FF_OPT_TYPE_INT, {.dbl = 0x0014}, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(LATMContext, mod), AV_OPT_TYPE_INT, {.dbl = 0x0014}, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, {NULL}, }; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 7670f356fe..5fd54fcb77 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -42,8 +42,8 @@ #include <assert.h> static const AVOption options[] = { - { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, - { "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, + { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, + { "rtphint", "Add RTP hint tracks", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags), { NULL }, }; diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 38a2665b22..b212978dc9 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -191,9 +191,9 @@ AVOutputFormat ff_mp2_muxer = { static const AVOption options[] = { { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.", - offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MP3Context, id3v2_version), AV_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM}, { "write_id3v1", "Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software.", - offsetof(MP3Context, write_id3v1), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MP3Context, write_id3v1), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { NULL }, }; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 1facf3de69..5196fab1e4 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -126,7 +126,7 @@ struct MpegTSContext { }; static const AVOption options[] = { - {"compute_pcr", "Compute exact PCR for each transport stream packet.", offsetof(MpegTSContext, mpeg2ts_compute_pcr), FF_OPT_TYPE_INT, + {"compute_pcr", "Compute exact PCR for each transport stream packet.", offsetof(MpegTSContext, mpeg2ts_compute_pcr), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 1eb935c182..1173f69d78 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -80,17 +80,17 @@ typedef struct MpegTSWrite { static const AVOption options[] = { { "mpegts_transport_stream_id", "Set transport_stream_id field.", - offsetof(MpegTSWrite, transport_stream_id), FF_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MpegTSWrite, transport_stream_id), AV_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, { "mpegts_original_network_id", "Set original_network_id field.", - offsetof(MpegTSWrite, original_network_id), FF_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MpegTSWrite, original_network_id), AV_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, { "mpegts_service_id", "Set service_id field.", - offsetof(MpegTSWrite, service_id), FF_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MpegTSWrite, service_id), AV_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, { "mpegts_pmt_start_pid", "Set the first pid of the PMT.", - offsetof(MpegTSWrite, pmt_start_pid), FF_OPT_TYPE_INT, {.dbl = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MpegTSWrite, pmt_start_pid), AV_OPT_TYPE_INT, {.dbl = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM}, { "mpegts_start_pid", "Set the first pid.", - offsetof(MpegTSWrite, start_pid), FF_OPT_TYPE_INT, {.dbl = 0x0100 }, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM}, + offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT, {.dbl = 0x0100 }, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM}, {"mpegts_m2ts_mode", "Enable m2ts mode.", - offsetof(MpegTSWrite, m2ts_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, + offsetof(MpegTSWrite, m2ts_mode), AV_OPT_TYPE_INT, {.dbl = -1 }, -1,1, AV_OPT_FLAG_ENCODING_PARAM}, { NULL }, }; diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 6ffd0c0ff7..ce71ed2e51 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1871,7 +1871,7 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int mxf_interleave_get_packet, mxf_compare_timestamps); } -static const AVClass class = { +static const AVClass mxf_class = { .class_name = "mxf", .item_name = av_default_item_name, .version = LIBAVUTIL_VERSION_INT, @@ -1881,6 +1881,16 @@ static const AVClass class = { }, }; +static const AVClass mxf_d10_class = { + .class_name = "mxf_d10", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, + .option = (const AVOption[]){ + {TIMECODE_OPT(MXFContext, AV_OPT_FLAG_ENCODING_PARAM)}, + {NULL} + }, +}; + AVOutputFormat ff_mxf_muxer = { .name = "mxf", .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format"), @@ -1894,7 +1904,7 @@ AVOutputFormat ff_mxf_muxer = { .write_trailer = mxf_write_footer, .flags = AVFMT_NOTIMESTAMPS, .interleave_packet = mxf_interleave, - .priv_class = &class, + .priv_class = &mxf_class, }; AVOutputFormat ff_mxf_d10_muxer = { @@ -1909,5 +1919,5 @@ AVOutputFormat ff_mxf_d10_muxer = { .write_trailer = mxf_write_footer, .flags = AVFMT_NOTIMESTAMPS, .interleave_packet = mxf_interleave, - .priv_class = &class, + .priv_class = &mxf_d10_class, }; diff --git a/libavformat/options.c b/libavformat/options.c index 65f1a4e639..c099ea63a1 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -33,30 +33,36 @@ static const char* format_to_name(void* ptr) else return "NULL"; } -static const AVOption *opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags) +static void *format_child_next(void *obj, void *prev) +{ + AVFormatContext *s = obj; + if (!prev && s->priv_data && + ((s->iformat && s->iformat->priv_class) || + s->oformat && s->oformat->priv_class)) + return s->priv_data; + return NULL; +} + +static const AVClass *format_child_class_next(const AVClass *prev) { - AVFormatContext *s = obj; AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; - if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ) && s->priv_data) { - if ((s->iformat && !s->iformat->priv_class) || - (s->oformat && !s->oformat->priv_class)) - return NULL; - return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags); - } - - while ((ifmt = av_iformat_next(ifmt))) { - const AVOption *o; - - if (ifmt->priv_class && (o = av_opt_find(&ifmt->priv_class, name, unit, opt_flags, search_flags))) - return o; - } - while ((ofmt = av_oformat_next(ofmt))) { - const AVOption *o; - - if (ofmt->priv_class && (o = av_opt_find(&ofmt->priv_class, name, unit, opt_flags, search_flags))) - return o; - } + + while (prev && (ifmt = av_iformat_next(ifmt))) + if (ifmt->priv_class == prev) + break; + if ((prev && ifmt) || (!prev)) + while (ifmt = av_iformat_next(ifmt)) + if (ifmt->priv_class) + return ifmt->priv_class; + + while (prev && (ofmt = av_oformat_next(ofmt))) + if (ofmt->priv_class == prev) + break; + while (ofmt = av_oformat_next(ofmt)) + if (ofmt->priv_class) + return ofmt->priv_class; + return NULL; } @@ -67,33 +73,33 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i #define D AV_OPT_FLAG_DECODING_PARAM static const AVOption options[]={ -{"probesize", "set probing size", OFFSET(probesize), FF_OPT_TYPE_INT, {.dbl = 5000000 }, 32, INT_MAX, D}, -{"muxrate", "set mux rate", OFFSET(mux_rate), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E}, -{"packetsize", "set packet size", OFFSET(packet_size), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E}, -{"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, D|E, "fflags"}, -{"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"}, -{"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"}, -{"nofillin", "do not fill in missing values that can be exactly calculated", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOFILLIN }, INT_MIN, INT_MAX, D, "fflags"}, -{"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"}, -{"igndts", "ignore dts", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"}, +{"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT, {.dbl = 5000000 }, 32, INT_MAX, D}, +{"muxrate", "set mux rate", OFFSET(mux_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E}, +{"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E}, +{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, INT_MIN, INT_MAX, D|E, "fflags"}, +{"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"}, +{"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"}, +{"nofillin", "do not fill in missing values that can be exactly calculated", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOFILLIN }, INT_MIN, INT_MAX, D, "fflags"}, +{"noparse", "disable AVParsers, this needs nofillin too", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"}, +{"igndts", "ignore dts", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"}, #if FF_API_FLAG_RTP_HINT -{"rtphint", "add rtp hinting (deprecated, use the -movflags rtphint option instead)", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_RTP_HINT }, INT_MIN, INT_MAX, E, "fflags"}, +{"rtphint", "add rtp hinting (deprecated, use the -movflags rtphint option instead)", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_RTP_HINT }, INT_MIN, INT_MAX, E, "fflags"}, #endif -{"discardcorrupt", "discard corrupted frames", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"}, -{"sortdts", "try to interleave outputted packets by dts", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, "fflags"}, -{"keepside", "dont merge side data", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"}, -{"latm", "enable RTP MP4A-LATM payload", 0, FF_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"}, -{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, {.dbl = 5*AV_TIME_BASE }, 0, INT_MAX, D}, -{"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, -{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, {.dbl = 1<<20 }, 0, INT_MAX, D}, -{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), FF_OPT_TYPE_INT, {.dbl = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */ -{"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"}, -{"ts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"}, -{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D}, -{"fer", "set error detection aggressivity", OFFSET(error_recognition), FF_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"}, -{"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"}, -{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"}, -{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D}, +{"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"}, +{"sortdts", "try to interleave outputted packets by dts", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, "fflags"}, +{"keepside", "dont merge side data", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"}, +{"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"}, +{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.dbl = 5*AV_TIME_BASE }, 0, INT_MAX, D}, +{"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, +{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.dbl = 1<<20 }, 0, INT_MAX, D}, +{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.dbl = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */ +{"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"}, +{"ts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"}, +{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D}, +{"fer", "set error detection aggressivity", OFFSET(error_recognition), AV_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"}, +{"careful", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"}, +{"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"}, +{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D}, {NULL}, }; @@ -106,7 +112,8 @@ static const AVClass av_format_context_class = { .item_name = format_to_name, .option = options, .version = LIBAVUTIL_VERSION_INT, - .opt_find = opt_find, + .child_next = format_child_next, + .child_class_next = format_child_class_next, }; static void avformat_get_context_defaults(AVFormatContext *s) diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index 3e6132b880..542ee17749 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -49,8 +49,8 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) } static const AVOption pcm_options[] = { - { "sample_rate", "", offsetof(RawAudioDemuxerContext, sample_rate), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "channels", "", offsetof(RawAudioDemuxerContext, channels), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "sample_rate", "", offsetof(RawAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "", offsetof(RawAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 4fc48ed586..c3be73cf77 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -171,7 +171,7 @@ fail: #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM const AVOption ff_rawvideo_options[] = { - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC}, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC}, { NULL }, }; diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c index f5329a7b9e..8bd0dc92f0 100644 --- a/libavformat/rawvideodec.c +++ b/libavformat/rawvideodec.c @@ -47,9 +47,9 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption rawvideo_options[] = { - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, { NULL }, }; diff --git a/libavformat/rtp.c b/libavformat/rtp.c index 127b540748..d85b1b79db 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -97,9 +97,9 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec) /* Was the payload type already specified for the RTP muxer? */ if (ofmt && ofmt->priv_class) { - int payload_type = av_get_int(fmt->priv_data, "payload_type", NULL); - if (payload_type >= 0) - return payload_type; + int64_t payload_type; + if (av_opt_get_int(fmt->priv_data, "payload_type", 0, &payload_type) >= 0) + return (int)payload_type; } /* static payload type */ diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 002222f0ee..9023dd6985 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -218,7 +218,7 @@ static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq) return 1; } -int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) +int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) { AVIOContext *pb; uint8_t *buf; @@ -315,7 +315,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) return 0; } -void rtp_send_punch_packets(URLContext* rtp_handle) +void ff_rtp_send_punch_packets(URLContext* rtp_handle) { AVIOContext *pb; uint8_t *buf; @@ -359,7 +359,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle) * MPEG2TS streams to indicate that they should be demuxed inside the * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned) */ -RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size) +RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size) { RTPDemuxContext *s; @@ -407,8 +407,8 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r } void -rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, - RTPDynamicProtocolHandler *handler) +ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, + RTPDynamicProtocolHandler *handler) { s->dynamic_protocol_context = ctx; s->parse_packet = handler->parse_packet; @@ -722,8 +722,8 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt, * @return 0 if a packet is returned, 1 if a packet is returned and more can follow * (use buf as NULL to read the next). -1 if no packet (error or no more packet). */ -int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - uint8_t **bufptr, int len) +int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, + uint8_t **bufptr, int len) { int rv = rtp_parse_one_packet(s, pkt, bufptr, len); s->prev_ret = rv; @@ -732,7 +732,7 @@ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, return rv ? rv : has_next_packet(s); } -void rtp_parse_close(RTPDemuxContext *s) +void ff_rtp_parse_close(RTPDemuxContext *s) { ff_rtp_reset_packet_queue(s); if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 2801101fd3..dbb45f5709 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -38,18 +38,18 @@ typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; #define RTP_NOTS_VALUE ((uint32_t)-1) typedef struct RTPDemuxContext RTPDemuxContext; -RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size); -void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, - RTPDynamicProtocolHandler *handler); -int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - uint8_t **buf, int len); -void rtp_parse_close(RTPDemuxContext *s); +RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size); +void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, + RTPDynamicProtocolHandler *handler); +int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, + uint8_t **buf, int len); +void ff_rtp_parse_close(RTPDemuxContext *s); int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s); void ff_rtp_reset_packet_queue(RTPDemuxContext *s); -int rtp_get_local_rtp_port(URLContext *h); -int rtp_get_local_rtcp_port(URLContext *h); +int ff_rtp_get_local_rtp_port(URLContext *h); +int ff_rtp_get_local_rtcp_port(URLContext *h); -int rtp_set_remote_url(URLContext *h, const char *uri); +int ff_rtp_set_remote_url(URLContext *h, const char *uri); /** * Send a dummy packet on both port pairs to set up the connection @@ -62,19 +62,19 @@ int rtp_set_remote_url(URLContext *h, const char *uri); * The same routine is used with RDT too, even if RDT doesn't use normal * RTP packets otherwise. */ -void rtp_send_punch_packets(URLContext* rtp_handle); +void ff_rtp_send_punch_packets(URLContext* rtp_handle); /** * some rtp servers assume client is dead if they don't hear from them... * so we send a Receiver Report to the provided ByteIO context * (we don't have access to the rtcp handle from here) */ -int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); +int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); /** * Get the file handle for the RTCP socket. */ -int rtp_get_rtcp_file_handle(URLContext *h); +int ff_rtp_get_rtcp_file_handle(URLContext *h); // these statistics are used for rtcp receiver reports... typedef struct { diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index a336c64b37..bf183e7d21 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -32,7 +32,7 @@ static const AVOption options[] = { FF_RTP_FLAG_OPTS(RTPMuxContext, flags), - { "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM }, + { "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM }, { NULL }, }; diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h index cba0d02d91..901336322d 100644 --- a/libavformat/rtpenc.h +++ b/libavformat/rtpenc.h @@ -66,8 +66,8 @@ typedef struct RTPMuxContext RTPMuxContext; #define FF_RTP_FLAG_MP4A_LATM 1 #define FF_RTP_FLAG_OPTS(ctx, fieldname) \ - { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ - { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, FF_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \ + { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \ + { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, AV_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m); diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index ed96d72f62..df7b9957b0 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -31,6 +31,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, AVFormatContext *rtpctx; int ret; AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); + uint8_t *rtpflags; + AVDictionary *opts = NULL; if (!rtp_format) return NULL; @@ -51,12 +53,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM; - av_set_parameters(rtpctx, NULL); - /* Copy the rtpflags values straight through */ - if (s->oformat->priv_class && - av_find_opt(s->priv_data, "rtpflags", NULL, 0, 0)) - av_set_int(rtpctx->priv_data, "rtpflags", - av_get_int(s->priv_data, "rtpflags", NULL)); + if (av_opt_get(s, "rtpflags", AV_OPT_SEARCH_CHILDREN, &rtpflags) >= 0) + av_dict_set(&opts, "rtpflags", rtpflags, AV_DICT_DONT_STRDUP_VAL); /* Set the synchronized start time. */ rtpctx->start_time_realtime = s->start_time_realtime; @@ -67,7 +65,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, ffio_fdopen(&rtpctx->pb, handle); } else ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size); - ret = avformat_write_header(rtpctx, NULL); + ret = avformat_write_header(rtpctx, &opts); + av_dict_free(&opts); if (ret) { if (handle) { diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index d2ce53c670..4f4cde621c 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -60,7 +60,7 @@ typedef struct RTPContext { * @return zero if no error. */ -int rtp_set_remote_url(URLContext *h, const char *uri) +int ff_rtp_set_remote_url(URLContext *h, const char *uri) { RTPContext *s = h->priv_data; char hostname[256]; @@ -301,7 +301,7 @@ static int rtp_close(URLContext *h) * @return the local port number */ -int rtp_get_local_rtp_port(URLContext *h) +int ff_rtp_get_local_rtp_port(URLContext *h) { RTPContext *s = h->priv_data; return ff_udp_get_local_port(s->rtp_hd); @@ -313,7 +313,7 @@ int rtp_get_local_rtp_port(URLContext *h) * @return the local port number */ -int rtp_get_local_rtcp_port(URLContext *h) +int ff_rtp_get_local_rtcp_port(URLContext *h) { RTPContext *s = h->priv_data; return ff_udp_get_local_port(s->rtcp_hd); @@ -325,7 +325,7 @@ static int rtp_get_file_handle(URLContext *h) return s->rtp_fd; } -int rtp_get_rtcp_file_handle(URLContext *h) { +int ff_rtp_get_rtcp_file_handle(URLContext *h) { RTPContext *s = h->priv_data; return s->rtcp_fd; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 3b410a3043..64e29cc487 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -501,7 +501,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ff_rdt_parse_close(rtsp_st->transport_priv); else if (CONFIG_RTPDEC) - rtp_parse_close(rtsp_st->transport_priv); + ff_rtp_parse_close(rtsp_st->transport_priv); } rtsp_st->transport_priv = NULL; if (rtsp_st->rtp_handle) @@ -558,7 +558,7 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); else if (CONFIG_RTPDEC) - rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle, + rtsp_st->transport_priv = ff_rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); @@ -567,9 +567,9 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) return AVERROR(ENOMEM); } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { if (rtsp_st->dynamic_handler) { - rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, - rtsp_st->dynamic_protocol_context, - rtsp_st->dynamic_handler); + ff_rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, + rtsp_st->dynamic_protocol_context, + rtsp_st->dynamic_handler); } } @@ -808,6 +808,9 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf, if (strstr(p, "GET_PARAMETER") && method && !strcmp(method, "OPTIONS")) rt->get_parameter_supported = 1; + } else if (av_stristart(p, "x-Accept-Dynamic-Rate:", &p) && rt) { + p += strspn(p, SPACE_CHARS); + rt->accept_dynamic_rate = atoi(p); } } @@ -1121,7 +1124,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, goto fail; rtp_opened: - port = rtp_get_local_rtp_port(rtsp_st->rtp_handle); + port = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle); have_port: snprintf(transport, sizeof(transport) - 1, "%s/UDP;", trans_pref); @@ -1165,6 +1168,8 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, snprintf(cmd, sizeof(cmd), "Transport: %s\r\n", transport); + if (rt->accept_dynamic_rate) + av_strlcat(cmd, "x-Dynamic-Rate: 0\r\n", sizeof(cmd)); if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) { char real_res[41], real_csum[9]; ff_rdt_calc_response_and_checksum(real_res, real_csum, @@ -1225,7 +1230,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, reply->transports[0].server_port_min, "%s", options); } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && - rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { + ff_rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { err = AVERROR_INVALIDDATA; goto fail; } @@ -1235,7 +1240,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, */ if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && CONFIG_RTPDEC) - rtp_send_punch_packets(rtsp_st->rtp_handle); + ff_rtp_send_punch_packets(rtsp_st->rtp_handle); break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { @@ -1569,7 +1574,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, if (rtsp_st->rtp_handle) { p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle); p[max_p++].events = POLLIN; - p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); + p[max_p].fd = ff_rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); p[max_p++].events = POLLIN; } } @@ -1624,7 +1629,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) if (rt->transport == RTSP_TRANSPORT_RDT) { ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); } else - ret = rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); + ret = ff_rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0); if (ret == 0) { rt->cur_transport_priv = NULL; return 0; @@ -1672,13 +1677,13 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end); if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) - rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); + ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); break; } if (len == AVERROR(EAGAIN) && first_queue_st && rt->transport == RTSP_TRANSPORT_RTP) { rtsp_st = first_queue_st; - ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0); + ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0); goto end; } if (len < 0) @@ -1688,7 +1693,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) if (rt->transport == RTSP_TRANSPORT_RDT) { ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); } else { - ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); + ret = ff_rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); if (ret < 0) { /* Either bad packet, or a RTCP packet. Check if the * first_rtcp_ntp_time field was initialized. */ diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 3d0345d35c..7d0dac12e2 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -346,6 +346,9 @@ typedef struct RTSPState { * Option flags for the chained RTP muxer. */ int rtp_muxer_flags; + + /** Whether the server accepts the x-Dynamic-Rate header */ + int accept_dynamic_rate; } RTSPState; /** diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 2391055202..3235365842 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -389,7 +389,7 @@ static int rtsp_read_close(AVFormatContext *s) } static const AVOption options[] = { - { "initial_pause", "Don't start playing the stream immediately", offsetof(RTSPState, initial_pause), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, + { "initial_pause", "Don't start playing the stream immediately", offsetof(RTSPState, initial_pause), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 84372f82da..8602c0fee1 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -86,10 +86,10 @@ typedef struct IEC61937Context { } IEC61937Context; static const AVOption options[] = { -{ "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, spdif_flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, -{ "be", "output in big-endian format (for use as s16be)", 0, FF_OPT_TYPE_CONST, {.dbl = SPDIF_FLAG_BIGENDIAN}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, -{ "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM }, -{ "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), FF_OPT_TYPE_INT, {.dbl = 60}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, +{ "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, spdif_flags), AV_OPT_TYPE_FLAGS, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, +{ "be", "output in big-endian format (for use as s16be)", 0, AV_OPT_TYPE_CONST, {.dbl = SPDIF_FLAG_BIGENDIAN}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, +{ "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM }, +{ "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), AV_OPT_TYPE_INT, {.dbl = 60}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { NULL }, }; diff --git a/libavformat/tty.c b/libavformat/tty.c index 1e653e1e09..913ec457da 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -142,9 +142,9 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) #define OFFSET(x) offsetof(TtyDemuxContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { - { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM}, - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, + { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), AV_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM}, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, { NULL }, }; diff --git a/libavformat/wav.c b/libavformat/wav.c index d6b9b53b4f..bd8c847e85 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -201,7 +201,7 @@ static int wav_write_trailer(AVFormatContext *s) #define OFFSET(x) offsetof(WAVContext, x) #define ENC AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "write_bext", "Write BEXT chunk.", OFFSET(write_bext), FF_OPT_TYPE_INT, { 0 }, 0, 1, ENC }, + { "write_bext", "Write BEXT chunk.", OFFSET(write_bext), AV_OPT_TYPE_INT, { 0 }, 0, 1, ENC }, { NULL }, }; diff --git a/libavutil/avutil.h b/libavutil/avutil.h index f4c0c8fffa..e0131552dd 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,8 +40,8 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 51 -#define LIBAVUTIL_VERSION_MINOR 20 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MINOR 21 +#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libavutil/log.h b/libavutil/log.h index 046d19920e..b8683302a2 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -30,7 +30,7 @@ * arbitrary struct of which the first field is a pointer to an * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). */ -typedef struct { +typedef struct AVClass { /** * The name of the class; usually it is the same name as the * context structure type to which the AVClass is associated. @@ -73,11 +73,19 @@ typedef struct { int parent_log_context_offset; /** - * A function for extended searching, e.g. in possible - * children objects. + * Return next AVOptions-enabled child or NULL */ - const struct AVOption* (*opt_find)(void *obj, const char *name, const char *unit, - int opt_flags, int search_flags); + void* (*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_next)(const struct AVClass *prev); } AVClass; /* av_log API */ diff --git a/libavutil/opt.c b/libavutil/opt.c index c425cfefbd..7fe272dd9d 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -46,13 +46,35 @@ const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mas } #endif +#if FF_API_OLD_AVOPTIONS const AVOption *av_next_option(void *obj, const AVOption *last) { + return av_opt_next(obj, last); +} +#endif + +const AVOption *av_opt_next(void *obj, const AVOption *last) +{ if (last && last[1].name) return ++last; else if (last || !(*(AVClass**)obj)->option->name) return NULL; else return (*(AVClass**)obj)->option; } +static int read_number(const AVOption *o, void *dst, double *num, int *den, int64_t *intnum) +{ + switch (o->type) { + case AV_OPT_TYPE_FLAGS: *intnum = *(unsigned int*)dst;return 0; + case AV_OPT_TYPE_INT: *intnum = *(int *)dst;return 0; + case AV_OPT_TYPE_INT64: *intnum = *(int64_t *)dst;return 0; + case AV_OPT_TYPE_FLOAT: *num = *(float *)dst;return 0; + case AV_OPT_TYPE_DOUBLE: *num = *(double *)dst;return 0; + case AV_OPT_TYPE_RATIONAL: *intnum = ((AVRational*)dst)->num; + *den = ((AVRational*)dst)->den; + return 0; + } + return AVERROR(EINVAL); +} + static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum) { if (o->max*den < num*intnum || o->min*den > num*intnum) { @@ -61,12 +83,12 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int } switch (o->type) { - case FF_OPT_TYPE_FLAGS: - case FF_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break; - case FF_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break; - case FF_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break; - case FF_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break; - case FF_OPT_TYPE_RATIONAL: + case AV_OPT_TYPE_FLAGS: + case AV_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break; + case AV_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break; + case AV_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break; + case AV_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break; + case AV_OPT_TYPE_RATIONAL: if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den}; else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24); break; @@ -137,10 +159,11 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void { int ret = 0, notfirst = 0; for (;;) { - int i; + int i, den = 1; char buf[256]; int cmd = 0; - double d; + double d, num = 1; + int64_t intnum = 1; if (*val == '+' || *val == '-') cmd = *(val++); @@ -151,7 +174,7 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void { const AVOption *o_named = av_opt_find(obj, buf, o->unit, 0, 0); - if (o_named && o_named->type == FF_OPT_TYPE_CONST) + if (o_named && o_named->type == AV_OPT_TYPE_CONST) d = o_named->default_val.dbl; else if (!strcmp(buf, "default")) d = o->default_val.dbl; else if (!strcmp(buf, "max" )) d = o->max; @@ -166,12 +189,14 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void } } } - if (o->type == FF_OPT_TYPE_FLAGS) { - if (cmd == '+') d = av_get_int(obj, o->name, NULL) | (int64_t)d; - else if (cmd == '-') d = av_get_int(obj, o->name, NULL) &~(int64_t)d; + if (o->type == AV_OPT_TYPE_FLAGS) { + read_number(o, dst, NULL, NULL, &intnum); + if (cmd == '+') d = intnum | (int64_t)d; + else if (cmd == '-') d = intnum &~(int64_t)d; } else { - if (cmd == '+') d = notfirst*av_get_double(obj, o->name, NULL) + d; - else if (cmd == '-') d = notfirst*av_get_double(obj, o->name, NULL) - d; + read_number(o, dst, &num, &den, &intnum); + if (cmd == '+') d = notfirst*num*intnum/den + d; + else if (cmd == '-') d = notfirst*num*intnum/den - d; } if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0) @@ -185,63 +210,111 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void return 0; } +#if FF_API_OLD_AVOPTIONS int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out) { const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); - void *dst; if (o_out) *o_out = o; - if (!o) + return av_opt_set(obj, name, val, 0); +} +#endif + +int av_opt_set(void *obj, const char *name, const char *val, int search_flags) +{ + void *dst, *target_obj; + const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); + if (!o || !target_obj) return AVERROR_OPTION_NOT_FOUND; - if (!val && o->type != FF_OPT_TYPE_STRING) + if (!val && o->type != AV_OPT_TYPE_STRING) return AVERROR(EINVAL); - dst = ((uint8_t*)obj) + o->offset; + dst = ((uint8_t*)target_obj) + o->offset; switch (o->type) { - case FF_OPT_TYPE_STRING: return set_string(obj, o, val, dst); - case FF_OPT_TYPE_BINARY: return set_string_binary(obj, o, val, dst); - case FF_OPT_TYPE_FLAGS: - case FF_OPT_TYPE_INT: - case FF_OPT_TYPE_INT64: - case FF_OPT_TYPE_FLOAT: - case FF_OPT_TYPE_DOUBLE: - case FF_OPT_TYPE_RATIONAL: return set_string_number(obj, o, val, dst); + case AV_OPT_TYPE_STRING: return set_string(obj, o, val, dst); + case AV_OPT_TYPE_BINARY: return set_string_binary(obj, o, val, dst); + case AV_OPT_TYPE_FLAGS: + case AV_OPT_TYPE_INT: + case AV_OPT_TYPE_INT64: + case AV_OPT_TYPE_FLOAT: + case AV_OPT_TYPE_DOUBLE: + case AV_OPT_TYPE_RATIONAL: return set_string_number(obj, o, val, dst); } av_log(obj, AV_LOG_ERROR, "Invalid option type.\n"); return AVERROR(EINVAL); } -static const AVOption *set_number(void *obj, const char *name, double num, int den, int64_t intnum) +#define OPT_EVAL_NUMBER(name, opttype, vartype)\ + int av_opt_eval_ ## name(void *obj, const AVOption *o, const char *val, vartype *name ## _out)\ + {\ + if (!o || o->type != opttype)\ + return AVERROR(EINVAL);\ + return set_string_number(obj, o, val, name ## _out);\ + } + +OPT_EVAL_NUMBER(flags, AV_OPT_TYPE_FLAGS, int) +OPT_EVAL_NUMBER(int, AV_OPT_TYPE_INT, int) +OPT_EVAL_NUMBER(int64, AV_OPT_TYPE_INT64, int64_t) +OPT_EVAL_NUMBER(float, AV_OPT_TYPE_FLOAT, float) +OPT_EVAL_NUMBER(double, AV_OPT_TYPE_DOUBLE, double) +OPT_EVAL_NUMBER(q, AV_OPT_TYPE_RATIONAL, AVRational) + +static int set_number(void *obj, const char *name, double num, int den, int64_t intnum, + int search_flags) { - const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); - void *dst; + void *dst, *target_obj; + const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - if (!o) - return NULL; + if (!o || !target_obj) + return AVERROR_OPTION_NOT_FOUND; - dst = ((uint8_t*)obj) + o->offset; - if (write_number(obj, o, dst, num, den, intnum) < 0) - return NULL; - else - return o; + dst = ((uint8_t*)target_obj) + o->offset; + return write_number(obj, o, dst, num, den, intnum); } +#if FF_API_OLD_AVOPTIONS const AVOption *av_set_double(void *obj, const char *name, double n) { - return set_number(obj, name, n, 1, 1); + const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); + if (set_number(obj, name, n, 1, 1, 0) < 0) + return NULL; + return o; } const AVOption *av_set_q(void *obj, const char *name, AVRational n) { - return set_number(obj, name, n.num, n.den, 1); + const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); + if (set_number(obj, name, n.num, n.den, 1, 0) < 0) + return NULL; + return o; } const AVOption *av_set_int(void *obj, const char *name, int64_t n) { - return set_number(obj, name, 1, 1, n); + const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); + if (set_number(obj, name, 1, 1, n, 0) < 0) + return NULL; + return o; +} +#endif + +int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags) +{ + return set_number(obj, name, 1, 1, val, search_flags); +} + +int av_opt_set_double(void *obj, const char *name, double val, int search_flags) +{ + return set_number(obj, name, val, 1, 1, search_flags); +} + +int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags) +{ + return set_number(obj, name, val.num, val.den, 1, search_flags); } +#if FF_API_OLD_AVOPTIONS /** * * @param buf a buffer which is used for returning non string values as strings, can be NULL @@ -255,21 +328,21 @@ const char *av_get_string(void *obj, const char *name, const AVOption **o_out, c int len, i; if (!o) return NULL; - if (o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len)) + if (o->type != AV_OPT_TYPE_STRING && (!buf || !buf_len)) return NULL; dst= ((uint8_t*)obj) + o->offset; if (o_out) *o_out= o; switch (o->type) { - case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; - case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; - case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; - case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; - case FF_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; - case FF_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; - case FF_OPT_TYPE_STRING: return *(void**)dst; - case FF_OPT_TYPE_BINARY: + case AV_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; + case AV_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; + case AV_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; + case AV_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; + case AV_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; + case AV_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; + case AV_OPT_TYPE_STRING: return *(void**)dst; + case AV_OPT_TYPE_BINARY: len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); if (len >= (buf_len + 1)/2) return NULL; bin = *(uint8_t**)dst; @@ -279,41 +352,82 @@ const char *av_get_string(void *obj, const char *name, const AVOption **o_out, c } return buf; } +#endif -static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum) +int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val) { - const AVOption *o = av_opt_find(obj, name, NULL, 0, AV_OPT_SEARCH_CHILDREN); - void *dst; - if (!o || (o->offset<=0 && o->type != FF_OPT_TYPE_CONST)) - goto error; + void *dst, *target_obj; + const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); + uint8_t *bin, buf[128]; + int len, i, ret; - dst= ((uint8_t*)obj) + o->offset; + if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST)) + return AVERROR_OPTION_NOT_FOUND; - if (o_out) *o_out= o; + dst = (uint8_t*)target_obj + o->offset; + buf[0] = 0; switch (o->type) { - case FF_OPT_TYPE_FLAGS: *intnum= *(unsigned int*)dst;return 0; - case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0; - case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0; - case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0; - case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0; - case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num; - *den = ((AVRational*)dst)->den; - return 0; - case FF_OPT_TYPE_CONST: *intnum= o->default_val.dbl;return 0; + case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; + case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; + case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; + case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; + case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; + case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; + case AV_OPT_TYPE_CONST: ret = snprintf(buf, sizeof(buf), "%f" , o->default_val.dbl);break; + case AV_OPT_TYPE_STRING: + if (*(uint8_t**)dst) + *out_val = av_strdup(*(uint8_t**)dst); + else + *out_val = av_strdup(""); + return 0; + case AV_OPT_TYPE_BINARY: + len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); + if ((uint64_t)len*2 + 1 > INT_MAX) + return AVERROR(EINVAL); + if (!(*out_val = av_malloc(len*2 + 1))) + return AVERROR(ENOMEM); + bin = *(uint8_t**)dst; + for (i = 0; i < len; i++) + snprintf(*out_val + i*2, 3, "%02X", bin[i]); + return 0; + default: + return AVERROR(EINVAL); } + + if (ret >= sizeof(buf)) + return AVERROR(EINVAL); + *out_val = av_strdup(buf); + return 0; +} + +static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum, + int search_flags) +{ + void *dst, *target_obj; + const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); + if (!o || !target_obj) + goto error; + + dst = ((uint8_t*)target_obj) + o->offset; + + if (o_out) *o_out= o; + + return read_number(o, dst, num, den, intnum); + error: *den=*intnum=0; return -1; } +#if FF_API_OLD_AVOPTIONS double av_get_double(void *obj, const char *name, const AVOption **o_out) { int64_t intnum=1; double num=1; int den=1; - if (get_number(obj, name, o_out, &num, &den, &intnum) < 0) + if (get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0) return NAN; return num*intnum/den; } @@ -324,7 +438,7 @@ AVRational av_get_q(void *obj, const char *name, const AVOption **o_out) double num=1; int den=1; - if (get_number(obj, name, o_out, &num, &den, &intnum) < 0) + if (get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0) return (AVRational){0, 0}; if (num == 1.0 && (int)intnum == intnum) return (AVRational){intnum, den}; @@ -338,19 +452,62 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) double num=1; int den=1; - if (get_number(obj, name, o_out, &num, &den, &intnum) < 0) + if (get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0) return -1; return num*intnum/den; } +#endif + +int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val) +{ + int64_t intnum = 1; + double num = 1; + int ret, den = 1; + + if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) + return ret; + *out_val = num*intnum/den; + return 0; +} + +int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val) +{ + int64_t intnum = 1; + double num = 1; + int ret, den = 1; + + if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) + return ret; + *out_val = num*intnum/den; + return 0; +} + +int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val) +{ + int64_t intnum = 1; + double num = 1; + int ret, den = 1; + + if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) + return ret; + + if (num == 1.0 && (int)intnum == intnum) + *out_val = (AVRational){intnum, den}; + else + *out_val = av_d2q(num*intnum/den, 1<<24); + return 0; +} int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) { - const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0); - const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0); + const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0); + const AVOption *flag = av_opt_find(obj, flag_name, NULL, 0, 0); + int64_t res; - if (!field || !flag || flag->type != FF_OPT_TYPE_CONST) + if (!field || !flag || flag->type != AV_OPT_TYPE_CONST || + av_opt_get_int(obj, field_name, 0, &res) < 0) return 0; - return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl; + return res & (int) flag->default_val.dbl; } static void opt_list(void *obj, void *av_log_obj, const char *unit, @@ -358,7 +515,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, { const AVOption *opt=NULL; - while ((opt= av_next_option(obj, opt))) { + while ((opt = av_opt_next(obj, opt))) { if (!(opt->flags & req_flags) || (opt->flags & rej_flags)) continue; @@ -366,43 +523,43 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, * Don't print anything but CONST's on level two. * Only print items from the requested unit. */ - if (!unit && opt->type==FF_OPT_TYPE_CONST) + if (!unit && opt->type==AV_OPT_TYPE_CONST) continue; - else if (unit && opt->type!=FF_OPT_TYPE_CONST) + else if (unit && opt->type!=AV_OPT_TYPE_CONST) continue; - else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit)) + else if (unit && opt->type==AV_OPT_TYPE_CONST && strcmp(unit, opt->unit)) continue; - else if (unit && opt->type == FF_OPT_TYPE_CONST) + else if (unit && opt->type == AV_OPT_TYPE_CONST) av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); else av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name); switch (opt->type) { - case FF_OPT_TYPE_FLAGS: + case AV_OPT_TYPE_FLAGS: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>"); break; - case FF_OPT_TYPE_INT: + case AV_OPT_TYPE_INT: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<int>"); break; - case FF_OPT_TYPE_INT64: + case AV_OPT_TYPE_INT64: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<int64>"); break; - case FF_OPT_TYPE_DOUBLE: + case AV_OPT_TYPE_DOUBLE: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<double>"); break; - case FF_OPT_TYPE_FLOAT: + case AV_OPT_TYPE_FLOAT: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<float>"); break; - case FF_OPT_TYPE_STRING: + case AV_OPT_TYPE_STRING: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<string>"); break; - case FF_OPT_TYPE_RATIONAL: + case AV_OPT_TYPE_RATIONAL: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<rational>"); break; - case FF_OPT_TYPE_BINARY: + case AV_OPT_TYPE_BINARY: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<binary>"); break; - case FF_OPT_TYPE_CONST: + case AV_OPT_TYPE_CONST: default: av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); break; @@ -416,7 +573,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, if (opt->help) av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); av_log(av_log_obj, AV_LOG_INFO, "\n"); - if (opt->unit && opt->type != FF_OPT_TYPE_CONST) { + if (opt->unit && opt->type != AV_OPT_TYPE_CONST) { opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags); } } @@ -444,44 +601,44 @@ void av_opt_set_defaults2(void *s, int mask, int flags) { #endif const AVOption *opt = NULL; - while ((opt = av_next_option(s, opt)) != NULL) { + while ((opt = av_opt_next(s, opt)) != NULL) { #if FF_API_OLD_AVOPTIONS if ((opt->flags & mask) != flags) continue; #endif switch (opt->type) { - case FF_OPT_TYPE_CONST: + case AV_OPT_TYPE_CONST: /* Nothing to be done here */ break; - case FF_OPT_TYPE_FLAGS: - case FF_OPT_TYPE_INT: { + case AV_OPT_TYPE_FLAGS: + case AV_OPT_TYPE_INT: { int val; val = opt->default_val.dbl; - av_set_int(s, opt->name, val); + av_opt_set_int(s, opt->name, val, 0); } break; - case FF_OPT_TYPE_INT64: + case AV_OPT_TYPE_INT64: if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl) av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name); - av_set_int(s, opt->name, opt->default_val.dbl); + av_opt_set_int(s, opt->name, opt->default_val.dbl, 0); break; - case FF_OPT_TYPE_DOUBLE: - case FF_OPT_TYPE_FLOAT: { + case AV_OPT_TYPE_DOUBLE: + case AV_OPT_TYPE_FLOAT: { double val; val = opt->default_val.dbl; - av_set_double(s, opt->name, val); + av_opt_set_double(s, opt->name, val, 0); } break; - case FF_OPT_TYPE_RATIONAL: { + case AV_OPT_TYPE_RATIONAL: { AVRational val; val = av_d2q(opt->default_val.dbl, INT_MAX); - av_set_q(s, opt->name, val); + av_opt_set_q(s, opt->name, val, 0); } break; - case FF_OPT_TYPE_STRING: - av_set_string3(s, opt->name, opt->default_val.str, 1, NULL); + case AV_OPT_TYPE_STRING: + av_opt_set(s, opt->name, opt->default_val.str, 0); break; - case FF_OPT_TYPE_BINARY: + case AV_OPT_TYPE_BINARY: /* Cannot set default for binary */ break; default: @@ -504,7 +661,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) * set, or a negative value corresponding to an AVERROR code in case * of error: * AVERROR(EINVAL) if the key/value pair cannot be parsed, - * the error code issued by av_set_string3() if the key/value pair + * the error code issued by av_opt_set() if the key/value pair * cannot be set */ static int parse_key_value_pair(void *ctx, const char **buf, @@ -525,7 +682,7 @@ static int parse_key_value_pair(void *ctx, const char **buf, av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key); - ret = av_set_string3(ctx, key, val, 1, NULL); + ret = av_opt_set(ctx, key, val, 0); if (ret == AVERROR_OPTION_NOT_FOUND) av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key); @@ -556,8 +713,8 @@ int av_set_options_string(void *ctx, const char *opts, void av_opt_free(void *obj) { const AVOption *o = NULL; - while ((o = av_next_option(obj, o))) - if (o->type == FF_OPT_TYPE_STRING || o->type == FF_OPT_TYPE_BINARY) + while ((o = av_opt_next(obj, o))) + if (o->type == AV_OPT_TYPE_STRING || o->type == AV_OPT_TYPE_BINARY) av_freep((uint8_t *)obj + o->offset); } @@ -568,7 +725,7 @@ int av_opt_set_dict(void *obj, AVDictionary **options) int ret = 0; while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { - ret = av_set_string3(obj, t->key, t->value, 1, NULL); + ret = av_opt_set(obj, t->key, t->value, 0); if (ret == AVERROR_OPTION_NOT_FOUND) av_dict_set(&tmp, t->key, t->value, 0); else if (ret < 0) { @@ -585,22 +742,60 @@ int av_opt_set_dict(void *obj, AVDictionary **options) const AVOption *av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags) { - AVClass *c = *(AVClass**)obj; + return av_opt_find2(obj, name, unit, opt_flags, search_flags, NULL); +} + +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj) +{ + const AVClass *c = *(AVClass**)obj; const AVOption *o = NULL; - if (c->opt_find && search_flags & AV_OPT_SEARCH_CHILDREN && - (o = c->opt_find(obj, name, unit, opt_flags, search_flags))) - return o; + if (search_flags & AV_OPT_SEARCH_CHILDREN) { + if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) { + const AVClass *child = NULL; + while (child = av_opt_child_class_next(c, child)) + if (o = av_opt_find2(&child, name, unit, opt_flags, search_flags, NULL)) + return o; + } else { + void *child = NULL; + while (child = av_opt_child_next(obj, child)) + if (o = av_opt_find2(child, name, unit, opt_flags, search_flags, target_obj)) + return o; + } + } - while (o = av_next_option(obj, o)) { + while (o = av_opt_next(obj, o)) { if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags && - ((!unit && o->type != FF_OPT_TYPE_CONST) || - (unit && o->type == FF_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)))) + ((!unit && o->type != AV_OPT_TYPE_CONST) || + (unit && o->type == AV_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)))) { + if (target_obj) { + if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ)) + *target_obj = obj; + else + *target_obj = NULL; + } return o; + } } return NULL; } +void *av_opt_child_next(void *obj, void *prev) +{ + const AVClass *c = *(AVClass**)obj; + if (c->child_next) + return c->child_next(obj, prev); + return NULL; +} + +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev) +{ + if (parent->child_class_next) + return parent->child_class_next(prev); + return NULL; +} + #ifdef TEST #undef printf @@ -622,14 +817,14 @@ typedef struct TestContext #define TEST_FLAG_MU 04 static const AVOption test_options[]= { -{"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, {0}, 0, 100 }, -{"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, {0}, 0, 1 }, -{"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, {0}, 0, 10 }, -{"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, {0}, CHAR_MIN, CHAR_MAX }, -{"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, {0}, 0, INT_MAX, 0, "flags" }, -{"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, {TEST_FLAG_COOL}, INT_MIN, INT_MAX, 0, "flags" }, -{"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, {TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" }, -{"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, {TEST_FLAG_MU}, INT_MIN, INT_MAX, 0, "flags" }, +{"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, {0}, 0, 100 }, +{"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, {0}, 0, 1 }, +{"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, {0}, 0, 10 }, +{"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, {0}, CHAR_MIN, CHAR_MAX }, +{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {0}, 0, INT_MAX, 0, "flags" }, +{"cool", "set cool flag ", 0, AV_OPT_TYPE_CONST, {TEST_FLAG_COOL}, INT_MIN, INT_MAX, 0, "flags" }, +{"lame", "set lame flag ", 0, AV_OPT_TYPE_CONST, {TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" }, +{"mu", "set mu flag ", 0, AV_OPT_TYPE_CONST, {TEST_FLAG_MU}, INT_MIN, INT_MAX, 0, "flags" }, {NULL}, }; diff --git a/libavutil/opt.h b/libavutil/opt.h index 06dea7de4c..9e6aaa99c6 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -30,9 +30,20 @@ #include "rational.h" #include "avutil.h" #include "dict.h" +#include "log.h" enum AVOptionType{ - FF_OPT_TYPE_FLAGS, + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128, +#if FF_API_OLD_AVOPTIONS + FF_OPT_TYPE_FLAGS = 0, FF_OPT_TYPE_INT, FF_OPT_TYPE_INT64, FF_OPT_TYPE_DOUBLE, @@ -41,6 +52,7 @@ enum AVOptionType{ FF_OPT_TYPE_RATIONAL, FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length FF_OPT_TYPE_CONST=128, +#endif }; /** @@ -111,6 +123,7 @@ attribute_deprecated const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); #endif +#if FF_API_OLD_AVOPTIONS /** * Set the field of obj with the given name to value. * @@ -135,17 +148,21 @@ const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int m * AVERROR_OPTION_NOT_FOUND if no matching option exists * AVERROR(ERANGE) if the value is out of range * AVERROR(EINVAL) if the value is not valid + * @deprecated use av_opt_set() */ +attribute_deprecated int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); -const AVOption *av_set_double(void *obj, const char *name, double n); -const AVOption *av_set_q(void *obj, const char *name, AVRational n); -const AVOption *av_set_int(void *obj, const char *name, int64_t n); -double av_get_double(void *obj, const char *name, const AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); -const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -const AVOption *av_next_option(void *obj, const AVOption *last); +attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n); +attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n); +attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n); + +attribute_deprecated double av_get_double(void *obj, const char *name, const AVOption **o_out); +attribute_deprecated AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); +attribute_deprecated int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); +attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); +attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last); +#endif /** * Show the obj options. @@ -221,6 +238,30 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) */ int av_opt_set_dict(void *obj, struct AVDictionary **options); +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); +int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); +int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); +int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); +int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + #define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the given object first. */ /** @@ -256,4 +297,112 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); const AVOption *av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags); +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double(void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + */ +/** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + */ +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +/** + * @} + */ + #endif /* AVUTIL_OPT_H */ diff --git a/libswscale/options.c b/libswscale/options.c index 23cc8bb597..65095d5fd1 100644 --- a/libswscale/options.c +++ b/libswscale/options.c @@ -34,34 +34,34 @@ static const char * sws_context_to_name(void * ptr) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "sws_flags", "scaler/cpu flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, UINT_MAX, VE, "sws_flags" }, - { "fast_bilinear", "fast bilinear", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_FAST_BILINEAR }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "bilinear", "bilinear", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_BILINEAR }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "bicubic", "bicubic", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_BICUBIC }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "experimental", "experimental", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_X }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "neighbor", "nearest neighbor", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_POINT }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "area", "averaging area", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_AREA }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "bicublin", "luma bicubic, chroma bilinear", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_BICUBLIN }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "gauss", "gaussian", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_GAUSS }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "sinc", "sinc", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_SINC }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "lanczos", "lanczos", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_LANCZOS }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "spline", "natural bicubic spline", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_SPLINE }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "print_info", "print info", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_PRINT_INFO }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "accurate_rnd", "accurate rounding", 0, FF_OPT_TYPE_CONST, {.dbl = SWS_ACCURATE_RND }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "full_chroma_int", "full chroma interpolation", 0 , FF_OPT_TYPE_CONST, {.dbl = SWS_FULL_CHR_H_INT }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "full_chroma_inp", "full chroma input", 0 , FF_OPT_TYPE_CONST, {.dbl = SWS_FULL_CHR_H_INP }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "bitexact", "", 0 , FF_OPT_TYPE_CONST, {.dbl = SWS_BITEXACT }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "sws_flags", "scaler/cpu flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, UINT_MAX, VE, "sws_flags" }, + { "fast_bilinear", "fast bilinear", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_FAST_BILINEAR }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "bilinear", "bilinear", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_BILINEAR }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "bicubic", "bicubic", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_BICUBIC }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "experimental", "experimental", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_X }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "neighbor", "nearest neighbor", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_POINT }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "area", "averaging area", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_AREA }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "bicublin", "luma bicubic, chroma bilinear", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_BICUBLIN }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "gauss", "gaussian", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_GAUSS }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "sinc", "sinc", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_SINC }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "lanczos", "lanczos", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_LANCZOS }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "spline", "natural bicubic spline", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_SPLINE }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "print_info", "print info", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_PRINT_INFO }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "accurate_rnd", "accurate rounding", 0, AV_OPT_TYPE_CONST, {.dbl = SWS_ACCURATE_RND }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "full_chroma_int", "full chroma interpolation", 0 , AV_OPT_TYPE_CONST, {.dbl = SWS_FULL_CHR_H_INT }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "full_chroma_inp", "full chroma input", 0 , AV_OPT_TYPE_CONST, {.dbl = SWS_FULL_CHR_H_INP }, INT_MIN, INT_MAX, VE, "sws_flags" }, + { "bitexact", "", 0 , AV_OPT_TYPE_CONST, {.dbl = SWS_BITEXACT }, INT_MIN, INT_MAX, VE, "sws_flags" }, - { "srcw", "source width" , OFFSET(srcW), FF_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, - { "srch", "source height" , OFFSET(srcH), FF_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, - { "dstw", "destination width" , OFFSET(dstW), FF_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, - { "dsth", "destination height", OFFSET(dstH), FF_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, - { "src_format", "source format" , OFFSET(srcFormat), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, PIX_FMT_NB-1, VE }, - { "dst_format", "destination format", OFFSET(dstFormat), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, PIX_FMT_NB-1, VE }, - { "src_range" , "source range" , OFFSET(srcRange) , FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 1, VE }, - { "dst_range" , "destination range" , OFFSET(dstRange) , FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 1, VE }, - { "param0" , "scaler param 0" , OFFSET(param[0]) , FF_OPT_TYPE_DOUBLE, {.dbl = SWS_PARAM_DEFAULT}, INT_MIN, INT_MAX, VE }, - { "param1" , "scaler param 1" , OFFSET(param[1]) , FF_OPT_TYPE_DOUBLE, {.dbl = SWS_PARAM_DEFAULT}, INT_MIN, INT_MAX, VE }, + { "srcw", "source width" , OFFSET(srcW), AV_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, + { "srch", "source height" , OFFSET(srcH), AV_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, + { "dstw", "destination width" , OFFSET(dstW), AV_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, + { "dsth", "destination height", OFFSET(dstH), AV_OPT_TYPE_INT, {.dbl = 16 }, 1, INT_MAX, VE }, + { "src_format", "source format" , OFFSET(srcFormat), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, PIX_FMT_NB-1, VE }, + { "dst_format", "destination format", OFFSET(dstFormat), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, PIX_FMT_NB-1, VE }, + { "src_range" , "source range" , OFFSET(srcRange) , AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 1, VE }, + { "dst_range" , "destination range" , OFFSET(dstRange) , AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 1, VE }, + { "param0" , "scaler param 0" , OFFSET(param[0]) , AV_OPT_TYPE_DOUBLE, {.dbl = SWS_PARAM_DEFAULT}, INT_MIN, INT_MAX, VE }, + { "param1" , "scaler param 1" , OFFSET(param[1]) , AV_OPT_TYPE_DOUBLE, {.dbl = SWS_PARAM_DEFAULT}, INT_MIN, INT_MAX, VE }, { NULL } }; |